1

I dont know how many people have use SFML, but I basically want to draw my GUI and am unsure of how to do so.

To clarify I know how to draw a GUI but I don't know the 'correct' way to do so.

Currently I am drawing a GUI in the same RenderWindow that is used to draw the Game.

I have started to introduce Views into my game, I have a Game View and a GUI View, which take up 75% and 25% of the screens height (respectively).

Now the question is:

  • Should I render the GUI in the same RenderWindow but in a portion of the 'map' the player is unable to reach and have the GUI View locked on that location displaying the GUI.

  • Another idea I have thought of (unsure if it is plausible) is to have a second RenderTarget which renders the GUI and is dispalyed in the GUI View.

If there is a method I have not discovered or one that is recommend I am happy to hear about it, I searched but all I have found is the SFML Documentation in which I couldn't find my answer.

CS Dude
  • 421
  • 4
  • 14

1 Answers1

0

Your question is slightly confusing as I do not know whether you are having a design issue, or a technical issue of implementing the UI. In terms of the design issue:

I have started to introduce Views into my game, I have a Game View and a GUI View, which take up 75% and 25% of the screens height (respectively).

I haven't encountered where using multiple views will be needed for an UI. Take this example: enter image description here

The UI consists of all the images in the black area. The positions' of those images are always updated relative to the position of the game view that follows the player around, nothing more. A second view isn't needed because the components (images) of the UI follow the view around, just as the view follows the player around.

Now, if you are having a technical issue, then please elaborate on the exact issue that has some accompanying code and I will do everything I can to help out.

Community
  • 1
  • 1
Donald
  • 633
  • 5
  • 16
  • Ah okay, when I was reading the SFML documentation it says "This can be useful if you want to define your own view based on it, or restore it to draw fixed entities (like a GUI) on top of your scene." I thought they were implying you should use seperate views, one for the GUI, one for the Game. I will simply use the one view and render the GUI relative to this view. Thanks :) – CS Dude Sep 11 '15 at 03:29