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

67 lines
1.6 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;
/// Player camera input since the last update
glm::vec2 cameradelta_;
2016-09-09 22:13:20 +02:00
/// 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
2017-05-03 09:54:21 +02:00
virtual void enter() override;
virtual void exit() override;
2014-05-26 06:34:49 +02:00
2017-05-03 09:54:21 +02:00
virtual void tick(float dt) override;
2015-02-07 23:55:06 +01:00
virtual void draw(GameRenderer* r);
2014-05-26 06:34:49 +02:00
2017-05-03 09:54:21 +02:00
virtual void handleEvent(const SDL_Event& event) override;
2016-09-09 22:13:20 +02:00
virtual void handlePlayerInput(const SDL_Event& event);
2017-05-03 09:54:21 +02:00
virtual bool shouldWorldUpdate() override;
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