What in the world is going on here?!

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
Somebody new to Irrlicht

What in the world is going on here?!

Post 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...") :?:
I'm still new to Irrlicht

THE CODE

Post 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"
Spintz
Posts: 1688
Joined: Thu Nov 04, 2004 3:25 pm

Post by Spintz »

What are the dimensions of this bitmap -

fatalfreedom.bmp
Image
Irrlicht NooB

640X480

Post by Irrlicht NooB »

fatalfreedom.bmp is 640X480 and 24 bit.
(Also, any ideas on the crash bug with the quit button?)
Guest

Post 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 :)
I'm new to Irrlicht

OK then

Post 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.
I'm no newer to Irrlicht

Well......

Post 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.
Magnus
Posts: 79
Joined: Sun Jan 16, 2005 5:53 pm
Location: Georgia, USA
Contact:

Post 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 :)
Image
Image
New 2 Irrlicht

Post by New 2 Irrlicht »

OK, got the blur fixed, :D but I can't seem to fix the crash bug. :?:
disanti
Posts: 367
Joined: Sat Jan 17, 2004 1:36 am
Location: California, US
Contact:

Post 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
Last edited by disanti on Thu Feb 24, 2011 10:29 am, edited 1 time in total.
N2I (That's New To Irrli)

It's gotta be fixable...

Post 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 )
Magnus
Posts: 79
Joined: Sun Jan 16, 2005 5:53 pm
Location: Georgia, USA
Contact:

Post 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]
Image
Image
CZestmyr
Posts: 72
Joined: Sat Feb 12, 2005 7:11 pm
Location: Czech Republic
Contact:

Post 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.
CZestmyr
Posts: 72
Joined: Sat Feb 12, 2005 7:11 pm
Location: Czech Republic
Contact:

Post 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.
Post Reply