Page 1 of 1

What in the world is going on here?!

Posted: Wed Feb 09, 2005 8:39 pm
by Somebody new to Irrlicht
OK, I've started Irrlicht 0.6 (I'll get 0.7 soon) with the Dev-C++ DevPak.
I've ran into to problems:
1. The title screen is REALLLLLLLLLY BLUUUURRRRRRY.
2. When I click on 'quit' it gives me a stupid error message ("The program has performed an illegal operation and will be closed... please tell Microsoft...") :?:

THE CODE

Posted: Wed Feb 09, 2005 8:44 pm
by I'm still new to Irrlicht
Whoops! I forgot the code :oops:
#include <irrlicht.h>

using namespace irr;
using namespace core;
using namespace scene;
using namespace video;
using namespace io;
using namespace gui;

IrrlichtDevice* device = 0;
s32 cnt = 0;
IGUIListBox* listbox = 0;

int resxset = 640;
int resyset = 480;


class EventReceiver1 : public IEventReceiver
{
public:
virtual bool OnEvent(SEvent event)
{
if (event.EventType == EET_GUI_EVENT)
{
s32 id = event.GUIEvent.Caller->getID();

switch(event.GUIEvent.EventType)
{

case EGET_BUTTON_CLICKED:
if (id == 10001)
{
device->closeDevice();
return true;
}

break;
}
}
return false;
}
};


int main()
{
EventReceiver1 receiver;

IrrlichtDevice *device =
createDevice(video::EDT_OPENGL, core::dimension2d<s32>(resxset, resyset), 32, true, true, &receiver);

device->setWindowCaption(L"Fatal Freedom");

IVideoDriver* driver = device->getVideoDriver();
ISceneManager* smgr = device->getSceneManager();
IGUIEnvironment* guienv = device->getGUIEnvironment();

device->getFileSystem()->addZipFileArchive("pak1.pk3");
video:: ITexture* fflogo = driver->getTexture("fatalfreedom.bmp");

guienv->addButton (rect<s32>(320,414,370,428), 0, 10001, L"QUIT");
guienv->addStaticText (L"FATAL FREEDOM", rect<int>(0,450,320,462), true);
guienv->addStaticText (L"DEVELOPED BY DECAPITATION GAMES", rect<int>(0,465,260,477), true);
guienv->addStaticText (L"THIS SOFTWARE IS BASED IN PART ON THE WORK OF THE INDEPENDENT JPEG GROUP", rect<int>(261,465,640,477), true);
guienv->addStaticText (L"USES THE IRRLICHT 3D GAME ENGINE", rect<int>(320,450,640,462), true);


while(device->run())
{
driver->beginScene(true, true, SColor(0,255,255,255));

driver->draw2DImage(fflogo, core::position2d<s32>(0,0),
core::rect<s32>(0, 0, 640, 480), 0,
video::SColor(1, 255, 255, 255), true);

smgr->drawAll();
guienv->drawAll();
driver->endScene();
}
device->drop();

return 0;
}

Anybody who helps gets their name in the credits under "Special Thanks"

Posted: Wed Feb 09, 2005 9:34 pm
by Spintz
What are the dimensions of this bitmap -

fatalfreedom.bmp

640X480

Posted: Thu Feb 10, 2005 2:14 am
by Irrlicht NooB
fatalfreedom.bmp is 640X480 and 24 bit.
(Also, any ideas on the crash bug with the quit button?)

Posted: Thu Feb 10, 2005 8:16 am
by Guest
The reason Spintz asked that is that your titlescreen is displayed as a texture, and textures tend to get mipmapped.

There are two ways around that:
1. turn off mipmapping for the texture - this would probably work like this:

Code: Select all

driver->setTextureCreationFlag(ETCF_CREATE_MIP_MAPS, FALSE);
video:: ITexture* fflogo = driver->getTexture("fatalfreedom.bmp"); 
driver->setTextureCreationFlag(ETCF_CREATE_MIP_MAPS, TRUE);
2. Make a bitmap that is a power of two, e.g. 1024x512, then just show a smaller part of the bitmap.

I don't see anything wrong with the main loop or the event handler that might cause the program to crash - but the tutorial code is for 0.7 and so is the documentation - I suggest trying it with 0.7.

PS: I'looking forward to the credits already:

Special thanks to:
Guest :)

OK then

Posted: Thu Feb 10, 2005 8:14 pm
by I'm new to Irrlicht
Ok THX. I've got it on a "credits list" and under Special Thanks, I've got "GUEST" I'm DLoading 0.7 VERY soon.

Well......

Posted: Thu Feb 10, 2005 11:22 pm
by I'm no newer to Irrlicht
OK, I downloaded Irrlicht 7.0. Anyway, I'm still having problems. I cleaned up the code ALOT.

#include <irrlicht.h>

using namespace irr;
using namespace core;
using namespace scene;
using namespace video;
using namespace io;
using namespace gui;

IrrlichtDevice* device = 0;
s32 cnt = 0;
IGUIListBox* listbox = 0;

int resxset = 640;
int resyset = 480;


class EventReceiver1 : public IEventReceiver
{
public:
virtual bool OnEvent(SEvent event)
{
if (event.EventType == EET_GUI_EVENT)
{
s32 id = event.GUIEvent.Caller->getID();

switch(event.GUIEvent.EventType)
{

case EGET_BUTTON_CLICKED:
if (id == 10001)
{
device->closeDevice();
return true;
}

break;
}
}
return false;
}
};


int main()
{
EventReceiver1 receiver;

IrrlichtDevice *device =
createDevice(video::EDT_OPENGL, core::dimension2d<s32>(resxset, resyset), 32, true, true, true, &receiver);

device->setWindowCaption(L"Fatal Freedom");

IVideoDriver* driver = device->getVideoDriver();
ISceneManager* smgr = device->getSceneManager();
IGUIEnvironment* guienv = device->getGUIEnvironment();

device->getFileSystem()->addZipFileArchive("pak1.pk3");
video:: ITexture* fflogo = driver->getTexture("fatalfreedom.bmp");

guienv->addButton (rect<s32>(320,414,370,428), 0, 10001, L"QUIT");
guienv->addStaticText (L"FATAL FREEDOM", rect<int>(0,450,320,462), true);
guienv->addStaticText (L"DEVELOPED BY DECAPITATION GAMES", rect<int>(0,465,260,477), true);
guienv->addStaticText (L"THIS SOFTWARE IS BASED IN PART ON THE WORK OF THE INDEPENDENT JPEG GROUP", rect<int>(261,465,640,477), true);
guienv->addStaticText (L"USES THE IRRLICHT 3D GAME ENGINE", rect<int>(320,450,640,462), true);


while(device->run())
{
driver->beginScene(true, true, SColor(0,255,255,255));

driver->draw2DImage(fflogo, core::position2d<s32>(0,0),
core::rect<s32>(0, 0, 640, 480), 0,
video::SColor(1, 255, 255, 255), true);

smgr->drawAll();
guienv->drawAll();
driver->endScene();
}
device->drop();

return 0;
}


I think I can fix the blurry image but I still need help with the crash bug.

Posted: Fri Feb 11, 2005 2:17 am
by Magnus
uhm.... blurry image? I had that.. change to software renderer

EDT_OPENGL

to

EDT_SOFTWARE


it shouldnt be blurry then :) oh and I dont care about credits.. lol I know u prolly already knew this lol just trying to be helpful :)

Posted: Fri Feb 11, 2005 2:06 pm
by New 2 Irrlicht
OK, got the blur fixed, :D but I can't seem to fix the crash bug. :?:

Posted: Fri Feb 11, 2005 6:46 pm
by disanti
I've had that same crash since the day I started using Irrlicht, I just learned to get used to it! ;)
________
THE YAZIDI BRANCH OF YAZDANISM ADVICE

It's gotta be fixable...

Posted: Fri Feb 11, 2005 8:45 pm
by N2I (That's New To Irrli)
It's gotta be fixable because the GUI "User Interface Example" works fine; no crash bugs. (Still, if worse comes to worse, I'll get used to it :D )

Posted: Fri Feb 11, 2005 10:35 pm
by Magnus
you cou,ld try giving us the image ur using along with the files and see if we get the same error when compiling :P

ALso: I dont know if this will help but I dont know why you put this here:

Code: Select all

}
return false;
}
thats not there in the tut or any other gui stuff i've seen[/i]

Posted: Sat Feb 12, 2005 7:20 pm
by CZestmyr
I also think, that

Code: Select all

return false;
shouldn't be there. MyEventReceiver is a Class and not a Function.

:arrow: BTW, I've got the same problem with the crashdowns of my app, when trying
to react on events in the event receiver by changing any objects from the main function (eg. I can't change the WindowCaption of my IrrlichtDevice etc).

This just makes it impossible for me to create anything interactive.

I think this is a problem of DevC++, not Irrlicht, because I've got irrlicht 7.0 and DevC++ has seemed to me like a pretty buggy app for a long time.

Posted: Mon Feb 14, 2005 10:44 am
by CZestmyr
shouldn't be there. MyEventReceiver is a Class and not a Function.
Well, changed my mind, now I think it should be there, because it's in a public function OnEvent of the class EventReceiver1.

Yet another thing: I've solved the crashdowns of my appz when using EventReceiver. If you have the same problem (see my post above), just e-mail me. I'll be glad to help.