basic movement
This commit is contained in:
20
include/game/agame/background.hpp
Normal file
20
include/game/agame/background.hpp
Normal file
@@ -0,0 +1,20 @@
|
||||
#pragma once
|
||||
|
||||
#include <object/entity.hpp>
|
||||
#include <renderer/texture.hpp>
|
||||
#include <renderer/font.hpp>
|
||||
#include <object/sound.hpp>
|
||||
|
||||
namespace Game::AGame {
|
||||
class Background : public Object::Entity {
|
||||
using Object::Entity::Entity;
|
||||
|
||||
public:
|
||||
~Background() override = default;
|
||||
void start() override;
|
||||
void update(float deltaTime) override;
|
||||
|
||||
private:
|
||||
Object::Sound mSound;
|
||||
};
|
||||
}
|
||||
26
include/game/agame/camcontroller.hpp
Normal file
26
include/game/agame/camcontroller.hpp
Normal file
@@ -0,0 +1,26 @@
|
||||
#pragma once
|
||||
|
||||
#include <object/entity.hpp>
|
||||
#include <renderer/texture.hpp>
|
||||
#include <renderer/font.hpp>
|
||||
#include <object/sound.hpp>
|
||||
|
||||
namespace Game::AGame {
|
||||
class CamController : public Object::Entity {
|
||||
using Object::Entity::Entity;
|
||||
|
||||
public:
|
||||
~CamController() override = default;
|
||||
void start() override;
|
||||
void update(float deltaTime) override;
|
||||
void onWindowResized(int newWidth, int newHeight) override {
|
||||
mScreenW = newWidth;
|
||||
mScreenH = newHeight;
|
||||
}
|
||||
|
||||
private:
|
||||
float mSpeed = 200.f; // Pixels per second
|
||||
int mScreenW, mScreenH;
|
||||
int mEdgeTolerance = 200;
|
||||
};
|
||||
}
|
||||
@@ -16,5 +16,6 @@ namespace Game::AGame {
|
||||
|
||||
private:
|
||||
Object::Sound mSound;
|
||||
float mSpeed = 200.f; // Pixels per second
|
||||
};
|
||||
}
|
||||
@@ -7,6 +7,7 @@
|
||||
#include <mutex>
|
||||
#include <chrono>
|
||||
#include <functional>
|
||||
#include <object/camera.hpp>
|
||||
|
||||
namespace Game {
|
||||
using clock = std::chrono::steady_clock;
|
||||
@@ -22,7 +23,7 @@ namespace Game {
|
||||
void setTargetUpdatesPerSecond(int target) { mTargetUpdatesPerSecond = target; }
|
||||
int getTargetUpdatesPerSecond() { return mTargetUpdatesPerSecond; }
|
||||
private:
|
||||
int mTargetUpdatesPerSecond = 60;
|
||||
int mTargetUpdatesPerSecond = TARGET_UPDATE_RATE;
|
||||
clock::time_point mLastUpdate;
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user