mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-07 12:01:50 +00:00
General refactor
This commit is contained in:
parent
de134dc2e5
commit
1d5037893c
27 changed files with 558 additions and 419 deletions
46
src/logic/PlayerController.h
Normal file
46
src/logic/PlayerController.h
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
#ifndef PLAYER_CONTROL_H_
|
||||
#define PLAYER_CONTROL_H_
|
||||
|
||||
#include <glm/glm.hpp>
|
||||
|
||||
#include "../settings.h"
|
||||
#include "../objects/Player.h"
|
||||
|
||||
class Camera;
|
||||
class Player;
|
||||
class Level;
|
||||
|
||||
class CameraControl {
|
||||
Player* player;
|
||||
Camera* camera;
|
||||
const CameraSettings& settings;
|
||||
glm::vec3 offset;
|
||||
float shake = 0.0f;
|
||||
float shakeTimer = 0.0f;
|
||||
glm::vec3 interpVel {0.0f};
|
||||
public:
|
||||
CameraControl(Player* player, const CameraSettings& settings);
|
||||
void updateMouse(PlayerInput& input);
|
||||
void update(PlayerInput& input, float delta);
|
||||
void refresh();
|
||||
};
|
||||
|
||||
class PlayerController {
|
||||
Level* level;
|
||||
Player* player;
|
||||
PlayerInput input;
|
||||
CameraControl camControl;
|
||||
public:
|
||||
static glm::vec3 selectedBlockPosition;
|
||||
static int selectedBlockId;
|
||||
|
||||
PlayerController(Level* level, const EngineSettings& settings);
|
||||
void updateKeyboard();
|
||||
void updateCamera(float delta, bool movement);
|
||||
void refreshCamera();
|
||||
void resetKeyboard();
|
||||
void updateControls(float delta);
|
||||
void updateInteraction();
|
||||
};
|
||||
|
||||
#endif /* PLAYER_CONTROL_H_ */
|
||||
Loading…
Add table
Add a link
Reference in a new issue