Colobot
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Pages
object_interface.h
1 /*
2  * This file is part of the Colobot: Gold Edition source code
3  * Copyright (C) 2001-2016, 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 struct Program;
33 
34 namespace Gfx
35 {
36 class CEngine;
37 class CTerrain;
38 class CWater;
39 class CCamera;
40 class CParticle;
41 } /* Gfx */
42 
43 namespace Ui
44 {
45 class CStudio;
46 class CInterface;
47 class CWindow;
48 
49 
51 {
52 public:
55 
56  void DeleteObject(bool all=false);
57 
58  bool EventProcess(const Event &event);
59  bool CreateInterface(bool bSelect);
60 
61  void UpdateInterface(float rTime);
62  void UpdateInterface();
63 
64 protected:
65  bool EventFrame(const Event &event);
66 
73  void StartEditScript(Program* program, std::string name);
79  void StopEditScript(bool closeWithErrors);
80 
81  void GroundFlat();
82  void ColorFlag(int color);
83 
84  void UpdateScript(CWindow *pw);
85  int GetSelScript();
86  void SetSelScript(int index);
87  void BlinkScript(bool bEnable);
88 
89  void CheckInterface(CWindow *pw, EventType event, bool bState);
90  void EnableInterface(CWindow *pw, EventType event, bool bState);
91  void DeadInterface(CWindow *pw, EventType event, bool bState);
92  void DefaultEnter(CWindow *pw, EventType event, bool bState=true);
93 
94 protected:
95  Gfx::CEngine* m_engine;
96  Gfx::CTerrain* m_terrain;
97  Gfx::CWater* m_water;
98  Gfx::CCamera* m_camera;
99  Gfx::CParticle* m_particle;
100  CRobotMain* m_main;
101  CInterface* m_interface;
102  CSoundInterface* m_sound;
103 
104  COldObject* m_object;
105  CTaskExecutorObject* m_taskExecutor;
106  CProgrammableObject* m_programmable;
107  CProgramStorageObject* m_programStorage;
108  CPhysics* m_physics;
109  CMotion* m_motion;
110 
111  std::unique_ptr<CStudio> m_studio;
112 
113  int m_selScript; // rank of the selected script
114 
115  EventType m_manipStyle;
116  EventType m_defaultEnter;
117 
118  float m_time;
119  float m_lastUpdateTime;
120  float m_lastAlarmTime;
121  int m_soundChannelAlarm;
122  int m_flagColor;
123 };
124 
125 } // namespace Ui
Definition: robotmain.h:108
Interface for objects that can execute tasks.
Definition: task_executor_object.h:36
Definition: old_object.h:79
Definition: physics.h:97
Interface for programmable objects.
Definition: programmable_object.h:36
Definition: object_interface.h:50
Definition: robotmain.h:159
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:128
Terrain loader/generator and manager.
Definition: terrain.h:147
Namespace for (new) graphics code.
Definition: app.h:49
Definition: motion.h:47
void StartEditScript(Program *program, std::string name)
Start the program editor.
Definition: object_interface.cpp:731
The graphics engine.
Definition: engine.h:585
Event types, structs and event queue.
Water manager/renderer.
Definition: water.h:72
void StopEditScript(bool closeWithErrors)
Close the program editor.
Definition: object_interface.cpp:741
EventType
Type of event message.
Definition: event.h:41
Event sent by system, interface or game.
Definition: event.h:735
Definition: window.h:51
Definition: interface.h:59
Sound plugin interface.
Definition: sound.h:60
Definition: program_storage_object.h:31