Main.cpp
Code: Select all
#include <iostream>
#include <fstream>
#include <vector>
#include "MyEventReceiver.h"
#include "GameCore.h"
#include "Irrlicht.h"
#pragma comment(lib, "Irrlicht.lib")
using namespace irr;
int main() {
/*
GameCore MyCore;
MyCore.InitDevice();
IrrlichtDevice *device = MyCore.device;
device->getSceneManager();
video::IVideoDriver* driver = device->getVideoDriver();
scene::ISceneManager* smgr = device->getSceneManager();
device->getFileSystem()->addZipFileArchive("map-20kdm2.pk3");
scene::IAnimatedMesh* mesh = smgr->getMesh("20kdm2.bsp");
scene::IAnimatedMeshSceneNode* node;
scene::IAnimatedMesh* mesh2 = smgr->getMesh("Soldier9.3ds");
scene::IAnimatedMeshSceneNode* node2;
scene::ISceneNode* camera = smgr->addCameraSceneNodeFPS();
scene::ISceneNode* camera2 = smgr->addCameraSceneNodeFPS();
int hello = MyCore.receiver.xplane;
if (mesh)
node = smgr->addAnimatedMeshSceneNode(mesh, camera, -1, core::vector3df(10, 0, 0));
node2 = smgr->addAnimatedMeshSceneNode(mesh2, camera, -1, core::vector3df(500, 0, 0));}
int lastFPS = -1;
while(device->run())
{
driver->beginScene ( true, true, video::SColor ( 0, 0, 0, 0 ) );
smgr->drawAll ( );
driver->endScene ( );
int fps = driver->getFPS();
if (lastFPS != fps)
{
core::stringw str = L"Irrlicht Engine - Vertex and pixel shader example [";
str += driver->getName();
str += "] FPS:";
str += fps;
device->setWindowCaption(str.c_str());
lastFPS = fps;
}
}
device->drop();
return 0;
*/
}
GameCore.h
Code: Select all
#ifndef __GAMECORE_H__
#define __GAMECORE_H__
#include "Irrlicht.h"
#include <iostream>
#include "VideoCore.cpp"
using namespace std;
using namespace irr;
class GameCore {
VideoCore() MyVideoCore;
}
#endif
Code: Select all
#ifndef __VIDEOCORE_H__
#define __VIDEOCORE_H__
#include "Irrlicht.h"
#include "MyEventReceiver.h"
using namespace std;
using namespace irr;
class VideoCore
{
private:
IrrlichtDevice* device;
scene::ISceneManager* smgr;
video::IVideoDriver* driver;
ITimer* timer;
gui::IGUIEnvironment* guiEnvironment;
MyEventReceiver* receiver;
video::E_DRIVER_TYPE deviceType;
bool fullscreen;
core::dimension2d<s32> windowSize;
public:
VideoCore();
~VideoCore();
bool Init();
IrrlichtDevice* GetDevice ( ) { return device; }
video::IVideoDriver* GetVideoDriver ( ) { return driver; }
scene::ISceneManager* GetSceneManager ( ) { return smgr; }
gui::IGUIEnvironment* GetGUIEnvironment ( ) { return guiEnvironment; }
MyEventReceiver* GetReceiver ( ) { return receiver; }
int GetTime ( ) { return timer->getTime ( ); }
core::rect<s32> GetViewPort ( ) { return driver->getViewPort ( ); }
int GetViewPortWidth ( ) { return driver->getViewPort ( ).getWidth ( ); }
int GetViewPortHeight ( ) { return driver->getViewPort ( ).getHeight ( ); }
void SetDeviceType ( video::E_DRIVER_TYPE deviceType ) { deviceType = deviceType; }
void SetWindowSize ( core::dimension2d<s32> windowSize ) { windowSize = windowSize; }
void SetFullscreen ( bool fullscreen ) { fullscreen = fullscreen; }
};
#endif
Code: Select all
#include "VideoCore.h"
#include "MyEventReceiver.h"
#include "Irrlicht.h"
using namespace std;
using namespace irr;
// VideoCore Constructor
VideoCore::VideoCore ( )
{
device = NULL;
smgr = NULL;
driver = NULL;
guiEnvironment = NULL;
timer = NULL;
receiver = NULL;
deviceType = NULL;
fullscreen = NULL;
windowSize = NULL;
}
// VideoCore Destructor
VideoCore::~VideoCore ( )
{
if ( receiver )
delete receiver;
}
// VideoCore Initialization
VideoCore::Init()
{
receiver = new MyEventReceiver ( );
device = createDevice(deviceType, windowSize, windowSize, 32, fullscreen, false, false, receiver);
if ( device )
{
smgr = device->getSceneManager ( );
videoDriver = device->getVideoDriver ( );
guiEnvironment = device->getGUIEnvironment ( );
timer = device->getTimer ( );
return true;
}
return false;
}
Compile Errors:
http://img96.exs.cx/img96/5775/compileerrors5us.jpg