2014-05-26 06:34:49 +02:00
|
|
|
#ifndef INGAMESTATE_HPP
|
|
|
|
#define INGAMESTATE_HPP
|
|
|
|
|
|
|
|
#include "State.hpp"
|
|
|
|
|
2014-08-12 22:15:26 +02:00
|
|
|
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;
|
2015-07-03 03:52:43 +02:00
|
|
|
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:
|
2015-07-03 03:52:43 +02:00
|
|
|
/**
|
|
|
|
* @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-06-22 12:29:39 +02:00
|
|
|
|
2016-09-09 22:13:20 +02:00
|
|
|
virtual bool shouldWorldUpdate();
|
2014-08-12 22:15:26 +02:00
|
|
|
|
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
|