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.


Messages - MOtega

Pages: [1]
1
Graphics / Re: Move 2D-Camera with mouse
« on: April 12, 2015, 04:24:13 pm »
Thanks for your reply!!

It seems that it works now if I use this code:
...
sf::Vector2i Mouse = sf::Mouse::getPosition(window);
...
//Game-Loop
view1.setCenter(Mouse.x, Mouse.y);
 

Here it seems to work although the setCenter-command requires a float-vector.

2
Graphics / Move 2D-Camera with mouse
« on: April 12, 2015, 02:46:28 pm »
Hello!

I am new here in the forum and a SFML-beginner and wanted to ask how to move the view-camera with the mouse (for example if you press and hold the right mouse button and move it to also move the camera)?

I tried to get the current mouse position with this code:
sf::Vector2i Mouse = sf::Mouse::getPosition(window);
 

But it's an integer-vector and the view.move command for example requires two float-values.

So how is it possible?

Thank you very much!

MOtega

Pages: [1]
anything