Welcome, Guest. Please login or register. Did you miss your activation email?

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Topics - vasyaslife

Pages: [1]
Window / How to keep my mouse in the window?
« on: March 21, 2014, 10:10:53 pm »
How i can keep mouse in my created window (app) all the time and don't let it go from it?

i used this method but it's working very bad. Have any idea?

if (focus == true && Mouse::getPosition(app).x < 0) Mouse::setPosition(sf::Vector2i(0, Mouse::getPosition(app).y), app);

if (focus == true && Mouse::getPosition(app).x > xResolution) Mouse::setPosition(sf::Vector2i(xResolution - 5, Mouse::getPosition(app).y), app);

if (focus == true && Mouse::getPosition(app).y < 0) Mouse::setPosition(sf::Vector2i(Mouse::getPosition(app).x, 0), app);

if (focus == true && Mouse::getPosition(app).y > yResolution) Mouse::setPosition(sf::Vector2i(Mouse::getPosition(app).x, yResolution - 5), app);

General / Game Resources. How does it work?
« on: March 21, 2014, 04:47:03 pm »
Can you say me, how can I protect data files (music, textures and other) in my game. For example, in good games there are so many files with strange format and i cant open them with my archiver or Notepad++.

Window / Сooldown key presses
« on: March 21, 2014, 12:45:16 pm »
I work on my project and there is one question.
I have action-game where the man shoots at the target. If i use

if((event.type == Event::KeyPressed) && (event.key.code == Keyboard::E)) Shot();

then my man shot a lot of! How can I slow down the process?
Maybe with clock help? Or should be used for the addition of one variable that stores reloading?

1) Implementation of FPS in games (FPS) How it works? What's the best way? If you use just a cycle and then drawing and calculation of properties of objects then the speed of the game will depend on the performance of your PC. (I use the time between 1 cycle  tact. After that i multiply all the calculations but this method has many disadvantages.)  8)

2) How to draw objects window, if I change the screen resolution?
My method: all graphics has 1920x1080
I divide the selected resolution (K = selected height / 1080), then I use the scale in SFML reduces the width and height of the window after recreates the selected screen resolution. I think - this is not the right solution, because this method at work show lags (probably it connected with a lack of FPS system)  ::)

Pages: [1]