Basic Question about OOP
Posted: Wed Mar 29, 2006 12:21 pm
I want to make a little GUI for my game and made so far no use of Object Orientation. I guess I understood the basics but now I am at a sort of dead point.
I divided my source into multiple Files and don't quite get the hang on how to do this with the IrrEventReceiver Class. My Code:
[CPP]
[H]
Error is:
Class Type redefinition, so I just left the class out in the CPP, leads to different errors.
Hope somebody understands me to point to the correct direction.
I divided my source into multiple Files and don't quite get the hang on how to do this with the IrrEventReceiver Class. My Code:
[CPP]
Code: Select all
#include "Irrlicht_Defs.h"
#include "IrrLoadScreen.h"
#include "Bomberman_Defs.h"
#include "Bomberman.h"
#include "INI.h"
#include "Graphics.h"
#include "IrrExtern.h"
#include "IrrEventReceiver.h"
//##############################################################################
class IrrEventReceiver
{
public:
virtual bool OnEvent(irr::SEvent event)
{
if (event.EventType == irr::EET_GUI_EVENT)
{
irr::s32 id = event.GUIEvent.Caller->getID();
irr::gui::IGUIEnvironment* env = IrrDevice->getGUIEnvironment();
switch(event.GUIEvent.EventType)
{
case irr::gui::EGET_BUTTON_CLICKED:
if (id == 101)
{
}
}
}
}
};
Code: Select all
#ifndef IRREVENTRECEIVER_H
#define IRREVENTRECEIVER_H
class IrrEventReceiver : public irr::IEventReceiver
{
public:
virtual bool OnEvent(irr::SEvent event);
};
#endif IRREVENTRECEIVER_H
Class Type redefinition, so I just left the class out in the CPP, leads to different errors.
Hope somebody understands me to point to the correct direction.