minecraftvulkan/src/keyboard_movement_controller.hpp

31 lines
740 B
C++
Raw Normal View History

2022-09-19 01:20:51 +00:00
#pragma once
#include "xe_game_object.hpp"
#include "xe_window.hpp"
#include <GLFW/glfw3.h>
2022-09-20 01:28:41 +00:00
namespace app {
2022-09-19 01:20:51 +00:00
class KeyboardMovementController {
public:
struct KeyMappings {
int moveLeft = GLFW_KEY_A;
int moveRight = GLFW_KEY_D;
int moveForward = GLFW_KEY_W;
int moveBackward = GLFW_KEY_S;
int moveUp = GLFW_KEY_E;
int moveDown = GLFW_KEY_Q;
int lookLeft = GLFW_KEY_LEFT;
int lookRight = GLFW_KEY_RIGHT;
int lookUp = GLFW_KEY_UP;
int lookDown = GLFW_KEY_DOWN;
};
2022-09-20 01:28:41 +00:00
void moveInPlaneXZ(GLFWwindow* window, float dt, xe::XeGameObject& gameObject);
2022-09-19 01:20:51 +00:00
KeyMappings keys{};
float moveSpeed{3.f};
float lookSpeed{1.5f};
};
}