2014-10-14 13:11:37 +00:00
|
|
|
|
/*
|
|
|
|
|
* This file is part of the Colobot: Gold Edition source code
|
|
|
|
|
* Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam
|
|
|
|
|
* http://epsiteс.ch; http://colobot.info; http://github.com/colobot
|
|
|
|
|
*
|
|
|
|
|
* This program is free software: you can redistribute it and/or modify
|
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
|
|
|
* (at your option) any later version.
|
|
|
|
|
*
|
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
|
|
|
* See the GNU General Public License for more details.
|
|
|
|
|
*
|
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
|
* along with this program. If not, see http://gnu.org/licenses
|
|
|
|
|
*/
|
2012-06-22 14:31:55 +00:00
|
|
|
|
|
2012-08-11 16:39:16 +00:00
|
|
|
|
/**
|
|
|
|
|
* \file app/app.h
|
|
|
|
|
* \brief CApplication class
|
|
|
|
|
*/
|
2012-06-22 14:31:55 +00:00
|
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
2012-09-20 18:37:37 +00:00
|
|
|
|
|
2012-09-09 15:51:10 +00:00
|
|
|
|
#include "common/global.h"
|
2012-07-22 20:05:12 +00:00
|
|
|
|
#include "common/singleton.h"
|
2012-12-20 20:57:57 +00:00
|
|
|
|
#include "common/profile.h"
|
2012-09-20 18:37:37 +00:00
|
|
|
|
|
2012-07-26 20:26:19 +00:00
|
|
|
|
#include "graphics/core/device.h"
|
|
|
|
|
#include "graphics/engine/engine.h"
|
2012-07-29 13:09:53 +00:00
|
|
|
|
#include "graphics/opengl/gldevice.h"
|
2012-06-24 13:41:56 +00:00
|
|
|
|
|
2012-09-20 18:37:37 +00:00
|
|
|
|
|
2012-06-25 17:59:17 +00:00
|
|
|
|
#include <string>
|
2012-06-30 10:26:40 +00:00
|
|
|
|
#include <vector>
|
2012-06-25 17:59:17 +00:00
|
|
|
|
|
2012-06-24 13:41:56 +00:00
|
|
|
|
|
|
|
|
|
class CInstanceManager;
|
2012-10-06 22:46:46 +00:00
|
|
|
|
class CEventQueue;
|
2014-12-22 09:35:05 +00:00
|
|
|
|
class CController;
|
2012-09-15 20:19:32 +00:00
|
|
|
|
class CSoundInterface;
|
2014-12-11 18:01:57 +00:00
|
|
|
|
class CInput;
|
2014-12-21 16:06:55 +00:00
|
|
|
|
class CObjectManager;
|
2015-03-08 14:22:21 +00:00
|
|
|
|
class CPathManager;
|
2012-06-24 13:41:56 +00:00
|
|
|
|
|
2012-12-26 19:58:02 +00:00
|
|
|
|
namespace Gfx {
|
|
|
|
|
class CModelManager;
|
|
|
|
|
}
|
|
|
|
|
|
2012-07-29 13:09:53 +00:00
|
|
|
|
/**
|
2012-09-12 21:43:04 +00:00
|
|
|
|
* \struct JoystickDevice
|
|
|
|
|
* \brief Information about a joystick device
|
|
|
|
|
*/
|
2012-07-29 13:09:53 +00:00
|
|
|
|
struct JoystickDevice
|
|
|
|
|
{
|
|
|
|
|
//! Device index (-1 = invalid device)
|
|
|
|
|
int index;
|
|
|
|
|
//! Device name
|
|
|
|
|
std::string name;
|
|
|
|
|
//! Number of axes (only available after joystick opened)
|
|
|
|
|
int axisCount;
|
|
|
|
|
//! Number of buttons (only available after joystick opened)
|
|
|
|
|
int buttonCount;
|
|
|
|
|
|
|
|
|
|
JoystickDevice()
|
|
|
|
|
: index(-1), axisCount(0), buttonCount(0) {}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/**
|
2012-09-12 21:43:04 +00:00
|
|
|
|
* \enum VideoQueryResult
|
|
|
|
|
* \brief Result of querying for available video resolutions
|
|
|
|
|
*/
|
2012-07-29 13:09:53 +00:00
|
|
|
|
enum VideoQueryResult
|
|
|
|
|
{
|
|
|
|
|
VIDEO_QUERY_ERROR,
|
|
|
|
|
VIDEO_QUERY_NONE,
|
|
|
|
|
VIDEO_QUERY_ALL,
|
|
|
|
|
VIDEO_QUERY_OK
|
|
|
|
|
};
|
|
|
|
|
|
2012-09-17 21:41:53 +00:00
|
|
|
|
/**
|
|
|
|
|
* \enum ParseArgsStatus
|
|
|
|
|
* \brief State of parsing commandline arguments
|
|
|
|
|
*/
|
|
|
|
|
enum ParseArgsStatus
|
|
|
|
|
{
|
|
|
|
|
PARSE_ARGS_OK = 1, //! < all ok
|
|
|
|
|
PARSE_ARGS_FAIL = 2, //! < invalid syntax
|
|
|
|
|
PARSE_ARGS_HELP = 3 //! < -help requested
|
|
|
|
|
};
|
|
|
|
|
|
2012-09-20 18:37:37 +00:00
|
|
|
|
/**
|
|
|
|
|
* \enum MouseMode
|
|
|
|
|
* \brief Mode of mouse cursor
|
|
|
|
|
*/
|
|
|
|
|
enum MouseMode
|
|
|
|
|
{
|
|
|
|
|
MOUSE_SYSTEM, //! < system cursor visible; in-game cursor hidden
|
|
|
|
|
MOUSE_ENGINE, //! < in-game cursor visible; system cursor hidden
|
|
|
|
|
MOUSE_BOTH, //! < both cursors visible (only for debug)
|
|
|
|
|
MOUSE_NONE, //! < no cursor visible
|
|
|
|
|
};
|
|
|
|
|
|
2012-10-25 21:29:49 +00:00
|
|
|
|
/**
|
|
|
|
|
* \enum PerformanceCounter
|
|
|
|
|
* \brief Type of counter testing performance
|
|
|
|
|
*/
|
|
|
|
|
enum PerformanceCounter
|
|
|
|
|
{
|
|
|
|
|
PCNT_EVENT_PROCESSING, //! < event processing (except update events)
|
|
|
|
|
|
|
|
|
|
PCNT_UPDATE_ALL, //! < the whole frame update process
|
|
|
|
|
PCNT_UPDATE_ENGINE, //! < frame update in CEngine
|
|
|
|
|
PCNT_UPDATE_PARTICLE, //! < frame update in CParticle
|
|
|
|
|
PCNT_UPDATE_GAME, //! < frame update in CRobotMain
|
|
|
|
|
|
|
|
|
|
PCNT_RENDER_ALL, //! < the whole rendering process
|
|
|
|
|
PCNT_RENDER_PARTICLE, //! < rendering the particles in 3D
|
|
|
|
|
PCNT_RENDER_WATER, //! < rendering the water
|
|
|
|
|
PCNT_RENDER_TERRAIN, //! < rendering the terrain
|
|
|
|
|
PCNT_RENDER_OBJECTS, //! < rendering the 3D objects
|
|
|
|
|
PCNT_RENDER_INTERFACE, //! < rendering 2D interface
|
2015-05-11 13:21:17 +00:00
|
|
|
|
PCNT_RENDER_SHADOW_MAP, //! < rendering shadow map
|
2012-10-25 21:29:49 +00:00
|
|
|
|
|
|
|
|
|
PCNT_ALL, //! < all counters together
|
|
|
|
|
|
|
|
|
|
PCNT_MAX
|
|
|
|
|
};
|
|
|
|
|
|
2013-06-16 19:39:21 +00:00
|
|
|
|
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
|
|
|
|
|
};
|
|
|
|
|
|
2012-07-22 20:05:12 +00:00
|
|
|
|
struct ApplicationPrivate;
|
2012-06-24 13:41:56 +00:00
|
|
|
|
|
2012-06-25 17:59:17 +00:00
|
|
|
|
/**
|
2012-06-26 20:50:55 +00:00
|
|
|
|
* \class CApplication
|
|
|
|
|
* \brief Main application
|
2012-06-25 17:59:17 +00:00
|
|
|
|
*
|
2012-06-30 10:26:40 +00:00
|
|
|
|
* This class is responsible for main application execution, including creating
|
|
|
|
|
* and handling main application window, receiving events, etc.
|
|
|
|
|
*
|
|
|
|
|
* It is a singleton class with only one instance that can be created.
|
|
|
|
|
*
|
2012-07-29 13:09:53 +00:00
|
|
|
|
* \section Creation Creation of other main objects
|
2012-06-30 10:26:40 +00:00
|
|
|
|
*
|
|
|
|
|
* The class creates the only instance of CInstanceManager, CEventQueue, CEngine,
|
2012-09-19 19:23:42 +00:00
|
|
|
|
* CRobotMain and CSoundInterface classes.
|
2012-06-30 10:26:40 +00:00
|
|
|
|
*
|
2012-07-29 13:09:53 +00:00
|
|
|
|
* \section Window Window management
|
2012-06-30 10:26:40 +00:00
|
|
|
|
*
|
|
|
|
|
* The class is responsible for creating app window, setting and changing the video mode,
|
2012-07-29 13:09:53 +00:00
|
|
|
|
* joystick management, grabbing input and changing the system mouse cursor
|
|
|
|
|
* position and visibility.
|
|
|
|
|
* ("System mouse cursor" means the cursor displayed by the OS in constrast to the cursor
|
|
|
|
|
* displayed by CEngine).
|
|
|
|
|
*
|
|
|
|
|
* \section Events Events
|
2012-06-30 10:26:40 +00:00
|
|
|
|
*
|
2012-07-29 13:09:53 +00:00
|
|
|
|
* Events are taken from SDL event queue, translated to common events from src/common.h
|
|
|
|
|
* and pushed to global event queue CEventQueue.
|
2012-06-30 10:26:40 +00:00
|
|
|
|
*
|
|
|
|
|
* Joystick events are generated somewhat differently, by running a separate timer,
|
|
|
|
|
* polling the device for changes and synthesising events on change. It avoids flooding
|
|
|
|
|
* the event queue with too many joystick events and the granularity of the timer can be
|
|
|
|
|
* adjusted.
|
|
|
|
|
*
|
2012-07-29 13:09:53 +00:00
|
|
|
|
* The events are passed to ProcessEvent() of classes in this order: CApplication, CEngine
|
|
|
|
|
* and CRobotMain. CApplication and CEngine's ProcessEvent() functions return bool, which
|
|
|
|
|
* means whether to pass the event on, or stop the chain. This is to enable handling some
|
|
|
|
|
* events which are internal to CApplication or CEngine.
|
|
|
|
|
*
|
|
|
|
|
* \section Portability Portability
|
|
|
|
|
*
|
|
|
|
|
* Currently, the class only handles OpenGL devices. SDL can be used with DirectX, but
|
|
|
|
|
* for that to work, video initialization and video setting must be done differently.
|
2012-06-25 17:59:17 +00:00
|
|
|
|
*
|
|
|
|
|
*/
|
2012-07-22 20:05:12 +00:00
|
|
|
|
class CApplication : public CSingleton<CApplication>
|
2012-06-22 14:31:55 +00:00
|
|
|
|
{
|
2012-06-24 13:41:56 +00:00
|
|
|
|
public:
|
2012-06-26 20:23:05 +00:00
|
|
|
|
//! Constructor (can only be called once!)
|
|
|
|
|
CApplication();
|
|
|
|
|
//! Destructor
|
|
|
|
|
~CApplication();
|
2012-06-24 13:41:56 +00:00
|
|
|
|
|
2013-02-16 21:37:43 +00:00
|
|
|
|
//! Returns the application's event queue
|
|
|
|
|
CEventQueue* GetEventQueue();
|
|
|
|
|
//! Returns the sound subsystem
|
|
|
|
|
CSoundInterface* GetSound();
|
|
|
|
|
|
2012-06-25 17:59:17 +00:00
|
|
|
|
public:
|
2012-06-26 20:23:05 +00:00
|
|
|
|
//! Parses commandline arguments
|
2012-09-17 21:41:53 +00:00
|
|
|
|
ParseArgsStatus ParseArguments(int argc, char *argv[]);
|
2012-06-26 20:23:05 +00:00
|
|
|
|
//! Initializes the application
|
|
|
|
|
bool Create();
|
|
|
|
|
//! Main event loop
|
|
|
|
|
int Run();
|
2012-07-04 17:56:22 +00:00
|
|
|
|
//! Returns the code to be returned at main() exit
|
2013-05-26 12:50:23 +00:00
|
|
|
|
int GetExitCode() const;
|
2012-07-04 17:56:22 +00:00
|
|
|
|
|
2012-08-13 21:09:30 +00:00
|
|
|
|
//! Returns the message of error (set to something if exit code is not 0)
|
2013-05-26 12:50:23 +00:00
|
|
|
|
const std::string& GetErrorMessage() const;
|
2012-08-13 21:09:30 +00:00
|
|
|
|
|
2012-07-04 17:56:22 +00:00
|
|
|
|
//! Cleans up before exit
|
|
|
|
|
void Destroy();
|
2014-10-25 16:34:29 +00:00
|
|
|
|
|
|
|
|
|
//! Restart
|
|
|
|
|
void Restart();
|
|
|
|
|
//! Should we restart after app quits?
|
|
|
|
|
bool IsRestarting();
|
2012-06-25 17:59:17 +00:00
|
|
|
|
|
2012-07-29 13:09:53 +00:00
|
|
|
|
//! Returns a list of possible video modes
|
2012-08-11 15:17:04 +00:00
|
|
|
|
VideoQueryResult GetVideoResolutionList(std::vector<Math::IntPoint> &resolutions,
|
2013-05-26 12:50:23 +00:00
|
|
|
|
bool fullScreen, bool resizeable) const;
|
2012-07-29 13:09:53 +00:00
|
|
|
|
|
|
|
|
|
//! Returns the current video mode
|
2013-05-26 12:50:23 +00:00
|
|
|
|
Gfx::GLDeviceConfig GetVideoConfig() const;
|
2012-07-29 13:09:53 +00:00
|
|
|
|
|
|
|
|
|
//! Change the video mode to given mode
|
|
|
|
|
bool ChangeVideoConfig(const Gfx::GLDeviceConfig &newConfig);
|
2012-06-25 17:59:17 +00:00
|
|
|
|
|
2012-09-12 21:43:04 +00:00
|
|
|
|
//! Suspends animation (time will not be updated)
|
|
|
|
|
void SuspendSimulation();
|
|
|
|
|
//! Resumes animation
|
|
|
|
|
void ResumeSimulation();
|
|
|
|
|
//! Returns whether simulation is suspended
|
2013-05-26 12:50:23 +00:00
|
|
|
|
bool GetSimulationSuspended() const;
|
2012-09-12 21:43:04 +00:00
|
|
|
|
|
2013-06-13 15:25:58 +00:00
|
|
|
|
//! Resets time counters to account for time spent loading game
|
|
|
|
|
void ResetTimeAfterLoading();
|
|
|
|
|
|
2012-09-12 21:43:04 +00:00
|
|
|
|
//@{
|
|
|
|
|
//! Management of simulation speed
|
|
|
|
|
void SetSimulationSpeed(float speed);
|
2013-05-26 12:50:23 +00:00
|
|
|
|
float GetSimulationSpeed() const;
|
2012-09-12 21:43:04 +00:00
|
|
|
|
//@}
|
|
|
|
|
|
|
|
|
|
//! Returns the absolute time counter [seconds]
|
2013-05-26 12:50:23 +00:00
|
|
|
|
float GetAbsTime() const;
|
2012-09-12 21:43:04 +00:00
|
|
|
|
//! Returns the exact absolute time counter [nanoseconds]
|
2013-05-26 12:50:23 +00:00
|
|
|
|
long long GetExactAbsTime() const;
|
2012-09-12 21:43:04 +00:00
|
|
|
|
|
|
|
|
|
//! Returns the exact absolute time counter disregarding speed setting [nanoseconds]
|
2013-05-26 12:50:23 +00:00
|
|
|
|
long long GetRealAbsTime() const;
|
2012-09-12 21:43:04 +00:00
|
|
|
|
|
|
|
|
|
//! Returns the relative time since last update [seconds]
|
2013-05-26 12:50:23 +00:00
|
|
|
|
float GetRelTime() const;
|
2012-09-12 21:43:04 +00:00
|
|
|
|
//! Returns the exact realative time since last update [nanoseconds]
|
2013-05-26 12:50:23 +00:00
|
|
|
|
long long GetExactRelTime() const;
|
2012-09-12 21:43:04 +00:00
|
|
|
|
|
|
|
|
|
//! Returns the exact relative time since last update disregarding speed setting [nanoseconds]
|
2013-05-26 12:50:23 +00:00
|
|
|
|
long long GetRealRelTime() const;
|
2012-06-24 13:41:56 +00:00
|
|
|
|
|
2012-07-29 13:09:53 +00:00
|
|
|
|
//! Returns a list of available joystick devices
|
2013-05-26 12:50:23 +00:00
|
|
|
|
std::vector<JoystickDevice> GetJoystickList() const;
|
2012-06-29 22:12:04 +00:00
|
|
|
|
|
2012-07-29 13:09:53 +00:00
|
|
|
|
//! Returns info about the current joystick
|
2013-05-26 12:50:23 +00:00
|
|
|
|
JoystickDevice GetJoystick() const;
|
2012-06-29 22:12:04 +00:00
|
|
|
|
|
2012-07-29 13:09:53 +00:00
|
|
|
|
//! Change the current joystick device
|
|
|
|
|
bool ChangeJoystick(const JoystickDevice &newJoystick);
|
2012-06-24 13:41:56 +00:00
|
|
|
|
|
2012-09-12 21:43:04 +00:00
|
|
|
|
//! Management of joystick enable state
|
|
|
|
|
//@{
|
2012-06-29 22:12:04 +00:00
|
|
|
|
void SetJoystickEnabled(bool enable);
|
2013-05-26 12:50:23 +00:00
|
|
|
|
bool GetJoystickEnabled() const;
|
2012-09-12 21:43:04 +00:00
|
|
|
|
//@}
|
2012-06-29 22:12:04 +00:00
|
|
|
|
|
2012-07-29 13:09:53 +00:00
|
|
|
|
//! Polls the state of joystick axes and buttons
|
|
|
|
|
void UpdateJoystick();
|
|
|
|
|
|
2012-08-12 08:45:04 +00:00
|
|
|
|
//! Updates the mouse position explicitly
|
|
|
|
|
void UpdateMouse();
|
|
|
|
|
|
2012-09-12 21:43:04 +00:00
|
|
|
|
//! Management of the grab mode for input (keyboard & mouse)
|
|
|
|
|
//@{
|
2012-07-22 20:05:12 +00:00
|
|
|
|
void SetGrabInput(bool grab);
|
2013-05-26 12:50:23 +00:00
|
|
|
|
bool GetGrabInput() const;
|
2012-09-12 21:43:04 +00:00
|
|
|
|
//@}
|
2012-07-22 20:05:12 +00:00
|
|
|
|
|
2012-09-20 18:37:37 +00:00
|
|
|
|
//! Management of mouse mode
|
2012-09-12 21:43:04 +00:00
|
|
|
|
//@{
|
2012-09-20 18:37:37 +00:00
|
|
|
|
void SetMouseMode(MouseMode mode);
|
2013-05-26 12:50:23 +00:00
|
|
|
|
MouseMode GetMouseMode() const;
|
2012-09-12 21:43:04 +00:00
|
|
|
|
//@}
|
2012-06-29 22:12:04 +00:00
|
|
|
|
|
2012-09-20 18:37:37 +00:00
|
|
|
|
//! Moves (warps) the mouse cursor to the specified position (in interface coords)
|
|
|
|
|
void MoveMouse(Math::Point pos);
|
2012-06-24 13:41:56 +00:00
|
|
|
|
|
2013-06-16 19:39:21 +00:00
|
|
|
|
//! Management of debug modes (printing more info in logger)
|
2012-09-12 21:43:04 +00:00
|
|
|
|
//@{
|
2013-06-16 19:39:21 +00:00
|
|
|
|
void SetDebugModeActive(DebugMode mode, bool active);
|
|
|
|
|
bool IsDebugModeActive(DebugMode mode) const;
|
|
|
|
|
static bool ParseDebugModes(const std::string& str, int& debugModes);
|
2012-09-12 21:43:04 +00:00
|
|
|
|
//@}
|
2012-06-24 13:41:56 +00:00
|
|
|
|
|
2012-09-09 15:51:10 +00:00
|
|
|
|
//! Management of language
|
|
|
|
|
//@{
|
2013-05-26 12:50:23 +00:00
|
|
|
|
Language GetLanguage() const;
|
|
|
|
|
char GetLanguageChar() const;
|
2012-09-09 15:51:10 +00:00
|
|
|
|
void SetLanguage(Language language);
|
2013-03-10 14:44:21 +00:00
|
|
|
|
static bool ParseLanguage(const std::string& str, Language& language);
|
2012-09-09 15:51:10 +00:00
|
|
|
|
//@}
|
|
|
|
|
|
2012-09-20 18:37:37 +00:00
|
|
|
|
//! Management of sleep in main loop (lowers CPU usage)
|
|
|
|
|
//@{
|
|
|
|
|
void SetLowCPU(bool low);
|
2013-05-26 12:50:23 +00:00
|
|
|
|
bool GetLowCPU() const;
|
2012-09-20 18:37:37 +00:00
|
|
|
|
//@}
|
|
|
|
|
|
2012-10-25 21:29:49 +00:00
|
|
|
|
//! Management of performance counters
|
|
|
|
|
//@{
|
|
|
|
|
void StartPerformanceCounter(PerformanceCounter counter);
|
|
|
|
|
void StopPerformanceCounter(PerformanceCounter counter);
|
2013-05-26 12:50:23 +00:00
|
|
|
|
float GetPerformanceCounterData(PerformanceCounter counter) const;
|
2012-10-25 21:29:49 +00:00
|
|
|
|
//@}
|
2013-12-26 21:13:04 +00:00
|
|
|
|
|
|
|
|
|
bool GetSceneTestMode();
|
2013-06-16 19:39:21 +00:00
|
|
|
|
|
2012-06-24 13:41:56 +00:00
|
|
|
|
protected:
|
2012-07-29 13:09:53 +00:00
|
|
|
|
//! Creates the window's SDL_Surface
|
|
|
|
|
bool CreateVideoSurface();
|
|
|
|
|
|
2012-07-22 20:05:12 +00:00
|
|
|
|
//! Processes the captured SDL event to Event struct
|
2012-09-21 22:38:17 +00:00
|
|
|
|
Event ProcessSystemEvent();
|
2012-09-19 16:32:18 +00:00
|
|
|
|
//! If applicable, creates a virtual event to match the changed state as of new event
|
|
|
|
|
Event CreateVirtualEvent(const Event& sourceEvent);
|
2012-10-25 18:27:40 +00:00
|
|
|
|
//! Prepares a simulation update event
|
2013-03-23 23:03:37 +00:00
|
|
|
|
TEST_VIRTUAL Event CreateUpdateEvent();
|
2013-06-16 19:39:21 +00:00
|
|
|
|
//! Logs debug data for event
|
|
|
|
|
void LogEvent(const Event& event);
|
2012-06-29 22:12:04 +00:00
|
|
|
|
//! Renders the image in window
|
2012-08-10 21:31:42 +00:00
|
|
|
|
void Render();
|
2012-06-29 22:12:04 +00:00
|
|
|
|
|
|
|
|
|
//! Opens the joystick device
|
|
|
|
|
bool OpenJoystick();
|
|
|
|
|
//! Closes the joystick device
|
|
|
|
|
void CloseJoystick();
|
|
|
|
|
|
2013-06-13 15:25:58 +00:00
|
|
|
|
//! Internal procedure to reset time counters
|
|
|
|
|
void InternalResumeSimulation();
|
|
|
|
|
|
2012-10-25 21:29:49 +00:00
|
|
|
|
//! Resets all performance counters to zero
|
|
|
|
|
void ResetPerformanceCounters();
|
|
|
|
|
//! Updates performance counters from gathered timer data
|
|
|
|
|
void UpdatePerformanceCountersData();
|
|
|
|
|
|
2012-06-24 13:41:56 +00:00
|
|
|
|
protected:
|
2012-06-26 20:23:05 +00:00
|
|
|
|
//! Private (SDL-dependent data)
|
|
|
|
|
ApplicationPrivate* m_private;
|
2013-02-16 21:37:43 +00:00
|
|
|
|
//! Instance manager
|
|
|
|
|
// TODO: to be removed
|
|
|
|
|
CInstanceManager* m_iMan;
|
2013-03-31 08:21:22 +00:00
|
|
|
|
//! Object manager
|
|
|
|
|
CObjectManager* m_objMan;
|
2012-06-29 22:12:04 +00:00
|
|
|
|
//! Global event queue
|
|
|
|
|
CEventQueue* m_eventQueue;
|
|
|
|
|
//! Graphics engine
|
2012-06-26 20:23:05 +00:00
|
|
|
|
Gfx::CEngine* m_engine;
|
2012-07-01 20:59:22 +00:00
|
|
|
|
//! Graphics device
|
|
|
|
|
Gfx::CDevice* m_device;
|
2012-12-26 19:58:02 +00:00
|
|
|
|
//! 3D models manager
|
|
|
|
|
Gfx::CModelManager* m_modelManager;
|
2012-06-29 22:12:04 +00:00
|
|
|
|
//! Sound subsystem
|
2012-09-19 19:23:42 +00:00
|
|
|
|
CSoundInterface* m_sound;
|
2014-12-22 09:35:05 +00:00
|
|
|
|
//! Game controller - game engine and UI
|
|
|
|
|
CController* m_controller;
|
2012-12-26 19:58:02 +00:00
|
|
|
|
//! Profile (INI) reader/writer
|
2012-09-21 22:11:16 +00:00
|
|
|
|
CProfile* m_profile;
|
2014-12-11 18:01:57 +00:00
|
|
|
|
//! Input manager
|
|
|
|
|
CInput* m_input;
|
2015-03-08 14:22:21 +00:00
|
|
|
|
//! Path manager
|
|
|
|
|
CPathManager* m_pathManager;
|
2012-06-29 22:12:04 +00:00
|
|
|
|
|
2012-06-26 20:23:05 +00:00
|
|
|
|
//! Code to return at exit
|
|
|
|
|
int m_exitCode;
|
2012-07-29 13:09:53 +00:00
|
|
|
|
//! Whether application window is active
|
2012-06-26 20:23:05 +00:00
|
|
|
|
bool m_active;
|
2013-06-16 19:39:21 +00:00
|
|
|
|
//! Bit array of active debug modes
|
|
|
|
|
long m_debugModes;
|
2014-10-25 16:34:29 +00:00
|
|
|
|
//! If we are restarting the app
|
|
|
|
|
bool m_restart;
|
2012-06-26 20:23:05 +00:00
|
|
|
|
|
2012-08-13 21:09:30 +00:00
|
|
|
|
//! Message to be displayed as error to the user
|
|
|
|
|
std::string m_errorMessage;
|
|
|
|
|
|
2012-07-29 13:09:53 +00:00
|
|
|
|
//! Current configuration of OpenGL display device
|
|
|
|
|
Gfx::GLDeviceConfig m_deviceConfig;
|
|
|
|
|
//! Previous configuration of OpenGL display device
|
|
|
|
|
Gfx::GLDeviceConfig m_lastDeviceConfig;
|
2012-06-29 22:12:04 +00:00
|
|
|
|
|
2012-07-22 20:05:12 +00:00
|
|
|
|
//! Text set as window title
|
2012-06-29 22:12:04 +00:00
|
|
|
|
std::string m_windowTitle;
|
|
|
|
|
|
2012-09-12 21:43:04 +00:00
|
|
|
|
//! Animation time stamps, etc.
|
|
|
|
|
//@{
|
|
|
|
|
SystemTimeStamp* m_baseTimeStamp;
|
|
|
|
|
SystemTimeStamp* m_lastTimeStamp;
|
|
|
|
|
SystemTimeStamp* m_curTimeStamp;
|
|
|
|
|
|
2012-10-25 21:29:49 +00:00
|
|
|
|
SystemTimeStamp* m_performanceCounters[PCNT_MAX][2];
|
|
|
|
|
float m_performanceCountersData[PCNT_MAX];
|
|
|
|
|
|
2012-09-12 21:43:04 +00:00
|
|
|
|
long long m_realAbsTimeBase;
|
|
|
|
|
long long m_realAbsTime;
|
|
|
|
|
long long m_realRelTime;
|
|
|
|
|
|
|
|
|
|
long long m_absTimeBase;
|
|
|
|
|
long long m_exactAbsTime;
|
|
|
|
|
long long m_exactRelTime;
|
2012-06-26 20:23:05 +00:00
|
|
|
|
|
2012-09-12 21:43:04 +00:00
|
|
|
|
float m_absTime;
|
|
|
|
|
float m_relTime;
|
|
|
|
|
|
|
|
|
|
float m_simulationSpeed;
|
|
|
|
|
bool m_simulationSuspended;
|
|
|
|
|
//@}
|
|
|
|
|
|
2012-09-20 18:37:37 +00:00
|
|
|
|
//! Current mode of mouse
|
|
|
|
|
MouseMode m_mouseMode;
|
2012-07-29 13:09:53 +00:00
|
|
|
|
|
|
|
|
|
//! Info about current joystick device
|
|
|
|
|
JoystickDevice m_joystick;
|
|
|
|
|
//! Whether joystick is enabled
|
|
|
|
|
bool m_joystickEnabled;
|
2012-06-30 10:26:40 +00:00
|
|
|
|
//! Current state of joystick axes; may be updated from another thread
|
|
|
|
|
std::vector<int> m_joyAxeState;
|
|
|
|
|
//! Current state of joystick buttons; may be updated from another thread
|
|
|
|
|
std::vector<bool> m_joyButtonState;
|
2014-06-20 21:41:38 +00:00
|
|
|
|
|
2013-06-16 19:39:21 +00:00
|
|
|
|
//@{
|
|
|
|
|
//! Scene to run on startup
|
|
|
|
|
std::string m_runSceneName;
|
|
|
|
|
int m_runSceneRank;
|
|
|
|
|
//@}
|
2013-12-26 21:13:04 +00:00
|
|
|
|
|
|
|
|
|
//! Scene test mode
|
|
|
|
|
bool m_sceneTest;
|
2013-06-16 19:39:21 +00:00
|
|
|
|
|
2012-09-09 15:51:10 +00:00
|
|
|
|
//! Application language
|
|
|
|
|
Language m_language;
|
2012-09-20 18:37:37 +00:00
|
|
|
|
|
|
|
|
|
//! Low cpu mode
|
|
|
|
|
bool m_lowCPU;
|
2014-08-28 11:08:10 +00:00
|
|
|
|
|
|
|
|
|
//! Screen resoultion overriden by commandline
|
|
|
|
|
bool m_resolutionOverride;
|
2014-10-31 19:05:06 +00:00
|
|
|
|
|
|
|
|
|
//! Headles mode
|
|
|
|
|
bool m_headless;
|
2012-06-22 14:31:55 +00:00
|
|
|
|
};
|
|
|
|
|
|