89 TRKEY_NUM_UP = (1<<0),
90 TRKEY_NUM_DOWN = (1<<1),
91 TRKEY_NUM_LEFT = (1<<2),
92 TRKEY_NUM_RIGHT = (1<<3),
93 TRKEY_NUM_PLUS = (1<<4),
94 TRKEY_NUM_MINUS = (1<<5),
95 TRKEY_PAGE_UP = (1<<6),
96 TRKEY_PAGE_DOWN = (1<<7)
128 PCNT_EVENT_PROCESSING,
149 DEBUG_SYS_EVENTS = 1 << 0,
150 DEBUG_APP_EVENTS = 1 << 1,
151 DEBUG_EVENTS = DEBUG_SYS_EVENTS | DEBUG_APP_EVENTS,
152 DEBUG_MODELS = 1 << 2,
153 DEBUG_ALL = DEBUG_SYS_EVENTS | DEBUG_APP_EVENTS | DEBUG_MODELS
232 bool fullScreen,
bool resizeable)
const;
253 float GetSimulationSpeed()
const;
284 bool GetJoystickEnabled()
const;
310 bool GetGrabInput()
const;
328 bool IsDebugModeActive(DebugMode mode)
const;
329 static bool ParseDebugModes(
const std::string& str,
int& debugModes);
335 char GetLanguageChar()
const;
336 void SetLanguage(
Language language);
337 static bool ParseLanguage(
const std::string& str,
Language& language);
343 bool GetLowCPU()
const;
353 bool GetSceneTestMode();
433 float m_performanceCountersData[
PCNT_MAX];
435 long long m_realAbsTimeBase;
436 long long m_realAbsTime;
437 long long m_realRelTime;
439 long long m_absTimeBase;
440 long long m_exactAbsTime;
441 long long m_exactRelTime;
446 float m_simulationSpeed;
447 bool m_simulationSuspended;
~CApplication()
Destructor.
Definition: app.cpp:167
CSoundInterface * GetSound()
Returns the sound subsystem.
Definition: app.cpp:203
CEventQueue * m_eventQueue
Global event queue.
Definition: app.h:392
Additional config with OpenGL-specific settings.
Definition: gldevice.h:50
CSingleton base class for singletons.
std::string m_runSceneName
Scene to run on startup.
Definition: app.h:482
void Render()
Renders the image in window.
Definition: app.cpp:1241
< frame update in CParticle
Definition: app.h:133
ParseArgsStatus ParseArguments(int argc, char *argv[])
Parses commandline arguments.
Definition: app.cpp:208
std::string m_windowTitle
Text set as window title.
Definition: app.h:424
ParseArgsStatus
State of parsing commandline arguments.
Definition: app.h:103
Main graphics engine - CEngine class.
void CloseJoystick()
Closes the joystick device.
Definition: app.cpp:728
< rendering 2D interface
Definition: app.h:142
bool GetKmodState(int kmod) const
Returns whether the given kmod is active.
Definition: app.cpp:1474
const std::string & GetErrorMessage() const
Returns the message of error (set to something if exit code is not 0)
Definition: app.cpp:976
bool m_sceneTest
Scene test mode.
Definition: app.h:487
void SetJoystickEnabled(bool enable)
Management of joystick enable state.
Definition: app.cpp:1557
long long GetExactAbsTime() const
Returns the exact absolute time counter [nanoseconds].
Definition: app.cpp:1345
void SetSimulationSpeed(float speed)
Management of simulation speed.
Definition: app.cpp:1283
std::string m_langPath
Path to directory with language files.
Definition: app.h:478
< rendering the water
Definition: app.h:138
CEventQueue * GetEventQueue()
Returns the application's event queue.
Definition: app.cpp:198
std::vector< bool > m_joyButtonState
Current state of joystick buttons; may be updated from another thread.
Definition: app.h:469
void SetMouseMode(MouseMode mode)
Management of mouse mode.
Definition: app.cpp:1508
< all ok
Definition: app.h:106
< all counters together
Definition: app.h:144
ApplicationPrivate * m_private
Private (SDL-dependent data)
Definition: app.h:385
std::string m_dataPath
Path to directory with data files.
Definition: app.h:472
std::vector< int > m_joyAxeState
Current state of joystick axes; may be updated from another thread.
Definition: app.h:467
VideoQueryResult GetVideoResolutionList(std::vector< Math::IntPoint > &resolutions, bool fullScreen, bool resizeable) const
Returns a list of possible video modes.
Definition: app.cpp:1375
< invalid syntax
Definition: app.h:107
< the whole frame update process
Definition: app.h:131
< in-game cursor visible; system cursor hidden
Definition: app.h:118
void ResetTimeAfterLoading()
Resets time counters to account for time spent loading game.
Definition: app.cpp:1263
Definition: singleton.h:27
int index
Device index (-1 = invalid device)
Definition: app.h:58
bool GetSimulationSuspended() const
Returns whether simulation is suspended.
Definition: app.cpp:1278
void InternalResumeSimulation()
Internal procedure to reset time counters.
Definition: app.cpp:1270
Some common, global definitions.
void LogEvent(const Event &event)
Logs debug data for event.
Definition: app.cpp:1135
bool ChangeJoystick(const JoystickDevice &newJoystick)
Change the current joystick device.
Definition: app.cpp:736
Gfx::CEngine * m_engine
Graphics engine.
Definition: app.h:394
CProfile * m_profile
Profile (INI) reader/writer.
Definition: app.h:404
long long GetExactRelTime() const
Returns the exact realative time since last update [nanoseconds].
Definition: app.cpp:1360
std::string name
Device name.
Definition: app.h:60
bool CreateVideoSurface()
Creates the window's SDL_Surface.
Definition: app.cpp:546
Global event queue.
Definition: event.h:764
Gfx::CDevice * m_device
Graphics device.
Definition: app.h:396
int axisCount
Number of axes (only available after joystick opened)
Definition: app.h:62
Gfx::CModelManager * m_modelManager
3D models manager
Definition: app.h:398
SystemTimeStamp * m_baseTimeStamp
Animation time stamps, etc.
Definition: app.h:428
Math::Point GetMousePos() const
Returns the position of mouse cursor (in interface coords)
Definition: app.cpp:1522
void SetLowCPU(bool low)
Management of sleep in main loop (lowers CPU usage)
Definition: app.cpp:1737
int GetKmods() const
Returns the current key modifiers.
Definition: app.cpp:1469
TEST_VIRTUAL Event CreateUpdateEvent()
Prepares a simulation update event.
Definition: app.cpp:1294
void UpdateJoystick()
Polls the state of joystick axes and buttons.
Definition: app.cpp:760
CSoundInterface * m_sound
Sound subsystem.
Definition: app.h:400
bool m_lowCPU
Low cpu mode.
Definition: app.h:493
Definition: robotmain.h:196
PerformanceCounter
Type of counter testing performance.
Definition: app.h:126
bool ChangeVideoConfig(const Gfx::GLDeviceConfig &newConfig)
Change the video mode to given mode.
Definition: app.cpp:652
long m_debugModes
Bit array of active debug modes.
Definition: app.h:413
void MoveMouse(Math::Point pos)
Moves (warps) the mouse cursor to the specified position (in interface coords)
Definition: app.cpp:1527
Math::Point m_mousePos
Current position of mouse cursor.
Definition: app.h:458
void UpdateMouse()
Updates the mouse position explicitly.
Definition: app.cpp:814
void UpdatePerformanceCountersData()
Updates performance counters from gathered timer data.
Definition: app.cpp:1771
float GetAbsTime() const
Returns the absolute time counter [seconds].
Definition: app.cpp:1340
CApplication()
Constructor (can only be called once!)
Definition: app.cpp:97
< rendering the particles in 3D
Definition: app.h:137
< rendering the terrain
Definition: app.h:139
unsigned int m_kmodState
Current state of key modifiers (bitmask of SDLMod)
Definition: app.h:451
unsigned int m_trackedKeys
Current state of some tracked keys (bitmask of TrackedKey enum values)
Definition: app.h:453
Definition: gamedata.h:48
bool GetTrackedKeyState(TrackedKey key) const
Returns whether the tracked key is pressed.
Definition: app.cpp:1479
CObjectManager * m_objMan
Object manager.
Definition: app.h:390
Gfx::GLDeviceConfig m_lastDeviceConfig
Previous configuration of OpenGL display device.
Definition: app.h:421
< frame update in CEngine
Definition: app.h:132
void ResetKeyStates()
Resets tracked key states and modifiers.
Definition: app.cpp:1489
unsigned int m_mouseButtonsState
Current state of mouse buttons (bitmask of MouseButton enum values)
Definition: app.h:460
2D point
Definition: point.h:46
< both cursors visible (only for debug)
Definition: app.h:119
< the whole rendering process
Definition: app.h:136
bool Create()
Initializes the application.
Definition: app.cpp:382
long long GetRealRelTime() const
Returns the exact relative time since last update disregarding speed setting [nanoseconds].
Definition: app.cpp:1365
Instance manager for objects.
Main application.
Definition: app.h:201
Language m_language
Application language.
Definition: app.h:490
Gfx::GLDeviceConfig GetVideoConfig() const
Returns the current video mode.
Definition: app.cpp:1370
CRobotMain * m_robotMain
Main class of the proper game engine.
Definition: app.h:402
int m_exitCode
Code to return at exit.
Definition: app.h:409
bool m_customDataPath
True if datadir was passed in command line.
Definition: app.h:475
JoystickDevice GetJoystick() const
Returns info about the current joystick.
Definition: app.cpp:1552
OpenGL implementation - CGLDevice class.
float GetRelTime() const
Returns the relative time since last update [seconds].
Definition: app.cpp:1355
JoystickDevice m_joystick
Info about current joystick device.
Definition: app.h:463
Event CreateVirtualEvent(const Event &sourceEvent)
If applicable, creates a virtual event to match the changed state as of new event.
Definition: app.cpp:1200
bool m_joystickEnabled
Whether joystick is enabled.
Definition: app.h:465
Class for loading profile (currently for loading ini config file)
Definition: profile.h:42
void SetDebugModeActive(DebugMode mode, bool active)
Management of debug modes (printing more info in logger)
Definition: app.cpp:1418
VideoQueryResult
Result of querying for available video resolutions.
Definition: app.h:74
< rendering the 3D objects
Definition: app.h:140
std::vector< JoystickDevice > GetJoystickList() const
Returns a list of available joystick devices.
Definition: app.cpp:1535
Manager for static models.
Definition: modelmanager.h:52
The graphics engine.
Definition: engine.h:682
MouseMode m_mouseMode
Current mode of mouse.
Definition: app.h:456
bool m_active
Whether application window is active.
Definition: app.h:411
< event processing (except update events)
Definition: app.h:130
Gfx::GLDeviceConfig m_deviceConfig
Current configuration of OpenGL display device.
Definition: app.h:419
Class for loading profile (currently for loading ini config file)
MouseMode
Mode of mouse cursor.
Definition: app.h:114
void SuspendSimulation()
Suspends animation (time will not be updated)
Definition: app.cpp:1249
Definition: system_linux.h:28
bool m_protoMode
Show prototype levels.
Definition: app.h:496
Abstract graphics device - CDevice class and related structs/enums.
Language GetLanguage() const
Management of language.
Definition: app.cpp:1579
CInstanceManager * m_iMan
Instance manager.
Definition: app.h:388
std::string m_errorMessage
Message to be displayed as error to the user.
Definition: app.h:416
void SetGrabInput(bool grab)
Management of the grab mode for input (keyboard & mouse)
Definition: app.cpp:1497
CGameData * m_gameData
Game data.
Definition: app.h:406
< system cursor visible; in-game cursor hidden
Definition: app.h:117
long long GetRealAbsTime() const
Returns the exact absolute time counter disregarding speed setting [nanoseconds]. ...
Definition: app.cpp:1350
< frame update in CRobotMain
Definition: app.h:135
Event sent by system, interface or game.
Definition: event.h:686
void ResumeSimulation()
Resumes animation.
Definition: app.cpp:1255
int GetExitCode() const
Returns the code to be returned at main() exit.
Definition: app.cpp:971
bool OpenJoystick()
Opens the joystick device.
Definition: app.cpp:706
int buttonCount
Number of buttons (only available after joystick opened)
Definition: app.h:64
Language
Application language.
Definition: global.h:171
int Run()
Main event loop.
Definition: app.cpp:821
Manager for instances of certain classes.
Definition: iman.h:71
Event ProcessSystemEvent()
Processes the captured SDL event to Event struct.
Definition: app.cpp:983
Private data of CApplication class.
Definition: app.cpp:72
Information about a joystick device.
Definition: app.h:55
void Destroy()
Cleans up before exit.
Definition: app.cpp:597
Sound plugin interface.
Definition: sound.h:149
Abstract interface of graphics device.
Definition: device.h:235
TrackedKey
Additional keys whose state (pressed/released) is tracked by CApplication.
Definition: app.h:87
void ResetPerformanceCounters()
Resets all performance counters to zero.
Definition: app.cpp:1762
bool GetMouseButtonState(int index) const
Returns whether the mouse button is pressed.
Definition: app.cpp:1484
void StartPerformanceCounter(PerformanceCounter counter)
Management of performance counters.
Definition: app.cpp:1747