Add acceleration to movement code

This commit is contained in:
2016-06-17 18:11:23 +10:00
parent c54e6323a7
commit bcb847c18c
7 changed files with 80 additions and 16 deletions
+4 -1
View File
@@ -17,7 +17,10 @@ public:
Entity(const glm::vec2 pos, const std::string texName);
~Entity();
glm::vec2 pos;
glm::vec2 pos; // Position
glm::vec2 dPos; // Velocity
glm::vec2 size;
const Texture *tex;
};
+19
View File
@@ -0,0 +1,19 @@
#ifndef DENGINE_MATH_H
#define DENGINE_MATH_H
#include <Dengine/Common.h>
namespace Dengine
{
class Math
{
public:
static inline f32 squared(const f32 a)
{
f32 result = a * a;
return result;
}
};
}
#endif
+5 -4
View File
@@ -1,17 +1,18 @@
#ifndef WORLDTRAVELLER_GAME_H
#define WORLDTRAVELLER_GAME_H
#include <Dengine/OpenGL.h>
#include <Dengine/AssetManager.h>
#include <Dengine/Common.h>
#include <Dengine/Entity.h>
#include <Dengine/Math.h>
#include <Dengine/OpenGL.h>
#include <Dengine/Renderer.h>
#include <Dengine/Shader.h>
#include <Dengine/AssetManager.h>
#include <Dengine/Entity.h>
namespace WorldTraveller
{
GLOBAL_VAR const i32 NUM_KEYS = 1024;
GLOBAL_VAR const i32 METERS_TO_PIXEL = 100;
GLOBAL_VAR const f32 METERS_TO_PIXEL = 100;
enum Cardinal
{