1
0
mirror of https://github.com/rwengine/openrw.git synced 2024-11-10 04:42:38 +01:00
openrw/rwgame/ingamestate.hpp

65 lines
1.3 KiB
C++
Raw Normal View History

2014-05-26 06:34:49 +02:00
#ifndef INGAMESTATE_HPP
#define INGAMESTATE_HPP
#include <SDL2/SDL_events.h>
2014-05-26 06:34:49 +02:00
#include "State.hpp"
class PlayerController;
2014-05-26 06:34:49 +02:00
class IngameState : public State
{
2015-05-09 00:53:56 +02:00
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;
2015-04-01 06:05:21 +02:00
/** Player input */
2014-05-26 06:34:49 +02:00
glm::vec3 _movement;
2015-05-04 05:35:22 +02:00
glm::vec3 cameraPosition;
2015-05-09 00:53:56 +02:00
/** Timer to hold user camera position */
2014-12-15 00:21:30 +01:00
float autolookTimer;
2015-05-09 00:53:56 +02:00
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;
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".
*/
IngameState(RWGame* game, bool newgame = true, const std::string& save = "");
2014-05-26 06:34:49 +02:00
void startTest();
void startGame();
2014-05-26 06:34:49 +02:00
virtual void enter();
virtual void exit();
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
virtual void handleEvent(const SDL_Event& event);
virtual void handlePlayerInput(const SDL_Event& event);
virtual bool shouldWorldUpdate();
const ViewCamera& getCamera();
2014-05-26 06:34:49 +02:00
};
#endif // INGAMESTATE_HPP