Refactor and fixes

This commit is contained in:
MihailRis
2023-11-12 02:44:02 +03:00
parent b4a3608302
commit 63b5f4bc6b
25 changed files with 394 additions and 278 deletions
+29 -3
View File
@@ -3,19 +3,45 @@
#include <glm/glm.hpp>
#include "../settings.h"
class PhysicsSolver;
class Chunks;
class Player;
class Level;
struct PlayerInput {
bool zoom;
bool moveForward;
bool moveBack;
bool moveRight;
bool moveLeft;
bool sprint;
bool shift;
bool cheat;
bool jump;
bool noclip;
bool flight;
};
class PlayerController {
Level* level;
Player* player;
PlayerInput input;
const CameraSettings& camSettings;
public:
glm::vec3 selectedBlockPosition;
glm::vec3 cameraOffset {0.0f, 0.7f, 0.0f};
int selectedBlockId = -1;
PlayerController(Level* level);
void update_controls(float delta, bool movement);
void update_interaction();
PlayerController(Level* level, const EngineSettings& settings);
void updateKeyboard();
void resetKeyboard();
void updateCameraControl();
void updateControls(float delta);
void updateInteraction();
void refreshCamera();
};
#endif /* PLAYER_CONTROL_H_ */