minecraftvulkan/src/player_controller.hpp

44 lines
886 B
C++
Raw Permalink Normal View History

2022-09-19 01:20:51 +00:00
#pragma once
#include "xe_game_object.hpp"
#include "xe_input.hpp"
2022-10-03 10:50:49 +00:00
#define GLM_FORCE_RADIANS
#include <glm/common.hpp>
#include <glm/fwd.hpp>
#include <glm/geometric.hpp>
#include <limits>
2022-09-19 01:20:51 +00:00
2022-09-20 01:28:41 +00:00
namespace app {
2022-09-25 23:05:56 +00:00
2022-10-01 18:35:16 +00:00
class PlayerController {
2022-09-19 01:20:51 +00:00
public:
2022-09-25 23:05:56 +00:00
2022-10-01 18:35:16 +00:00
PlayerController(xe::Input &input, xe::GameObject &viewerObject);
~PlayerController();
2022-09-25 23:05:56 +00:00
2022-09-19 01:20:51 +00:00
struct KeyMappings {
int moveLeft = KEY_A;
int moveRight = KEY_D;
int moveForward = KEY_W;
int moveBackward = KEY_S;
int moveUp = KEY_E;
int moveDown = KEY_Q;
int lookLeft = KEY_LEFT;
int lookRight = KEY_RIGHT;
int lookUp = KEY_UP;
int lookDown = KEY_DOWN;
2022-09-19 01:20:51 +00:00
};
2022-09-25 23:05:56 +00:00
void update(float dt);
xe::Input &input;
xe::GameObject &viewerObject;
2022-09-19 01:20:51 +00:00
KeyMappings keys{};
2022-10-03 10:50:49 +00:00
float moveSpeed{100.f};
2022-09-19 01:20:51 +00:00
float lookSpeed{1.5f};
};
}