1
0
mirror of https://github.com/rwengine/openrw.git synced 2024-11-09 20:32:43 +01:00
openrw/rwgame/states/IngameState.hpp
2017-09-12 01:40:31 +01:00

67 lines
1.6 KiB
C++

#ifndef INGAMESTATE_HPP
#define INGAMESTATE_HPP
#include "StateManager.hpp"
class PlayerController;
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;
bool newgame;
ViewCamera _look;
glm::vec3 cameraPosition;
/** Timer to hold user camera position */
float autolookTimer;
CameraMode camMode;
/// Player camera input since the last update
glm::vec2 cameradelta_;
/// Invert Y axis movement
bool m_invertedY;
/// Free look in vehicles.
bool m_vehicleFreeLook;
float moneyTimer = 0.f; // Timer used to updated displayed money value
public:
/**
* @brief IngameState
* @param game
* @param newgame
* @param game An empty string, a save game to load, or the string "test".
*/
IngameState(RWGame* game, bool newgame = true,
const std::string& save = "");
void startTest();
void startGame();
virtual void enter() override;
virtual void exit() override;
virtual void tick(float dt) override;
virtual void draw(GameRenderer* r);
virtual void handleEvent(const SDL_Event& event) override;
virtual void handlePlayerInput(const SDL_Event& event);
virtual bool shouldWorldUpdate() override;
const ViewCamera& getCamera(float alpha);
private:
GameObject* getCameraTarget() const;
float getViewDistance() const;
};
#endif // INGAMESTATE_HPP