Move through course, sprite and input

Signed-off-by: Daniel Henry <iamdanhenry@gmail.com>
This commit is contained in:
2025-09-05 11:00:14 -05:00
parent c545d800d2
commit b64f931010
342 changed files with 2258 additions and 33 deletions

View File

@@ -0,0 +1,11 @@
#pragma once
#include <string>
std::string GetResourceDir() {
#ifdef NDEBUG // Release Build
return "assets/";
#else
return "D:/Projects/LightYears/LightYearsGame/assets/";
#endif
}

View File

@@ -1,10 +1,14 @@
#pragma once
#include <framework/Application.h>
#include <framework/Core.h>
namespace ly {
class PlayerSpaceship;
class GameApplication : public Application {
public:
GameApplication();
virtual void Tick(float deltaTime) override;
private:
weak<PlayerSpaceship> testPlayerSpaceship;
};
}

View File

@@ -0,0 +1,21 @@
#pragma once
#include "spaceship/Spaceship.h"
namespace ly {
class PlayerSpaceship : public Spaceship {
public:
PlayerSpaceship(World *owningWorld, const std::string &texture = "SpaceShooterRedux/PNG/playerShip1_blue.png");
virtual void Tick(float deltaTime) override;
private:
void HandleInput();
void ConsumeInput(float deltaTime);
void SetSpeed(float newSpeed) { mSpeed = newSpeed; }
float GetSpeed() { return mSpeed; }
void NormalizeInput();
sf::Vector2f mMoveInput;
float mSpeed;
};
}

View File

@@ -0,0 +1,14 @@
#pragma once
#include <framework/Actor.h>
namespace ly {
class Spaceship : public Actor {
public:
Spaceship(World *owningWorld, const std::string &texturePath = "");
virtual void Tick(float deltaTime) override;
void SetVelocity(const sf::Vector2f newVelocity);
sf::Vector2f GetVelocity() const { return mVelocity; }
private:
sf::Vector2f mVelocity;
};
}