Move through course, sprite and input
Signed-off-by: Daniel Henry <iamdanhenry@gmail.com>
This commit is contained in:
11
LightYearsGame/include/config.h
Normal file
11
LightYearsGame/include/config.h
Normal 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
|
||||
}
|
||||
@@ -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;
|
||||
};
|
||||
}
|
||||
21
LightYearsGame/include/player/PlayerSpaceship.h
Normal file
21
LightYearsGame/include/player/PlayerSpaceship.h
Normal 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;
|
||||
};
|
||||
}
|
||||
14
LightYearsGame/include/spaceship/Spaceship.h
Normal file
14
LightYearsGame/include/spaceship/Spaceship.h
Normal 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;
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user