It is currently Fri Nov 24, 2017 6:04 am

All times are UTC - 5 hours




 Page 1 of 1 [ 6 posts ] 
Author Message
 Post subject: Ghost VMK 4A->4K - GUI Manager
PostPosted: Sun Jun 15, 2008 11:34 pm 
Site Admin

Joined: Sun Feb 11, 2007 8:59 am
Posts: 1105
Location: Ontario Canada
VMK4A is a short introduction to the GUI Manager class which will be added to the game engine. The GUI Manager will be responsible for managing all the GUI assets that are loaded into the game engine.

In VMK4B/C/D the GuiManager class is created and all the code used to interface with a GUIButton is added into the manager.

The GUIButton and GUIControl classes are upgraded in VMK4E so that they will work with the new GuiManager.

In VMK4F/G I show how to update the existing GUI classes and the Scene class so that I can begin to use the guiManager in the game.

The GUI Image class is added to the manager in VMK4H.

In VMK4I, the Scene class is updated to use the Gui Manager's GUI Image's on the main menu. The splash screen is also converted to a GUI Image.

VMK4J: A cursor object is created and added into the GUI Manager class.

VMK4K: The Gui Manager is updated to include the console command GUI. When you activate this command, you are able to move/position GUI controls on the screen using your mouse.


Last edited by Marek on Thu Jul 10, 2008 2:42 pm, edited 3 times in total.

Offline
 Profile  
 
 Post subject:
PostPosted: Thu Jul 03, 2008 1:05 pm 

Joined: Sat Apr 19, 2008 6:26 am
Posts: 62
Hello.

I create menu selector and menu image (VMK4H). I`ts works. :P


Image

Question. I do this well ?


code guiRender()

if(gs == GS_MENU){     if(m_pGameOGL->getMenuSelected()==MENU_QUIT){                           m_GuiManager.setPosition(GUID_MAIN_SELECT,Vertex2(220,104));
      }
      else{
         m_GuiManager.setPosition(GUID_MAIN_SELECT,Vertex2(220,float(388 - 61 * m_pGameOGL->getMenuSelected())));      }
   }


code  initMainMenu()                             
   
// Selector
if(!m_GuiManager.addimage(GUID_MAIN_SELECT,GS,Vertex2(240,390),Vertex2(33,24))) {return false;}
   if(!m_GuiManager.setImageTexture(GUID_MAIN_SELECT,m_guiTextureID,Vertex2(27,30))){return false;}


Offline
 Profile  
 
 Post subject:
PostPosted: Thu Jul 03, 2008 2:16 pm 
Site Admin

Joined: Sun Feb 11, 2007 8:59 am
Posts: 1105
Location: Ontario Canada
Looks excellent. I'll be posting the next VMK showing how to do this today if I get some free time.


Offline
 Profile  
 
 Post subject: Re: Ghost VMK 4A->4K - GUI Manager
PostPosted: Mon Feb 13, 2012 5:42 pm 

Joined: Sat Aug 16, 2008 7:58 am
Posts: 450
Im having a problem with the GUIManager. I just finished the part with getting the buttons to display and work. My code compiles, build and runs fine. When the game starts the 4 buttons on the main menu are drawn correctly, however when I try to click on the quit button it doesn't want to exit. I checked the scene class's functions, the GUIManager class, GUIControl and GUIButton class for any errors and I do not seem to find any. The source I am writing now I am using VS2010. When Run the debugger I set a break point inside of GUIManager::AddButton() just before we set our 2 std::maps and std::vector to create our Lookup Table, these are the 3 lines of code I am looking at.

_mLookup[gs].insert( make_pair( id, _vpGUI[gs].size() ) );
_mGuidGameState.insert( make_pair( id, gs ) );
_vpGUI[gs].push_back( pButton ); // the last line of code after the push back in this function is "return true;" I press F10 to step through each line of code and stop at the return statement. While inside of Visual Studio, I move the mouse over my variables to check their values. Here is what I am seeing.

pButton is valid and _mGuidGameState is valid, however _mLookup[gs] ... id is valid with GUID_MAIN_BTN_QUIT and gs is valid with GS_MENU, but _mLookup does not contain anything, and for _vpGUI[gs] it is the same thing. gs is valid with GS_MENU, but their is nothing in the vector array. This is the sad part. I opened up my Ghost Toast from visual studio 2008 and check the source vs where I am at and I don't see any errors in my 2010 version source code. When I run the debugger in 2008 at the same location. ALL values are valid.

For some reason at this point in the code nothing is being inserted into _mLookup and nothing is being pushed_back into _vpGUI. I went back into the Scene::Initialize() and check for errors in _textureManger for loading in the tga file and all is good, then I checked InitMainMenu() and All calls are correct. Any Ideas?

I also check GameOGL::MessageHandler() .... stumped on this one.


Offline
 Profile  
 
 Post subject: Re: Ghost VMK 4A->4K - GUI Manager
PostPosted: Mon Feb 13, 2012 9:45 pm 
Site Admin

Joined: Sun Feb 11, 2007 8:59 am
Posts: 1105
Location: Ontario Canada
that sounds very strange. Have you tried cleaning your solution and doing a fresh debug build? Also try inserting values into the map at a different spot in your source code to see if that makes any difference.


Offline
 Profile  
 
 Post subject: Re: Ghost VMK 4A->4K - GUI Manager
PostPosted: Sat Feb 18, 2012 7:42 am 

Joined: Sat Aug 16, 2008 7:58 am
Posts: 450
I had to go back and rewatch the videos a few times. It was not a bug in the code, I was missing a line of code. Inside of the GUIManager class inside of the checkHotspot function I was missing the if ( id != GUID_NONE ) { break; } inside of the for loop. Now everything works fine. This is also why it was so hard for me to debug the code. It was going into a loop to check for the hotspot everytime and would not break out of it.


Offline
 Profile  
 
Display posts from previous:  Sort by  
 Page 1 of 1 [ 6 posts ] 

All times are UTC - 5 hours


Who is online

Users browsing this forum: No registered users and 0 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Jump to:  

cron