1
0
mirror of https://github.com/rwengine/openrw.git synced 2024-11-07 11:22:45 +01:00
openrw/rwgame/states/IngameState.hpp

64 lines
1.5 KiB
C++
Raw Normal View History

2014-05-26 06:34:49 +02:00
#ifndef INGAMESTATE_HPP
#define INGAMESTATE_HPP
#include "State.hpp"
class PlayerController;
2014-05-26 06:34:49 +02:00
2016-09-09 22:13:20 +02:00
class IngameState : public State {
enum CameraMode {
CAMERA_CLOSE = 0,
CAMERA_NORMAL = 1,
CAMERA_FAR = 2,
CAMERA_TOPDOWN = 3,
/** Used for counting - not a valid camera mode */
CAMERA_MAX
};
bool started;
std::string save;
2016-09-09 22:13:20 +02:00
bool newgame;
ViewCamera _look;
glm::vec3 cameraPosition;
/** Timer to hold user camera position */
float autolookTimer;
CameraMode camMode;
/// Current camera yaw and pitch
glm::vec2 m_cameraAngles;
/// Invert Y axis movement
bool m_invertedY;
/// Free look in vehicles.
bool m_vehicleFreeLook;
2016-09-12 01:35:09 +02:00
float moneyTimer = 0.f; // Timer used to updated displayed money value
2014-05-26 06:34:49 +02:00
public:
/**
* @brief IngameState
* @param game
* @param newgame
* @param game An empty string, a save game to load, or the string "test".
*/
2016-09-09 22:13:20 +02:00
IngameState(RWGame* game, bool newgame = true,
const std::string& save = "");
2014-05-26 06:34:49 +02:00
2016-09-09 22:13:20 +02:00
void startTest();
void startGame();
2014-05-26 06:34:49 +02:00
2016-09-09 22:13:20 +02:00
virtual void enter();
virtual void exit();
2014-05-26 06:34:49 +02:00
2016-09-09 22:13:20 +02:00
virtual void tick(float dt);
2015-02-07 23:55:06 +01:00
virtual void draw(GameRenderer* r);
2014-05-26 06:34:49 +02:00
2016-09-09 22:13:20 +02:00
virtual void handleEvent(const SDL_Event& event);
virtual void handlePlayerInput(const SDL_Event& event);
void updateInputState(const SDL_Event& event);
2016-09-09 22:13:20 +02:00
virtual bool shouldWorldUpdate();
2016-09-09 22:13:20 +02:00
const ViewCamera& getCamera();
2014-05-26 06:34:49 +02:00
};
2016-09-09 22:13:20 +02:00
#endif // INGAMESTATE_HPP