Colobot
object_interface.h
1 /*
2  * This file is part of the Colobot: Gold Edition source code
3  * Copyright (C) 2001-2015, Daniel Roux, EPSITEC SA & TerranovaTeam
4  * http://epsitec.ch; http://colobot.info; http://github.com/colobot
5  *
6  * This program is free software: you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation, either version 3 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
14  * See the GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program. If not, see http://gnu.org/licenses
18  */
19 
20 #pragma once
21 
22 #include "common/event.h"
23 
24 class COldObject;
28 class CPhysics;
29 class CMotion;
30 class CRobotMain;
31 class CSoundInterface;
32 class CLevelParserLine;
33 struct Program;
34 
35 namespace Gfx
36 {
37 class CEngine;
38 class CTerrain;
39 class CWater;
40 class CCamera;
41 class CParticle;
42 } /* Gfx */
43 
44 namespace Ui
45 {
46 class CStudio;
47 class CInterface;
48 class CWindow;
49 
50 
52 {
53 public:
56 
57  void DeleteObject(bool bAll=false);
58 
59  bool EventProcess(const Event &event);
60  bool CreateInterface(bool bSelect);
61 
62  void UpdateInterface(float rTime);
63  void UpdateInterface();
64 
65 protected:
66  bool EventFrame(const Event &event);
67 
68  void StartEditScript(Program* program, char* name);
69  void StopEditScript(bool bCancel);
70 
71  void GroundFlat();
72  void ColorFlag(int color);
73 
74  void UpdateScript(CWindow *pw);
75  int GetSelScript();
76  void SetSelScript(int index);
77  void BlinkScript(bool bEnable);
78 
79  void CheckInterface(CWindow *pw, EventType event, bool bState);
80  void EnableInterface(CWindow *pw, EventType event, bool bState);
81  void DeadInterface(CWindow *pw, EventType event, bool bState);
82  void DefaultEnter(CWindow *pw, EventType event, bool bState=true);
83 
84 protected:
85  Gfx::CEngine* m_engine;
86  Gfx::CTerrain* m_terrain;
87  Gfx::CWater* m_water;
88  Gfx::CCamera* m_camera;
89  Gfx::CParticle* m_particle;
90  CRobotMain* m_main;
91  CInterface* m_interface;
92  CSoundInterface* m_sound;
93 
94  COldObject* m_object;
95  CTaskExecutorObject* m_taskExecutor;
96  CProgrammableObject* m_programmable;
97  CProgramStorageObject* m_programStorage;
98  CPhysics* m_physics;
99  CMotion* m_motion;
100 
101  std::unique_ptr<CStudio> m_studio;
102 
103  int m_selScript; // rank of the selected script
104 
105  EventType m_manipStyle;
106  EventType m_defaultEnter;
107 
108  float m_time;
109  float m_lastUpdateTime;
110  float m_lastAlarmTime;
111  int m_soundChannelAlarm;
112  int m_flagColor;
113 };
114 
115 } // namespace Ui
Definition: robotmain.h:107
Interface for objects that can execute tasks.
Definition: task_executor_object.h:38
Definition: old_object.h:77
Definition: physics.h:98
Interface for programmable objects.
Definition: programmable_object.h:36
Definition: parserline.h:37
Definition: object_interface.h:51
Definition: robotmain.h:151
Particle engine.
Definition: particle.h:223
Interface for objects that store CBOT programs.
Definition: program_storage_object.h:43
Camera moving in 3D scene.
Definition: camera.h:134
Terrain loader/generator and manager.
Definition: terrain.h:145
Namespace for (new) graphics code.
Definition: app.h:49
Definition: motion.h:46
The graphics engine.
Definition: engine.h:620
Event types, structs and event queue.
Water manager/renderer.
Definition: water.h:74
EventType
Type of event message.
Definition: event.h:41
Event sent by system, interface or game.
Definition: event.h:709
Definition: window.h:50
Definition: interface.h:58
Sound plugin interface.
Definition: sound.h:57
Definition: program_storage_object.h:31