2012-01-14 12:51:24 -06:00
|
|
|
#pragma once
|
|
|
|
|
2012-01-17 14:46:06 -06:00
|
|
|
#include <stack>
|
2012-01-14 12:51:24 -06:00
|
|
|
#include "Singleton.h"
|
|
|
|
#include "Platform.h"
|
|
|
|
#include "Graphics.h"
|
2012-01-17 14:46:06 -06:00
|
|
|
#include "Window.h"
|
2012-01-14 12:51:24 -06:00
|
|
|
|
|
|
|
namespace ui
|
|
|
|
{
|
2012-01-17 14:46:06 -06:00
|
|
|
class Window;
|
2012-01-14 12:51:24 -06:00
|
|
|
|
|
|
|
/* class Engine
|
|
|
|
*
|
|
|
|
* Controls the User Interface.
|
|
|
|
* Send user inputs to the Engine and the appropriate controls and components will interact.
|
|
|
|
*/
|
|
|
|
class Engine: public Singleton<Engine>
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
Engine();
|
|
|
|
~Engine();
|
|
|
|
|
2012-01-17 14:46:06 -06:00
|
|
|
void ShowWindow(Window * window);
|
|
|
|
void CloseWindow();
|
|
|
|
|
2012-01-14 12:51:24 -06:00
|
|
|
void onMouseMove(int x, int y);
|
|
|
|
void onMouseClick(int x, int y, unsigned button);
|
|
|
|
void onMouseUnclick(int x, int y, unsigned button);
|
|
|
|
void onMouseWheel(int x, int y, int delta);
|
2012-01-29 18:40:28 -06:00
|
|
|
void onKeyPress(int key, Uint16 character, bool shift, bool ctrl, bool alt);
|
|
|
|
void onKeyRelease(int key, Uint16 character, bool shift, bool ctrl, bool alt);
|
2012-01-14 12:51:24 -06:00
|
|
|
void onResize(int newWidth, int newHeight);
|
|
|
|
void onClose();
|
|
|
|
|
2012-01-15 13:35:40 -06:00
|
|
|
void Begin(int width, int height);
|
2012-01-14 12:51:24 -06:00
|
|
|
inline bool Running() { return running_; }
|
|
|
|
void Exit();
|
|
|
|
|
2012-01-31 12:49:14 -06:00
|
|
|
void Tick();
|
2012-01-14 12:51:24 -06:00
|
|
|
void Draw();
|
|
|
|
|
2012-01-31 12:49:14 -06:00
|
|
|
void SetFps(float fps);
|
|
|
|
|
2012-01-14 12:51:24 -06:00
|
|
|
inline int GetMouseX() { return mousex_; }
|
|
|
|
inline int GetMouseY() { return mousey_; }
|
|
|
|
inline int GetWidth() { return width_; }
|
|
|
|
inline int GetHeight() { return height_; }
|
|
|
|
|
|
|
|
inline void SetSize(int width, int height);
|
|
|
|
|
2012-01-17 14:46:06 -06:00
|
|
|
//void SetState(Window* state);
|
|
|
|
//inline State* GetState() { return state_; }
|
|
|
|
inline Window* GetWindow() { return state_; }
|
2012-01-15 13:35:40 -06:00
|
|
|
float FpsLimit;
|
2012-01-17 14:46:06 -06:00
|
|
|
Graphics * g;
|
2012-06-20 07:40:18 -05:00
|
|
|
|
|
|
|
unsigned int FrameIndex;
|
2012-01-14 12:51:24 -06:00
|
|
|
private:
|
2012-01-31 12:49:14 -06:00
|
|
|
float dt;
|
|
|
|
float fps;
|
2012-01-21 17:29:40 -06:00
|
|
|
pixel * lastBuffer;
|
|
|
|
std::stack<pixel*> prevBuffers;
|
2012-01-17 14:46:06 -06:00
|
|
|
std::stack<Window*> windows;
|
|
|
|
//Window* statequeued_;
|
|
|
|
Window* state_;
|
2012-01-23 16:53:57 -06:00
|
|
|
Point windowTargetPosition;
|
|
|
|
float windowOpenState;
|
2012-01-14 12:51:24 -06:00
|
|
|
|
|
|
|
bool running_;
|
|
|
|
|
|
|
|
int mousex_;
|
|
|
|
int mousey_;
|
|
|
|
int mousexp_;
|
|
|
|
int mouseyp_;
|
|
|
|
int width_;
|
|
|
|
int height_;
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|