Show Kernel.h syntax highlighted
/**
**************************************************************************************
*Palisma - Secrets of the Illuminati is an open-source 2D RPG *
*Copyright (C) 2006, Tony Sparks *
* *
*This library is free software; you can redistribute it and/or *
*modify it under the terms of the GNU Lesser General Public *
*License as published by the Free Software Foundation; either *
*version 2.1 of the License, or (at your option) any later version. *
* *
*This library is distributed in the hope that it will be useful, *
*but WITHOUT ANY WARRANTY; without even the implied warranty of *
*MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
*Lesser General Public License for more details. *
* *
*You should have received a copy of the GNU Lesser General Public *
*License along with this library; if not, write to the Free Software *
*Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
**************************************************************************************
*/
#pragma once
#include "myriad.h"
#include "timer.h"
/**
* Buffer ids
*/
enum {
BUFFER_CONSOLE
};
/**
==========================
The Heart of the MyriadEngine
The kernel decides which process runs, and
holds all subsystems
==========================
*/
class Kernel
{
public:
Kernel(void);
int Init();
void Shutdown();
void Execute();
void AddProcess(CMMPointer<IProcess> &p);
void SuspendProcess(CMMPointer<IProcess> &p);
void ResumeProcess(CMMPointer<IProcess> &p);
void RemoveProcess(CMMPointer<IProcess> &p);
void KillAll();
long GetTime();
double GetFrameTime();
CMMPointer<IInput>& GetInput() { return m_input; };
CMMPointer<GameManager>& GetGame() { return m_game; };
CMMPointer<IRenderManager>& GetRenderer() { return m_renderer; };
CMMPointer<ISound>& GetSound() { return m_sound; };
CMMPointer<Resource>& GetResource() { return m_resource; };
CMMPointer<ScriptEngine>& GetScriptEngine() { return m_scripter; };
Timer& GetTimer() { return timer; };
// Debugging
Console* GetConsole() { return m_console; };
CMMPointer<Cvars>& GetCvars() { return m_cvars; };
void SetScriptEngine(CMMPointer<ScriptEngine> &s) {
m_scripter = s;
};
void SetResource(CMMPointer<Resource> &r) {
m_resource = r;
};
//void SetTimer( CMMPointer<Timer> &t ) {
// m_timer = t;
//};
/**
=========================
Add the subsystems
=========================
*/
void SetInput(CMMPointer<IInput> &in) {
m_input = in;
};
void SetGame(CMMPointer<GameManager> &g) {
m_game = g;
};
void SetRenderer( CMMPointer<IRenderManager> &r) {
m_renderer = r;
};
void SetSound( CMMPointer<ISound> &s) {
m_sound = s;
};
void SetConsole( Console* c ) {
m_console = c;
};
void SetCvars( CMMPointer<Cvars> &c ) {
m_cvars = c;
};
public:
virtual ~Kernel(void);
private:
std::list< CMMPointer<IProcess> > proList;
std::list< CMMPointer<IProcess> > pausedList;
CMMPointer<IInput> m_input;
CMMPointer<GameManager> m_game;
CMMPointer<IRenderManager> m_renderer;
CMMPointer<ISound> m_sound;
CMMPointer<Resource> m_resource;
CMMPointer<ScriptEngine> m_scripter;
// CMMPointer<Timer> m_timer;
// Debugging
Console* m_console;
CMMPointer<Cvars> m_cvars;
long m_lastFrame;
long m_delta;
Timer timer;
};
See more files for this project here