Colobot
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 
67  void StartEditScript(Program* program, std::string name);
68  void StopEditScript(bool bCancel);
69 
70  void GroundFlat();
71  void ColorFlag(int color);
72 
73  void UpdateScript(CWindow *pw);
74  int GetSelScript();
75  void SetSelScript(int index);
76  void BlinkScript(bool bEnable);
77 
78  void CheckInterface(CWindow *pw, EventType event, bool bState);
79  void EnableInterface(CWindow *pw, EventType event, bool bState);
80  void DeadInterface(CWindow *pw, EventType event, bool bState);
81  void DefaultEnter(CWindow *pw, EventType event, bool bState=true);
82 
83 protected:
84  Gfx::CEngine* m_engine;
85  Gfx::CTerrain* m_terrain;
86  Gfx::CWater* m_water;
87  Gfx::CCamera* m_camera;
88  Gfx::CParticle* m_particle;
89  CRobotMain* m_main;
90  CInterface* m_interface;
91  CSoundInterface* m_sound;
92 
93  COldObject* m_object;
94  CTaskExecutorObject* m_taskExecutor;
95  CProgrammableObject* m_programmable;
96  CProgramStorageObject* m_programStorage;
97  CPhysics* m_physics;
98  CMotion* m_motion;
99 
100  std::unique_ptr<CStudio> m_studio;
101 
102  int m_selScript; // rank of the selected script
103 
104  EventType m_manipStyle;
105  EventType m_defaultEnter;
106 
107  float m_time;
108  float m_lastUpdateTime;
109  float m_lastAlarmTime;
110  int m_soundChannelAlarm;
111  int m_flagColor;
112 };
113 
114 } // 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
The graphics engine.
Definition: engine.h:585
Event types, structs and event queue.
Water manager/renderer.
Definition: water.h:72
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