Zepha/src/game/scene/world/Player.h

81 lines
2.1 KiB
C
Raw Normal View History

//
// Created by aurailus on 28/12/18.
//
#pragma once
#include <iostream>
#include "LocalWorld.h"
#include "../../graph/Camera.h"
#include "../../../util/Timer.h"
#include "../../entity/world/WireframeEntity.h"
#include "../../entity/world/BlockCrackEntity.h"
#include "../../graph/drawable/DrawableGroup.h"
#include "../../../world/block/PointedThing.h"
#include "../../hud/GameGui.h"
#include "../../entity/Collidable.h"
class Player : Collidable, public Drawable {
public:
static constexpr float MOUSE_SENSITIVITY = 0.1f;
static constexpr float LOOK_DISTANCE = 6.5f;
static constexpr float LOOK_PRECISION = 0.01f;
2019-04-10 18:44:17 -07:00
static constexpr float EYE_HEIGHT = 1.65f;
static constexpr float BASE_MOVE_SPEED = 4.3f;
static constexpr float JUMP_VEL = 0.14f;
static constexpr float BLOCK_DAMAGE = 0.36f;
static constexpr float BLOCK_INTERVAL = 0.02f;
Player(LocalWorld& world, LocalDefs& defs, Renderer& renderer);
2019-04-10 18:44:17 -07:00
void update(InputManager &input, double delta, double mouseX, double mouseY);
void moveAndLook(InputManager &input, double delta, double deltaX, double deltaY);
void updateCamera();
void findPointedThing(InputManager &input);
void updateWireframe();
void breakBlock(InputManager& input, double delta);
void setPos(glm::vec3 pos);
2019-10-23 23:34:30 -07:00
glm::vec3 getPos();
void setVel(glm::vec3 vel);
glm::vec3 getVel();
2019-10-23 23:34:30 -07:00
void setYaw(float yaw);
float getYaw();
2019-10-23 23:34:30 -07:00
void setPitch(float pitch);
float getPitch();
void setActiveBlock(const std::string& block);
void setMenu(const std::string& menu);
std::string getMenuState();
void closeMenu();
void setGuiVisible(bool hudVisible);
void draw(Renderer& renderer) override;
void drawViginette(Renderer& renderer);
void drawGUI(Renderer& renderer);
2019-04-10 18:44:17 -07:00
PointedThing& getPointedThing();
private:
Renderer& renderer;
LocalDefs& defs;
GameGui gameGui;
bool flying = false;
float yaw = 0;
float pitch = 0;
unsigned int activeBlock = -1;
PointedThing pointedThing;
WireframeEntity wireframe;
double breakInterval = 0;
};