GUI button is unpressable
GUI button is unpressable
I have created a button just like in the tutorials and I when I press on it nothing happens, I mean it doesn't look like the button is being pressed instead it looks like it ignore my clicks.
shall we guess or do you think we are mental magicians ?!?!?
provide some code !!!
in your case it's probably the event receiver (also just guessing)...
provide some code !!!
in your case it's probably the event receiver (also just guessing)...
while(!asleep) sheep++;
IrrExtensions:
http://abusoft.g0dsoft.com
try Stendhal a MORPG written in Java
IrrExtensions:
http://abusoft.g0dsoft.com
try Stendhal a MORPG written in Java
I use MastEventReceiver.
In Main:
In CGUI:
in MastEventReceiver.hpp (I added to the original)
Code: Select all
struct SDevice
{
IrrlichtDevice *device;
IVideoDriver *driver;
ISceneManager *smgr;
IGUIEnvironment *gui;
ISoundEngine *sound_Engine;
MastEventReceiver *eventReceiver;
};
// for the places you see DeviceInfo..
SDevice DeviceInfo;
Code: Select all
CGUI *GUI = new CGUI(GS->getSDevice());
while(device->run() && driver)
if (device->isWindowActive())
{
driver->beginScene(true, true, SColor(255,0,0,0));
eventReceiver->endEventProcess();
switch (OrderOfThings)
{
case E_INTRO:
if (Intro)
if (Intro->drawAll())
{
delete Intro; Intro = 0;
OrderOfThings = E_MENU;
}
break;
case E_MENU:
device->getCursorControl()->setVisible(true);
device->getCursorControl()->setPosition(device->getCursorControl()->getPosition());
GUI->setVisible(GUI_MENU, true);
//OrderOfThings = E_GAME;
break;
case E_GAME:
GUI->setVisible(GUI_MENU, false);
GUI->setVisible(GUI_GAME, true);
OrderOfThings = E_EXIT;
break;
case E_EXIT:
device->closeDevice();
break;
}
if (eventReceiver->keyPressed(27))
device->closeDevice();
GUI->drawAll();
eventReceiver->startEventProcess();
driver->endScene();
}
Code: Select all
void CGUI::setVisible(E_GUIS gui, bool flag)
{
switch (gui)
{
case GUI_MENU:
Buttons[0]->setVisible(flag);
break;
case GUI_GAME:
break;
}
}
void CGUI::drawAll()
{
s32 fps = DeviceInfo.driver->getFPS();
stringw stFPS = "FPS: "; stFPS += fps;
if ((font) && (font_Big))
font_Big->draw(stFPS.c_str(), rect<s32>(0,0,20,10), SColor(255,255,255,128));
DeviceInfo.gui->drawAll();
}
void CGUI::Load_Menu() // called in the constructor
{
IGUIButton *button = 0;
button = DeviceInfo.gui->addButton(rect<s32>(350,250,400,300), 0, 101, L"Quit", L"Exits Program");
button->setVisible(false);
Buttons.push_back(button);
}
Code: Select all
virtual bool OnEvent(const SEvent& event)
{
bool eventprocessed = false;
//////////////////////////////
// GUI Input Event
//////////////////////////////
if (event.EventType == EET_GUI_EVENT)
{
s32 id = event.GUIEvent.Caller->getID();
switch(event.GUIEvent.EventType)
{
case EGET_BUTTON_CLICKED:
if (id == 101)
{
device->closeDevice();
return true;
}
break;
default:
break;
}
}
//////////////////////////////
// Keyboard Input Event
//////////////////////////////
.
.
.
.
Last edited by MasterGod on Wed Sep 26, 2007 10:52 pm, edited 1 time in total.
the receiver (at least the part you posted) seems to be correct...
Although I don't know anything about this MastEventReceiver...
Did you pass the receiver correctly to the device ???
Is it correct to call eventReceiver->startEventProcess(); before driver->endScene(); ???
Was there not a focus problem (bug) in v1.3.1, maybe this is you problem ???
Although I don't know anything about this MastEventReceiver...
Did you pass the receiver correctly to the device ???
Is it correct to call eventReceiver->startEventProcess(); before driver->endScene(); ???
Was there not a focus problem (bug) in v1.3.1, maybe this is you problem ???
while(!asleep) sheep++;
IrrExtensions:
http://abusoft.g0dsoft.com
try Stendhal a MORPG written in Java
IrrExtensions:
http://abusoft.g0dsoft.com
try Stendhal a MORPG written in Java
I'v just read about this problem, I think this is it, cause the receiver is working fine, exactly as it should but it looks like I cant interact with the button at all so maybe its the focus thing..Acki wrote: Was there not a focus problem (bug) in v1.3.1, maybe this is you problem ???
So what can I do if it is that problem?