SFML community forums
Help => Graphics => Topic started by: vEjEsE on August 03, 2010, 11:16:02 pm
-
Is there any way to make an object stick to the window, like saying in a RTS game a menu bar and minmap are in the same position related to the window's coordinates even though the background is moving.
I know that the mouse's coordinates dosen't depend on the view's transformation, but I don't see how I could use that...
So, besides moving the menu with the view, is there an other way?
-
Here's some sample code.
sf::View example;
App.SetView(example);
//Draw the stuff that scrolls
App.SetView(App.GetDefaultView());
//Draw the HUD
-
That code draws the things that are in the view and then goes back to the view's default position, right?
Isn't that CPU expensive? And wouldn't it draw the scrolling backgrond objects from the default position?
-- Thanks for the quick answer.
-
That code draws the things that are in the view and then goes back to the view's default position, right?
Isn't that CPU expensive? And wouldn't it draw the scrolling backgrond objects from the default position?
I'm not sure how it's implemented, but I think that its just a simple variable change which would mean that it's not that CPU expensive. It's mentioned in the tutorial (http://www.sfml-dev.org/tutorials/1.6/graphics-views.php).
-- Thanks for the quick answer.
No problem.
-
Indeed, views are almost free to use.