button won't appear

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
Evil Game Manic
Posts: 12
Joined: Sun Apr 23, 2006 11:05 pm

button won't appear

Post by Evil Game Manic »

it might be something that i just overlooked :roll:,but that's beside the point....
i'll tried to fix this error in which the buttons are suppose to appear and be able to be used,but they don't and it's driving me crazy :shock:

Code: Select all

//game manager.cpp
void game_manager::displaybuttons()//the button displaying
{
    irrGUIEnvironment->addButton(rect<s32>(10,210,100,280), 0, 101, L"start");
    irrGUIEnvironment->addButton(rect<s32>(10,250,100,290), 0, 102, L"quit");
}

void game_manager::start()
{
 	 this->addskymap();
 	 this->loadweapon();
 	 this->loadmap01();
}

void game_manager::quit()
{
 	 this->irrDevice->closeDevice();
}

bool game_manager::OnEvent(SEvent event)
{	 
 		 	 if (event.EventType == EET_KEY_INPUT_EVENT &&
                 event.KeyInput.Key == KEY_ESCAPE &&
		         event.KeyInput.PressedDown == false)
		         {
			      this->getirrDevice()->closeDevice();
			      }
			      if(event.EventType == EET_GUI_EVENT)
			      {
				   					 s32 id = event.GUIEvent.Caller->getID();
				   					 
				   					 switch(event.GUIEvent.EventType)
				   					 {
		  								 case EGET_BUTTON_CLICKED:
										 	  if(id = 101)
										 	  {
											   		this->start();
											   		return true;
													}
													if(id = 102)
													{
													 	  this->quit();
													 	  return true;
														  }
														  break;
														  
														  }
														  }												  
		  								 return false;
		  								 
			      if(event.EventType == EET_KEY_INPUT_EVENT &&
			         event.KeyInput.Key == KEY_KEY_W &&
			         event.KeyInput.PressedDown == true)
			         {
  						 move_foward();
							}
      
			      if(event.EventType == EET_KEY_INPUT_EVENT &&
			         event.KeyInput.Key == KEY_SPACE &&
			         event.KeyInput.PressedDown == true ||
			         EET_MOUSE_INPUT_EVENT &&
                     event.MouseInput.Event == EMIE_LMOUSE_LEFT_UP)
                                               {
					 						shoot1();
												}
}
//game.cpp

#include <irrlicht.h>
#include <iostream>
#include "game_manager.h"

using namespace std;

int main()
{

game_manager g_manager;
g_manager.CreateDevice();
g_manager.getirrDevice();
g_manager.getirrGUIEnvironment();
g_manager.getirrSceneManager();

g_manager.Init();

g_manager.displaybuttons();

	g_manager.irrDevice->setResizeAble(true);

	while(g_manager.irrDevice->run())
	{
	if (g_manager.irrDevice->isWindowActive())
	{
		g_manager.irrVideoDriver->beginScene(true, true,video::SColor(1,100,59,157));

		g_manager.irrSceneManager->drawAll();

		g_manager.irrVideoDriver->endScene();
	}
				 }
	g_manager.irrDevice->drop();

return 0;
}
to who ever helps (keyword here)thanxs :mrgreen:
I'm not Game Manic
Acki
Posts: 3496
Joined: Tue Jun 29, 2004 12:04 am
Location: Nobody's Place (Venlo NL)
Contact:

Post by Acki »

In your main loop you're only drawing the scene manager (for 3d graphics) you also have to draw the gui !!!
while(!asleep) sheep++;
IrrExtensions:Image
http://abusoft.g0dsoft.com
try Stendhal a MORPG written in Java
Post Reply