1
0
mirror of https://github.com/rwengine/openrw.git synced 2024-09-20 01:11:46 +02:00
openrw/rwgame/states/IngameState.hpp

67 lines
1.5 KiB
C++
Raw Normal View History

2014-05-26 06:34:49 +02:00
#ifndef INGAMESTATE_HPP
#define INGAMESTATE_HPP
#include "StateManager.hpp"
2014-05-26 06:34:49 +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;
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);
2016-09-09 22:13:20 +02:00
virtual bool shouldWorldUpdate();
const ViewCamera& getCamera(float alpha);
private:
GameObject* getCameraTarget() const;
float getViewDistance() const;
2014-05-26 06:34:49 +02:00
};
2016-09-09 22:13:20 +02:00
#endif // INGAMESTATE_HPP