Original Post
Where can I find information on ParaGUI besides their site? There seems to be no easy to understand tutorial type information for this :(
Quote:
Original post by Rob Loach
What do you need for your GUI?

class MainMenu : public System::GUI::Menu { // The main menu is a GUI menu // To initialize the control void Initialize(){ // Add some items to it AddItem("Start Game"); AddItem("Options"); AddItem("Highscores"); AddItem("Exit"); ItemSpacing(20); // Change look Items.BackColour(180,10,10,170); Items.HoverColour(220,10,10,250); Items.BorderColour(0,0,0,255); Items.TextColour(0,0,0); // Location Width(200); Height(40); x(System::Width/2 - Width()/2); y(50); } // When an item is selected void Select(std::string item){ if(item == "Start Game"){ // Start the game } else if(item == "Options"){ System::SetState(OptionsState); } else if(item == "Highscores"){ System::SetState(HighScoreState); } else if(item == "Exit"){ System::Going = false; // stop the application } }}; void SetState(State* state); class State{ public: virtual void Enter(){ } virtual void Update(){ } virtual void Draw(){ } virtual void DrawAfterGUI(){ } virtual void KeyDown(int key){ } virtual void KeyUp(int key){ } virtual void MouseButtonDown(int button){ } virtual void MouseButtonUp(int button){ } virtual void MouseMotion(){ } virtual void Exit(){ } virtual void Initialize(){ } bool Initialized(){ return m_initialized; } bool Initialized(bool init){ return m_initialized = init; } protected: bool m_initialized; private: };// Then to use it you have all your different game state:class CMainMenuState : public System::State { public: void Initialize(); void Update(); void Draw(); void DrawAfterGUI();};

Quote:Memory would be a huge issue with this system. If you store the whole map/GUI in memory, you'll end up with a huge amount of repeated data, some of which you wouldn't be using anyway if the control/tile isn't on the screen. The "overhead" you're talking about offsetting the tile would be a simple multiplication (TileX * TileWidth) and I don't think that would be worth changing to have the large amount of memory required to store copies of information that's already in memory. K.I.S.S. Also, what if your controls are changing appearance rapidly? You're going to have to re-draw the objects anyway.
Original post by evillive2
Something I found to be most helpful in making this not so slow is that the parent objects create their own surface to be rendered to and then render thier children to that surface then that surface is rendered to the screen every frame and is only updated when something changes. This greatly reduces the number of calls to SDL_BlitSurface/frame which while profiling my code is definitely the biggest hog because I easily get a good 10-15 fps boost from doing this instead of redrawing the whole gui window each frame.
Try it yourself, blit a 20x15 tilemap of 32x32 tiles to the screen for a minute and then check out the profile time, then blit that tilemap to an offscreen surface once then just keep blitting the snigle surface to the screen for a minute and see which one produces the better results.
On the obvious side SDL_BlitSurface comes with some overhead so of course calling it more often will be more expensive. On the not so obvious side there is also work being done (although minimal) to offset the next tile being drawn so it shows up in the right place. This is of course a non-practical example because in a scrolling game such that I am making, the map changes so much it actually creates more overhead but in gui situations where things change maybe once per second or even less often then this is a huge time saver.
Quote:Hah, I took a look at it through their website [smile].
Original post by leiavoia
...

Quote:
Original post by Rob Loach
Memory would be a huge issue with this system. If you store the whole map/GUI in memory, you'll end up with a huge amount of repeated data, some of which you wouldn't be using anyway if the control/tile isn't on the screen. The "overhead" you're talking about offsetting the tile would be a simple multiplication (TileX * TileWidth) and I don't think that would be worth changing to have the large amount of memory required to store copies of information that's already in memory. K.I.S.S. Also, what if your controls are changing appearance rapidly? You're going to have to re-draw the objects anyway.
**snip***
Quote:
Original post by RhaalI was looking for an easy-to-use GUI that was friendly with SDL but it doesn't look too hopeful.
This topic has been locked by a moderator. New replies are not allowed.
With your permission, GameDev.net uses analytics cookies to understand how people use the platform. You can accept analytics or continue with necessary cookies only. Learn more