up down is broken
This commit is contained in:
+7
-2
@@ -1,16 +1,21 @@
|
||||
#ifndef DELTA_ENTITY
|
||||
#define DELTA_ENTITY
|
||||
|
||||
#include <SDL3/SDL.h>
|
||||
#include <SDL3/SDL_main.h>
|
||||
|
||||
#include "renderer/camera.hpp"
|
||||
#include "math.hpp"
|
||||
|
||||
class DeltaEntity {
|
||||
public:
|
||||
DeltaVector3 pos;
|
||||
DeltaVector3 velocity;
|
||||
DeltaVector2 angle;
|
||||
|
||||
DeltaEntity(float x, float y, float z);
|
||||
void draw(DeltaCamera camera);
|
||||
DeltaEntity() {pos.x = 0; pos.y = 0; pos.z = 0; velocity = DeltaVector3(); angle = DeltaVector2();};
|
||||
DeltaEntity(float x, float y, float z) {pos.x = x; pos.y = y; pos.z = z; velocity = DeltaVector3(); angle = DeltaVector2(); };
|
||||
void draw(SDL_Renderer *renderer);
|
||||
void update(float deltaTime);
|
||||
};
|
||||
|
||||
|
||||
@@ -23,6 +23,11 @@ class DeltaVector3 {
|
||||
float x, y, z;
|
||||
DeltaVector3(float xval, float yval, float zval);
|
||||
DeltaVector3();
|
||||
DeltaVector3 operator+(const DeltaVector3& other) const;
|
||||
DeltaVector3 operator-(const DeltaVector3& other) const;
|
||||
DeltaVector3 operator*(float a) const;
|
||||
DeltaVector3& operator+=(const DeltaVector3& other);
|
||||
DeltaVector3& operator-=(const DeltaVector3& other);
|
||||
float distanceToVector(const DeltaVector3 &vec) const;
|
||||
float distanceToPos(float x, float y) const;
|
||||
float dotProduct(const DeltaVector3 &vec) const;
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
#ifndef DELTA_PLAYER
|
||||
#define DELTA_PLAYER
|
||||
|
||||
#include <SDL3/SDL.h>
|
||||
#include <SDL3/SDL_main.h>
|
||||
|
||||
#include "renderer/camera.hpp"
|
||||
#include "entity.hpp"
|
||||
#include "math.hpp"
|
||||
|
||||
class Player: public DeltaEntity {
|
||||
public:
|
||||
DeltaCamera camera;
|
||||
DeltaVector2 direction;
|
||||
|
||||
Player() {pos.x = 0; pos.y = 0; pos.z = 0; velocity = DeltaVector3(); angle = DeltaVector2(); camera = DeltaCamera(0, 0, 0);};
|
||||
Player(float x, float y, float z) {pos.x = x; pos.y = y; pos.z = z; velocity = DeltaVector3(); angle = DeltaVector2(); camera = DeltaCamera(0,0,0);};
|
||||
|
||||
void draw(SDL_Renderer *renderer);
|
||||
void update(float deltaTime);
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -8,6 +8,7 @@ class DeltaCamera {
|
||||
DeltaVector3 pos;
|
||||
DeltaVector2 angle;
|
||||
|
||||
DeltaCamera() {pos = DeltaVector3(); angle = DeltaVector2();};
|
||||
DeltaCamera(float x, float y, float z);
|
||||
DeltaVector2 projectPointVec(const DeltaVector3 &worldPos);
|
||||
DeltaVector2 projectPoint(float worldX, float worldY, float worldZ);
|
||||
|
||||
Reference in New Issue
Block a user