Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

Hey i'm trying to make a GUI lib with SFML, and everything's done except one problem: Making the Interface stay still even when the camera moves or zooms in/out.

This would be easy to fix if zooming wasn't possible, but zooming out means having to scale the contents of the Interface up so it doesn't shrink, which causes it's text/images to become blurry.

Does anyone have a way to get around this issue? (preferably only using SFML as I don't want to make my lib openGL dependent)

share|improve this question

2 Answers 2

up vote 10 down vote accepted

After you've rendered the world, reset the camera position to something more useful for UIs. Then render the UI. Next frame, put it back to the world position before rendering the world. And so forth.

By "camera position" I really mean "transformation matrix". Nobody says all rendering has to go through the world transformation.

share|improve this answer
3  
+1 the last sentence should read: not all rendering should go through the same view/projection transformation, one can even switch between perspective and orthogonal view in the same render tick –  Maik Semder Jul 30 '11 at 10:31
3  
@Maik Semder good point on noting the switch to orthogonal, which is likely to be what the OP needs for a UI. –  jv42 Jul 31 '11 at 11:05

In SFML terms, you should be changing the active sf::View on your RenderTarget between rendering the world and the GUI. Your world View should be whatever is most convenient for your world rendering and centered on your player position; your UI View should be pixels or some standard resolution, rooted at the origin.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.