forked from rubenwardy/NodeBoxEditor
-
Notifications
You must be signed in to change notification settings - Fork 0
/
EditorState.h
68 lines (59 loc) · 1.55 KB
/
EditorState.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
#ifndef _EDITORSTATE_H_INCLUDE_
#define _EDITORSTATE_H_INCLUDE_
#include "common.h"
#include "Configuration.h"
#include "Project.h"
#include "MenuState.h"
#define NUMBER_OF_KEYS 252
enum KeyState{
EKS_UP = false,
EKS_DOWN = true,
};
class Project;
class EditorMode;
class MenuState;
class EditorState
{
public:
EditorState(irr::IrrlichtDevice* dev,Project* proj,Configuration* settings);
// Irrlicht
ITriangleSelector* plane_tri;
irr::IrrlichtDevice* GetDevice() const {return _device;}
// Project
Project* project;
// Editor
EditorMode* Mode() const;
void AddMode(EditorMode* value);
MenuState* Menu() const{return _menu;}
void SetMenu(MenuState* stat){_menu=stat;}
void CloseEditor(){close_requested = true;}
bool NeedsClose() const{return close_requested;}
// Input
bool mousedown;
irr::core::vector2di mouse_position;
KeyState keys[NUMBER_OF_KEYS];
// Settings
Configuration* Settings() const{return _settings;}
private:
irr::IrrlichtDevice* _device;
int currentmode;
list<EditorMode*>* _modes;
Configuration* _settings;
MenuState* _menu;
bool close_requested;
};
class EditorMode:public irr::IEventReceiver
{
public:
EditorMode(EditorState* st):_state(st){}
virtual void load() = 0;
virtual void unload() = 0;
virtual void update() = 0;
virtual void draw(irr::video::IVideoDriver* driver) = 0;
virtual void viewportTick(VIEWPORT window,irr::video::IVideoDriver* driver,rect<s32> offset) = 0;
virtual bool OnEvent(const irr::SEvent &event) = 0;
EditorState* GetState() const {return _state;}
private:
EditorState* _state;
};
#endif