summaryrefslogtreecommitdiffstats
path: root/src/app/app.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/app/app.h')
-rw-r--r--src/app/app.h111
1 files changed, 74 insertions, 37 deletions
diff --git a/src/app/app.h b/src/app/app.h
index dcc90e0..269fa9b 100644
--- a/src/app/app.h
+++ b/src/app/app.h
@@ -31,6 +31,8 @@
#include "graphics/engine/engine.h"
#include "graphics/opengl/gldevice.h"
+#include "object/objman.h"
+
#include <string>
#include <vector>
@@ -141,6 +143,15 @@ enum PerformanceCounter
PCNT_MAX
};
+enum DebugMode
+{
+ DEBUG_SYS_EVENTS = 1 << 0,
+ DEBUG_APP_EVENTS = 1 << 1,
+ DEBUG_EVENTS = DEBUG_SYS_EVENTS | DEBUG_APP_EVENTS,
+ DEBUG_MODELS = 1 << 2,
+ DEBUG_ALL = DEBUG_SYS_EVENTS | DEBUG_APP_EVENTS | DEBUG_MODELS
+};
+
struct ApplicationPrivate;
/**
@@ -207,20 +218,20 @@ public:
//! Main event loop
int Run();
//! Returns the code to be returned at main() exit
- int GetExitCode();
+ int GetExitCode() const;
//! Returns the message of error (set to something if exit code is not 0)
- const std::string& GetErrorMessage();
+ const std::string& GetErrorMessage() const;
//! Cleans up before exit
void Destroy();
//! Returns a list of possible video modes
VideoQueryResult GetVideoResolutionList(std::vector<Math::IntPoint> &resolutions,
- bool fullScreen, bool resizeable);
+ bool fullScreen, bool resizeable) const;
//! Returns the current video mode
- Gfx::GLDeviceConfig GetVideoConfig();
+ Gfx::GLDeviceConfig GetVideoConfig() const;
//! Change the video mode to given mode
bool ChangeVideoConfig(const Gfx::GLDeviceConfig &newConfig);
@@ -230,35 +241,38 @@ public:
//! Resumes animation
void ResumeSimulation();
//! Returns whether simulation is suspended
- bool GetSimulationSuspended();
+ bool GetSimulationSuspended() const;
+
+ //! Resets time counters to account for time spent loading game
+ void ResetTimeAfterLoading();
//@{
//! Management of simulation speed
void SetSimulationSpeed(float speed);
- float GetSimulationSpeed();
+ float GetSimulationSpeed() const;
//@}
//! Returns the absolute time counter [seconds]
- float GetAbsTime();
+ float GetAbsTime() const;
//! Returns the exact absolute time counter [nanoseconds]
- long long GetExactAbsTime();
+ long long GetExactAbsTime() const;
//! Returns the exact absolute time counter disregarding speed setting [nanoseconds]
- long long GetRealAbsTime();
+ long long GetRealAbsTime() const;
//! Returns the relative time since last update [seconds]
- float GetRelTime();
+ float GetRelTime() const;
//! Returns the exact realative time since last update [nanoseconds]
- long long GetExactRelTime();
+ long long GetExactRelTime() const;
//! Returns the exact relative time since last update disregarding speed setting [nanoseconds]
- long long GetRealRelTime();
+ long long GetRealRelTime() const;
//! Returns a list of available joystick devices
- std::vector<JoystickDevice> GetJoystickList();
+ std::vector<JoystickDevice> GetJoystickList() const;
//! Returns info about the current joystick
- JoystickDevice GetJoystick();
+ JoystickDevice GetJoystick() const;
//! Change the current joystick device
bool ChangeJoystick(const JoystickDevice &newJoystick);
@@ -266,7 +280,7 @@ public:
//! Management of joystick enable state
//@{
void SetJoystickEnabled(bool enable);
- bool GetJoystickEnabled();
+ bool GetJoystickEnabled() const;
//@}
//! Polls the state of joystick axes and buttons
@@ -276,15 +290,15 @@ public:
void UpdateMouse();
//! Returns the current key modifiers
- int GetKmods();
+ int GetKmods() const;
//! Returns whether the given kmod is active
- bool GetKmodState(int kmod);
+ bool GetKmodState(int kmod) const;
//! Returns whether the tracked key is pressed
- bool GetTrackedKeyState(TrackedKey key);
+ bool GetTrackedKeyState(TrackedKey key) const;
//! Returns whether the mouse button is pressed
- bool GetMouseButtonState(int index);
+ bool GetMouseButtonState(int index) const;
//! Resets tracked key states and modifiers
void ResetKeyStates();
@@ -292,40 +306,44 @@ public:
//! Management of the grab mode for input (keyboard & mouse)
//@{
void SetGrabInput(bool grab);
- bool GetGrabInput();
+ bool GetGrabInput() const;
//@}
//! Management of mouse mode
//@{
void SetMouseMode(MouseMode mode);
- MouseMode GetMouseMode();
+ MouseMode GetMouseMode() const;
//@}
//! Returns the position of mouse cursor (in interface coords)
- Math::Point GetMousePos();
+ Math::Point GetMousePos() const;
//! Moves (warps) the mouse cursor to the specified position (in interface coords)
void MoveMouse(Math::Point pos);
- //! Management of debug mode (prints more info in logger)
+ //! Management of debug modes (printing more info in logger)
//@{
- void SetDebugMode(bool mode);
- bool GetDebugMode();
+ void SetDebugModeActive(DebugMode mode, bool active);
+ bool IsDebugModeActive(DebugMode mode) const;
+ static bool ParseDebugModes(const std::string& str, int& debugModes);
//@}
//! Returns the full path to data directory
- std::string GetDataDirPath();
+ std::string GetDataDirPath() const;
//! Returns the full path to a standard dir in data directory
- std::string GetDataSubdirPath(DataDir stdDir);
+ std::string GetDataSubdirPath(DataDir stdDir) const;
//! Returns the full path to a file in data directory given standard dir and subpath
- std::string GetDataFilePath(DataDir stdDir, const std::string &subpath);
+ std::string GetDataFilePath(DataDir stdDir, const std::string &subpath) const;
+
+ //! Returns the full path to a file in texture pack directory
+ std::string GetTexPackFilePath(const std::string& textureName) const;
//! Management of language
//@{
- Language GetLanguage();
- char GetLanguageChar();
+ Language GetLanguage() const;
+ char GetLanguageChar() const;
void SetLanguage(Language language);
static bool ParseLanguage(const std::string& str, Language& language);
//@}
@@ -333,16 +351,18 @@ public:
//! Management of sleep in main loop (lowers CPU usage)
//@{
void SetLowCPU(bool low);
- bool GetLowCPU();
+ bool GetLowCPU() const;
//@}
//! Management of performance counters
//@{
void StartPerformanceCounter(PerformanceCounter counter);
void StopPerformanceCounter(PerformanceCounter counter);
- float GetPerformanceCounterData(PerformanceCounter counter);
+ float GetPerformanceCounterData(PerformanceCounter counter) const;
//@}
+ bool GetProtoMode() const;
+
protected:
//! Creates the window's SDL_Surface
bool CreateVideoSurface();
@@ -353,8 +373,8 @@ protected:
Event CreateVirtualEvent(const Event& sourceEvent);
//! Prepares a simulation update event
TEST_VIRTUAL Event CreateUpdateEvent();
- //! Handles some incoming events
- bool ProcessEvent(const Event& event);
+ //! Logs debug data for event
+ void LogEvent(const Event& event);
//! Renders the image in window
void Render();
@@ -363,6 +383,9 @@ protected:
//! Closes the joystick device
void CloseJoystick();
+ //! Internal procedure to reset time counters
+ void InternalResumeSimulation();
+
//! Resets all performance counters to zero
void ResetPerformanceCounters();
//! Updates performance counters from gathered timer data
@@ -374,6 +397,8 @@ protected:
//! Instance manager
// TODO: to be removed
CInstanceManager* m_iMan;
+ //! Object manager
+ CObjectManager* m_objMan;
//! Global event queue
CEventQueue* m_eventQueue;
//! Graphics engine
@@ -393,8 +418,8 @@ protected:
int m_exitCode;
//! Whether application window is active
bool m_active;
- //! Whether debug mode is enabled
- bool m_debugMode;
+ //! Bit array of active debug modes
+ long m_debugModes;
//! Message to be displayed as error to the user
std::string m_errorMessage;
@@ -458,12 +483,24 @@ protected:
//! Path to directory with language files
std::string m_langPath;
- const char* m_dataDirs[DIR_MAX];
+ //! Path to directory with user texture pack
+ std::string m_texPackPath;
+
+ //@{
+ //! Scene to run on startup
+ std::string m_runSceneName;
+ int m_runSceneRank;
+ //@}
+
+ const char* m_standardDataDirs[DIR_MAX];
//! Application language
Language m_language;
//! Low cpu mode
bool m_lowCPU;
+
+ //! Show prototype levels
+ bool m_protoMode;
};