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

Author Topic: HUD interface  (Read 8619 times)

0 Members and 1 Guest are viewing this topic.

wasabi

  • Newbie
  • *
  • Posts: 23
    • View Profile
HUD interface
« on: July 30, 2010, 05:24:38 pm »
I've posted here a few times and every single time (that I can recall), my problems have been related to zooming.

Surprise, surprise, no surprise here. I've finally had quite a bit of success with the zoom function, but now I need to know how to disable it on part of the screen.

I've created a function so that the mouse's global (as opposed to view) coordinates are displayed on the top-right corner of the screen, however, whenever I zoom in or out, the text itself is also resized. Is there a way to prevent this? I know there's the SetSize() function which I can use to adjust the font's size with every zoom, but is there a way of fixing the size relative to the size of the window, instead of the view?

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
HUD interface
« Reply #1 on: July 30, 2010, 06:27:15 pm »
Use another view to display text, one that's never resized (like the default one).
Laurent Gomila - SFML developer

wasabi

  • Newbie
  • *
  • Posts: 23
    • View Profile
HUD interface
« Reply #2 on: July 30, 2010, 07:05:25 pm »
I don't think I get your meaning.

Another window?

Or, how can I have two views appearing in one window?

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
HUD interface
« Reply #3 on: July 30, 2010, 07:40:01 pm »
Of course you can, it is explained in the tutorial

Quote
Accessing the default view is also convenient to go back to the initial view. For example, it can be useful if you want to draw a user interface on top of the game, which usually doesn't follow the camera.

Code: [Select]
App.SetView(View);

// Draw the game...

App.SetView(App.GetDefaultView());

// Draw the interface...

Laurent Gomila - SFML developer

wasabi

  • Newbie
  • *
  • Posts: 23
    • View Profile
HUD interface
« Reply #4 on: July 30, 2010, 07:50:03 pm »
I knew I'd seen that in a tutorial somewhere! I'd looked for it for ages!

And I just understood, this very moment, how .SetView works. I thought that, by using .SetView, you were automatically modifying the display of all shapes, when really, you're only altering the shapes you alter in a given .SetView.

I can see clearly now, the rain is gone.

Well, not really, because it was never raining and I haven't implemented it yet, but I think I got it now.

EDIT: I absolutely hate how easy that was to implement...

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
HUD interface
« Reply #5 on: July 30, 2010, 07:53:59 pm »
;)
Laurent Gomila - SFML developer

 

anything