Each level is a .exe file, so the title screen just starts the program when the user presses "START." The problem is that it causes the first level to have an illegal operation; however, when the first level is run by itself, it runs fine. Odd.
The code:
Code: Select all
// (C) 2005 Decapitation Games
#include <irrlicht.h>
#include <windows.h>
#include <mmsystem.h>
#include <stdio.h>
using namespace irr;
using namespace core;
using namespace scene;
using namespace video;
using namespace io;
using namespace gui;
int main()
{
IrrlichtDevice *deviceIrr = createDevice(video::EDT_OPENGL, core::dimension2d<s32>(640, 480), 32, false, false, false, 0);
printf (".");
IGUIEnvironment* guienv = deviceIrr->getGUIEnvironment();
printf (".");
IVideoDriver* driver = deviceIrr->getVideoDriver();
printf (".");
ISceneManager* smgr = deviceIrr->getSceneManager();
printf (".");
mciSendString("play media/mid0.mid",NULL,0,NULL);
printf (".\n");
//caption
deviceIrr->setWindowCaption (L"(C) 2005 Decapitation Games");
//splash screen
video:: ITexture* splash1 = driver->getTexture("media/splash.jpg");
//buttons are added
guienv->addButton (rect<s32>(5,60,105,635),0,102,L"LOAD");
guienv->addButton (rect<s32>(5,5,105,55),0,101,L"START");
class EventRGUI1 : 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 == 102)
{
}
if (id == 101)
{
ShellExecute(NULL,NULL,"../L1/Eric 3_L1.exe",NULL,NULL,SW_SHOW);
mciSendString ("stop media/mid0.mid",NULL,0,NULL);
return true;
}
break;
}
}
return false;
}
};
EventRGUI1 receiver1;
deviceIrr->setEventReceiver(&receiver1);
//run, stupid
while (deviceIrr->run())
{
driver->draw2DImage(splash1, 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();
}
deviceIrr->drop();
return 0;
}
(Oh, yeah; almost forgot. If someone does help, they get in the "special thnx" in the credits )