Skyscraper 2.0
skyscraper.h
Go to the documentation of this file.
1/*
2 Skyscraper 2.0 Alpha - Simulation Frontend
3 Copyright (C)2004-2024 Ryan Thoryk
4 https://www.skyscrapersim.net
5 https://sourceforge.net/projects/skyscraper/
6 Contact - ryan@skyscrapersim.net
7
8 This program is free software; you can redistribute it and/or
9 modify it under the terms of the GNU General Public License
10 as published by the Free Software Foundation; either version 2
11 of the License, or (at your option) any later version.
12
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
17
18 You should have received a copy of the GNU General Public License
19 along with this program; if not, write to the Free Software
20 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
21*/
22
23#ifndef SKYSCRAPER_H
24#define SKYSCRAPER_H
25
26#ifndef USING_WX
27#include <filesystem>
28#include "Ogre.h"
29#include "OgreApplicationContext.h"
30#include "OgreInput.h"
31#include "OgreRTShaderSystem.h"
32#include "OgreCameraMan.h"
33#endif
34
35namespace FMOD {
36 class System;
37 class Sound;
38 class Channel;
39}
40
41namespace Caelum {
42 class CaelumSystem;
43}
44
45namespace SBS {
46 class SBS;
47}
48
49#if OGRE_PLATFORM == OGRE_PLATFORM_APPLE
50 std::string settingsPath();
51#endif
52
53namespace Skyscraper {
54
55class DebugPanel;
56class MainScreen;
57class EngineContext;
58class Console;
59class LoadDialog;
60class ScriptProcessor;
61class VM;
62class HAL;
63class GUI;
64class StartScreen;
65
66#ifdef USING_WX
67class Skyscraper : public wxApp
68#else
69class Skyscraper : public OgreBites::ApplicationContext, public OgreBites::InputListener
70#endif
71{
72 friend class MainScreen;
73 friend class VM;
74 friend class HAL;
75
76public:
77
82 bool Verbose;
83 bool ShowMenu; //show main menu
85
86 bool Loop();
87 virtual bool OnInit();
88 virtual int OnExit();
89
90#ifdef USING_WX
91 Skyscraper() {};
92#else
93 Skyscraper();
94#endif
95 virtual ~Skyscraper() {};
96 void setup();
97
98 Ogre::RenderWindow* CreateRenderWindow(const Ogre::NameValuePairList* miscParams = 0, const std::string& windowName = "");
99 void destroyRenderWindow();
100 const std::string getOgreHandle() const;
101 void ShowError(const std::string &message);
102 void ShowMessage(const std::string &message);
103 void StartSound();
104 std::string SelectBuilding();
105 bool Load(const std::string &filename, EngineContext *parent = 0, const Vector3 &position = Vector3::ZERO, Real rotation = 0.0, const Vector3 &area_min = Vector3::ZERO, const Vector3 &area_max = Vector3::ZERO);
106 bool Start(EngineContext *engine);
107 void AllowResize(bool value);
108 void UnloadToMenu();
109 void Quit();
110 std::string GetKeyConfigString(const std::string &key, const std::string &default_value);
111 int GetJoystickConfigInt(const std::string &key, int default_value);
112 void SetFullScreen(bool enabled);
113 void RaiseWindow();
115 bool SetCWD();
116#ifdef USING_WX
117 virtual void MacOpenFile(const wxString &filename);
118#else
119 std::filesystem::path GetExeDirectory();
120 bool keyPressed(const OgreBites::KeyboardEvent& evt);
121 bool keyReleased(const OgreBites::KeyboardEvent& evt);
122 bool mouseMoved(const OgreBites::MouseMotionEvent &evt);
123 bool mousePressed(const OgreBites::MouseButtonEvent &evt);
124 bool mouseReleased(const OgreBites::MouseButtonEvent &evt);
125 bool mouseWheelRolled(const OgreBites::MouseWheelEvent &evt);
126 bool touchMoved(const OgreBites::TouchFingerEvent &evt);
127 bool touchPressed(const OgreBites::TouchFingerEvent &evt);
128 bool touchReleased(const OgreBites::TouchFingerEvent &evt);
129 bool alt_down, ctrl_down, shift_down;
130#endif
131 std::string GetDataPath();
132 MainScreen* GetWindow();
133 VM* GetVM();
134#ifdef USING_WX
135 GUI* GetGUI();
136#endif
137 void StopMenu();
138
139 //main window
140 MainScreen *window;
141
142protected:
143 //input system states
144 bool colliders, boxes;
145 bool strafe_left, strafe_right;
146 bool float_up, float_down;
147 bool spin_up, spin_down;
148 bool turn_left, turn_right;
149 bool look_up, look_down;
150 bool step_forward, step_backward;
152
153private:
154 //loop states
156
157 void UnloadSim();
158 void Report(const std::string &message);
159 bool ReportError(const std::string &message);
160#ifndef USING_WX
161 void GetKeyStates(EngineContext *engine, OgreBites::Keycode &key, bool down);
162 void ProcessMovement(EngineContext *engine, bool control = false, bool shift = false, bool angle_only = false);
163 void HandleMouseMovement();
164 void EnableFreelook(bool value);
165#else
166 wxCmdLineParser *parser;
167#endif
168 Ogre::RenderWindow *mRenderWindow;
169
170 //VM instance
172
173 //GUI instance
174#ifdef USING_WX
175 GUI *gui;
176#endif
177
178 //Start Screen instance
180};
181
182#ifdef USING_WX
183DECLARE_APP(Skyscraper)
184#endif
185}
186
187#endif
Ogre::RenderWindow * mRenderWindow
Definition skyscraper.h:168
Ogre::RenderWindow * CreateRenderWindow(const Ogre::NameValuePairList *miscParams=0, const std::string &windowName="")
const std::string getOgreHandle() const
StartScreen * startscreen
Definition skyscraper.h:179
int GetJoystickConfigInt(const std::string &key, int default_value)
void AllowResize(bool value)
std::string GetKeyConfigString(const std::string &key, const std::string &default_value)
void ShowMessage(const std::string &message)
void ShowError(const std::string &message)
Ogre::Vector3 Vector3
Definition globals.h:58
Ogre::Real Real
Definition globals.h:57
std::string settingsPath()