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

Author Topic: HUD Concept? [Solved]  (Read 3175 times)

0 Members and 1 Guest are viewing this topic.

fatum

  • Newbie
  • *
  • Posts: 47
    • MSN Messenger - bowsers7@hotmail.com
    • AOL Instant Messenger - therealblah569
    • View Profile
    • http://boards.psynetfm.com
HUD Concept? [Solved]
« on: October 29, 2011, 12:36:08 am »
If anyone is interested in a solution, I setup something like:

Code: [Select]

sf::View Camera;
sf::View HUD;
...

App.SetView(Camera);
App.Draw(...objects impacted by the camera);
...
App.SetView(HUD);
App.Draw(...objects not impacted by the camera);


------------------------------
Original Post:
------------------------------
Currently I'm caping the framerate with:

Code: [Select]

App.SetFramerateLimit(200);


I was really trying not to impose a limit, but it was proving much work to make everything consistent for everyone, even when using
Code: [Select]

float offset;
...
offset = App.GetFrameTime() * 0.05f;


Anyways, whenever I didn't have a framerate limit, it seems that the HUD stayed in place better.  Currently with the framerate limit, the HUD moves a little bit to the right or left whenever the character moves, or slightly up and down whenever the character jumps.  Here's what I'm currently using to keep it in position (just an example):

Code: [Select]

hud.SetPosition(Camera.GetCenter().x - 445, Camera.GetCenter().y - 295);


I also tried experimenting with setting the hud's position after the App.SetView(Camera); method, but the result is the same.

How do you guys like to ensure that your HUD doesn't move around?

Thanks for any help!

G.

  • Hero Member
  • *****
  • Posts: 1593
    • View Profile
HUD Concept? [Solved]
« Reply #1 on: October 29, 2011, 01:01:31 am »
I don't know what's the purpose of your "offset", neither why the framerate limit would matter when drawing the HUD.

Draw your HUD on another view, which you will never move.

fatum

  • Newbie
  • *
  • Posts: 47
    • MSN Messenger - bowsers7@hotmail.com
    • AOL Instant Messenger - therealblah569
    • View Profile
    • http://boards.psynetfm.com
HUD Concept? [Solved]
« Reply #2 on: October 29, 2011, 01:14:03 am »
Quote from: "G."
I don't know what's the purpose of your "offset", neither why the framerate limit would matter when drawing the HUD.

Draw your HUD on another view, which you will never move.


Thanks for the response!
I just mentioned that it seemed for the hud object to move around a little bit whenever the framerate limit was specified.

Currently I use App.SetView for my Camera view, so I assume that I wouldn't be able to call App.SetView for a separate view as well.  How could I setup the second HUD view?

In my mind it feels that the view will be outside of the the camera view, so it won't be visible.

 

anything