Firs the error in the console during the compile :
Code: Select all
g++ -LC:\Users\Arne\workspace\bluedragoon\lib\win32 -obluedragoon.exe sound\src\soundengine.o render\src\renderengine.o render\src\loginmanager.o render\src\loginbuttonevent.o core\src\status.o core\src\skill.o core\src\characterfactory.o core\src\character.o core\src\battlemanager.o bin\main.o -lIrrlicht -lmingw32 -lSDL -lSDLmain -lSDL_mixer
render\src\loginbuttonevent.o: In function `ZN3irr4core12irrAllocatorIcE12internal_newEj':
C:/Users/Arne/workspace/bluedragoon/include/irrlicht/irrAllocator.h:(.bss+0x0): multiple definition of `render::LoginManager::_instance'
render\src\loginmanager.o:C:/Users/Arne/workspace/bluedragoon/include/irrlicht/irrAllocator.h:(.bss+0x0): first defined here
Build error occurred, build is stopped
Time consumed: 2911 ms.
Code: Select all
#ifndef LOGINMANAGER_H_
#define LOGINMANAGER_H_
#include <irrlicht.h>
namespace render {
class LoginManager {
private:
irr::IrrlichtDevice* device;
irr::video::IVideoDriver* video;
irr::scene::ISceneManager* scene;
static LoginManager* _instance;
public:
static LoginManager* instance();
void createDevice(irr::IEventReceiver* reciever, irr::video::E_DRIVER_TYPE deviceType=irr::video::EDT_OPENGL, const irr::core::dimension2d<signed int>& windowsize=irr::core::dimension2d<signed int>(640, 480), unsigned int bitdepth=16, bool fullscreen=false, bool stencilbuffer=false, bool vsync=false);
void render();
irr::gui::IGUIEnvironment* getGUIEnvironment();
void setEventReciever(irr::IEventReceiver* reciever);
protected:
LoginManager();
~LoginManager();
};
// Initialze the pointer variable of the class.
// Only the pointer, not the class.
LoginManager* LoginManager::_instance = NULL;
}
#endif /*LOGINMANAGER_H_*/
Code: Select all
#include "../loginmanager.h"
using namespace render;
LoginManager::LoginManager() {
this->device = 0;
this->scene = 0;
this->video = 0;
}
LoginManager* LoginManager::instance() {
if(NULL == _instance) {
_instance = new LoginManager();
}
return _instance;
}
irr::gui::IGUIEnvironment* LoginManager::getGUIEnvironment() {
return this->device->getGUIEnvironment();
}
void LoginManager::setEventReciever(irr::IEventReceiver* reciever) {
this->device->setEventReceiver(reciever);
}
void LoginManager::createDevice(irr::IEventReceiver* receiver, irr::video::E_DRIVER_TYPE deviceType, const irr::core::dimension2d<signed int>& windowsize, unsigned int bitdepth, bool fullscreen, bool stencilbuffer, bool vsync) {
this->device = irr::createDevice(deviceType, windowsize, bitdepth, fullscreen, stencilbuffer, vsync, receiver);
this->device->setWindowCaption((wchar_t*)"BlueDragoon Login");
this->video = this->device->getVideoDriver();
this->scene = this->device->getSceneManager();
}
void LoginManager::render() {
// TODO: Implement render method
}
LoginManager::~LoginManager() {
this->device->drop();
}