Colobot
auto.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/error.h"
23 #include "common/event.h"
24 
25 #include "object/object_type.h"
26 
27 
28 class CRobotMain;
29 class CSoundInterface;
30 class CLevelParserLine;
31 class COldObject;
32 
33 namespace Ui
34 {
35 class CInterface;
36 class CWindow;
37 } // namespace Ui
38 
39 namespace Gfx
40 {
41 
42 class CEngine;
43 class CParticle;
44 class CTerrain;
45 class CWater;
46 class CCloud;
47 class CCamera;
48 class CPlanet;
49 class CLightning;
50 } // namespace Gfx
51 
52 
53 class CAuto
54 {
55 public:
56  CAuto(COldObject* object);
57  virtual ~CAuto();
58 
59  virtual void DeleteObject(bool bAll=false);
60 
61  virtual void Init();
62  virtual void Start(int param);
63  virtual bool EventProcess(const Event &event);
64  virtual Error IsEnded();
65  virtual bool Abort();
66 
67  virtual Error StartAction(int param);
68 
69  virtual bool SetType(ObjectType type);
70  virtual bool SetValue(int rank, float value);
71  virtual bool SetString(char *string);
72 
73  virtual bool CreateInterface(bool bSelect);
74  virtual Error GetError();
75 
76  virtual bool GetBusy();
77  virtual void SetBusy(bool busy);
78  virtual void InitProgressTotal(float total);
79  virtual void EventProgress(float rTime);
80 
81  virtual bool GetMotor();
82  virtual void SetMotor(bool bMotor);
83 
84  virtual bool Write(CLevelParserLine* line);
85  virtual bool Read(CLevelParserLine* line);
86 
87 protected:
88  void CheckInterface(Ui::CWindow *pw, EventType event, bool bState);
89  void EnableInterface(Ui::CWindow *pw, EventType event, bool bState);
90  void VisibleInterface(Ui::CWindow *pw, EventType event, bool bState);
91  void DeadInterface(Ui::CWindow *pw, EventType event, bool bState);
92  void UpdateInterface();
93  void UpdateInterface(float rTime);
94 
95 protected:
96  CEventQueue* m_eventQueue = nullptr;
97  Gfx::CEngine* m_engine = nullptr;
98  Gfx::CParticle* m_particle = nullptr;
99  Gfx::CTerrain* m_terrain = nullptr;
100  Gfx::CWater* m_water = nullptr;
101  Gfx::CCloud* m_cloud = nullptr;
102  Gfx::CPlanet* m_planet = nullptr;
103  Gfx::CLightning* m_lightning = nullptr;
104  Gfx::CCamera* m_camera = nullptr;
105  Ui::CInterface* m_interface = nullptr;
106  CRobotMain* m_main = nullptr;
107  COldObject* m_object = nullptr;
108  CSoundInterface* m_sound = nullptr;
109 
110  ObjectType m_type = OBJECT_NULL;
111  bool m_bBusy = false;
112  bool m_bMotor = false;
113  float m_time = 0.0f;
114  float m_lastUpdateTime = 0.0f;
115  float m_progressTime = 0.0f;
116  float m_progressTotal = 0.0f;
117 };
Definition: robotmain.h:108
Definition: old_object.h:79
Definition: auto.h:53
Global event queue.
Definition: event.h:866
ObjectType enum.
Definition: parserline.h:37
Definition: robotmain.h:159
Cloud layer renderer.
Definition: cloud.h:54
Lightning effect renderer.
Definition: lightning.h:55
Particle engine.
Definition: particle.h:223
Planet manager.
Definition: planet.h:49
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
The graphics engine.
Definition: engine.h:585
Event types, structs and event queue.
ObjectType
Type of game object.
Definition: object_type.h:33
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