What in the world is going on here?!
What in the world is going on here?!
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'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
Whoops! I forgot the code
#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"
#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"
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:
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
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);
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
Well......
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.
#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.
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
________
THE YAZIDI BRANCH OF YAZDANISM ADVICE
Last edited by disanti on Thu Feb 24, 2011 10:29 am, edited 1 time in total.
It's gotta be fixable...
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 )
you cou,ld try giving us the image ur using along with the files and see if we get the same error when compiling
ALso: I dont know if this will help but I dont know why you put this here: thats not there in the tut or any other gui stuff i've seen[/i]
ALso: I dont know if this will help but I dont know why you put this here:
Code: Select all
}
return false;
}
I also think, that
shouldn't be there. MyEventReceiver is a Class and not a Function.
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.
Code: Select all
return false;
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.
Well, changed my mind, now I think it should be there, because it's in a public function OnEvent of the class EventReceiver1.shouldn't be there. MyEventReceiver is a Class and not a Function.
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.