GUI problem

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
Bodzio
Posts: 15
Joined: Mon Nov 10, 2008 8:53 am

GUI problem

Post by Bodzio »

Hi I have a problem, namely, when I implementing GUI, compiler does not return errors but when i want to run it - BOOM! and the application crash.

Irrlicht Console Log
Irrlcht Engine version 1.5
Microsoft Windows XP Professional Dodatek Service Pack 1 <Build 2600>
Using renderer: OpenGl 2.0.3
GeForce 5200/PCI/SSE2 NVIDIA Corporation
OpenGl driver version is 1.2 or better
GLSL version 1.2
_
Can someone help me:

CGUI.cpp

Code: Select all

#include [...]

CGUI::CGUI()
{

   //KLAGUI INITIALIZATION
    skin = new irr::gui::CImageGUISkin(env , "media/gui/default.skin");

    env->getFileSystem()->addZipFileArchive("media/gui/default.skin");
    io::IXMLReader* xml =     env->getFileSystem()->createXMLReader("guiskin.xml");
    env->setSkin(skin);
    loadGUI();
}

CGUI::~CGUI()
{
    [...]
}

void CGUI::loadGUI()
{
    env->addStaticText(L"Hello World! This is the Irrlicht Software renderer!",
                rect<s32>(10,10,260,22), true);

[...]
}
CGame.cpp

Code: Select all

CGame::CGame()
{
	device = createDevice(...);

	driver = device->getVideoDriver();
	smgr = device->getSceneManager();
        guiobj = new CGUI();

}

CGame::~CGame()
{
[...]
}

void CGame::Run()
{
	while(device->run() && driver)
	{
		driver->beginScene(true, true, video::SColor(0,200,200,200));
			smgr->drawAll();
            device->getGUIEnvironment()->drawAll();
		driver->endScene();
	}
}


I omitted CGame.h and CGUI.h files

Thanks
Sylence
Posts: 725
Joined: Sat Mar 03, 2007 9:01 pm
Location: Germany
Contact:

Post by Sylence »

Where exactly does it crash ?
Software documentation is like sex. If it's good you want more. If it's bad it's better than nothing.
FuzzYspo0N
Posts: 914
Joined: Fri Aug 03, 2007 12:43 pm
Location: South Africa
Contact:

Post by FuzzYspo0N »

Code: Select all

    skin = new irr::gui::CImageGUISkin(env , "media/gui/default.skin"); 

    env->getFileSystem()->addZipFileArchive("media/gui/default.skin"); 

This looks backwards... Creating a skin from /media/gui/default.skin and THEN loading the skin?
wouldnt loading the skin FIRST be the best plan?
Acki
Posts: 3496
Joined: Tue Jun 29, 2004 12:04 am
Location: Nobody's Place (Venlo NL)
Contact:

Post by Acki »

just a wild guess, is env in CGUI a valid pointer ??? :lol:
while(!asleep) sheep++;
IrrExtensions:Image
http://abusoft.g0dsoft.com
try Stendhal a MORPG written in Java
Bodzio
Posts: 15
Joined: Mon Nov 10, 2008 8:53 am

Post by Bodzio »

Here i upload all my source files and includes http://irrlicht.unl.pl/users/game.zip
vitek
Bug Slayer
Posts: 3919
Joined: Mon Jan 16, 2006 10:52 am
Location: Corvallis, OR

Post by vitek »

Code: Select all

   //KLAGUI INITIALIZATION 
    skin = new irr::gui::CImageGUISkin(env , "media/gui/default.skin"); 

    env->getFileSystem()->addZipFileArchive("media/gui/default.skin"); 
    io::IXMLReader* xml =     env->getFileSystem()->createXMLReader("guiskin.xml"); 
Yeah, I'm with FuzzYspoON. Something is wrong with one of the above lines.

If the file media/gui/default.skin is a valid skin file, you probably cannot open open it as a zip file archive, and if it is a valid zip file archive, you can't open it as a skin.

Also, it appears that you've modified the Irrlicht library because I don't know that Irrlicht provides a class named CImageGUISkin. If you've modified the library, you need to ensure that you've rebuilt the dll and that the dll that is being linked at runtime matches up with the library you compiled against.

Travis
Bodzio
Posts: 15
Joined: Mon Nov 10, 2008 8:53 am

Post by Bodzio »

Yes! I was solved this problem with very helpful class from this project- http://one-engine.cvs.sourceforge.net/v ... ectViewer/
Post Reply