Code: Select all
class engine
{
protected:
//Grafic
IrrlichtDevice* EngineDevice;
IVideoDriver* EngineDriver;
ISceneManager* EngineSMGR;
IGUIEnvironment* EngineGUI;
E_DRIVER_TYPE driverType;
IGUISkin* skin;
IGUIFont* font;
ICameraSceneNode* Camera;
//Sound
irrklang::ISoundEngine* SoundEngine;
//Gravity
public:
};
ModelManager.cpp
Code: Select all
#ifndef MODELMANAGER_U_INCLUDE
#define MODELMANAGER_U_INCLUDE
#include "..\headers\cModelManager.h"
using namespace irr;
using namespace core;
using namespace scene;
using namespace video;
using namespace io;
using namespace gui;
int cModelManager::loadmodels()
{
mLaserWeapon = EngineSMGR->getMesh("../media/models/lasergun/gun.md2");
}
#endif
Code: Select all
#ifndef CMODELMANAGER_U_INCLUDE
#define CMODELMANAGER_U_INCLUDE
#include "engine.h"
using namespace irr;
using namespace core;
using namespace scene;
using namespace video;
using namespace io;
using namespace gui;
class cModelManager : engine
{
protected:
public:
IAnimatedMesh* mLaserWeapon;
IAnimatedMeshSceneNode* nLaserWeapon;
int loadmodels();
};
#endif
Code: Select all
#ifndef GAME_U_INCLUDED
#define GAME_U_INCLUDED
#include <iostream>
#include <conio.h>
#include <irrlicht.h>
#include "..\headers\cGame.h"
#include "..\headers\cPlayer.h"
#include "..\headers\cModelManager.h"
#include "..\headers\cMapManager.h"
using namespace irr;
using namespace core;
using namespace scene;
using namespace video;
using namespace io;
using namespace gui;
int cGame::run()
{
EngineDevice=createDevice(EDT_OPENGL,dimension2d<u32>(1024,768),16,false,false,false,0);
EngineDriver = EngineDevice->getVideoDriver();
EngineSMGR = EngineDevice->getSceneManager();
EngineGUI = EngineDevice->getGUIEnvironment();
ISceneNode* skybox=EngineSMGR->addSkyBoxSceneNode(
EngineDriver->getTexture("../media/texture/skybox/irrlicht2_up.jpg"),
EngineDriver->getTexture("../media/texture/skybox/irrlicht2_dn.jpg"),
EngineDriver->getTexture("../media/texture/skybox/irrlicht2_lf.jpg"),
EngineDriver->getTexture("../media/texture/skybox/irrlicht2_rt.jpg"),
EngineDriver->getTexture("../media/texture/skybox/irrlicht2_ft.jpg"),
EngineDriver->getTexture("../media/texture/skybox/irrlicht2_bk.jpg"));
cPlayer PLAYER;
cModelManager ModelMNG;
cMapManager MapMNG;
//ModelMNG.loadmodels();
PLAYER.pCamera = EngineSMGR->addCameraSceneNodeFPS();
//PLAYER.pCamera->addChild(ModelMNG.nLaserWeapon);
PLAYER.pCamera->setFarValue( 9000000 );
//MapMNG.loadmap();
loadmodel();
}
int cGame::Play()
{
EngineGUI->addImage(EngineDriver->getTexture("../media/texture/gui/celownik.png"),
position2d<int>(512,384));
while(EngineDevice->run())
{
EngineDriver->beginScene(true, true, SColor(255,100,101,140));
//GameFps.fpsrecorder(y);
EngineSMGR->drawAll();
EngineGUI->drawAll();
EngineDriver->endScene();
}
}
#endif
//ModelMNG.loadmodels();
//PLAYER.pCamera->addChild(ModelMNG.nLaserWeapon);
Error windows with button don't send report to microsoft windows. help pls.
//class cPlayer is like cModelManager but only with player model.