Input is getting on my nerves.
Posted: Fri Feb 10, 2006 8:12 am
Ok, I have GameCore class which handels EVERYTHING. I have three states in my game
1) Main Menu
2) Game
3) Intermission
On both Main Menu and Intermission I need it to check if RETURN is pressed, and if so, run a function in class GameCore. Now in EventRecieve.h(my code) I can't include GameCore.h because it would then in turn re-include EventReciever.h and loop.How can I get it so if a key is pressed, run a function in GameClass.h?
1) Main Menu
2) Game
3) Intermission
On both Main Menu and Intermission I need it to check if RETURN is pressed, and if so, run a function in class GameCore. Now in EventRecieve.h(my code) I can't include GameCore.h because it would then in turn re-include EventReciever.h and loop.How can I get it so if a key is pressed, run a function in GameClass.h?
Code: Select all
#include "headers.h"
#include "EventReceiver.h"
class GameCore
{
public:
GameCore();
~GameCore();
void gameLoop();
void createLevel();
private:
IrrlichtDevice* irrDevice;
IVideoDriver* irrDriver;
ITexture* sprites;
ITexture* map;
IGUIFont* font;
ITimer* timer;
MyEventReceiver* events;
int level;
int gameMode;
};
Code: Select all
#include "headers.h"
class MyEventReceiver : public IEventReceiver
{
public:
virtual bool onEvent(SEvent event)
{
if (event.EventType == EET_KEY_INPUT_EVENT)
{
if(event.KeyInput.Key == KEY_RETURN){
}
}
}
};
Code: Select all
#ifndef Irr
#define Irr
#include <irrlicht.h>
#include <iostream>
#include <vector>
using std::vector;
using namespace std;
using namespace irr;
using namespace io;
using namespace core;
using namespace video;
using namespace gui;
#pragma comment(lib, "Irrlicht.lib")
#ifdef WIN32
#pragma comment(linker, "/subsystem:windows /entry:main")
#endif
#endif