Started project, implemented keyboard and controller movement
This commit is contained in:
parent
b1f5d882f0
commit
d8fa53801b
33 changed files with 931 additions and 73 deletions
11
src/GameCommands/AxisCommand.h
Normal file
11
src/GameCommands/AxisCommand.h
Normal file
|
@ -0,0 +1,11 @@
|
|||
#ifndef AXIS_COMMAND_H
|
||||
#define AXIS_COMMAND_H
|
||||
|
||||
class AxisCommand
|
||||
{
|
||||
public:
|
||||
virtual void Execute(float value) = 0;
|
||||
};
|
||||
|
||||
|
||||
#endif
|
0
src/GameCommands/DodgeCommand.h
Normal file
0
src/GameCommands/DodgeCommand.h
Normal file
17
src/GameCommands/EndGameCommand.h
Normal file
17
src/GameCommands/EndGameCommand.h
Normal file
|
@ -0,0 +1,17 @@
|
|||
#ifndef END_GAME_COMMAND_H
|
||||
#define END_GAME_COMMAND_H
|
||||
|
||||
#include "GameCommand.h"
|
||||
#include "../Game.h"
|
||||
|
||||
class EndGameCommand : public GameCommand
|
||||
{
|
||||
public:
|
||||
EndGameCommand(Game* game) : m_game(game){}
|
||||
void Down() override {m_game->EndGame();}
|
||||
void Up() override {}
|
||||
private:
|
||||
Game* m_game;
|
||||
};
|
||||
|
||||
#endif
|
13
src/GameCommands/GameCommand.h
Normal file
13
src/GameCommands/GameCommand.h
Normal file
|
@ -0,0 +1,13 @@
|
|||
#ifndef GAME_COMMAND_H
|
||||
#define GAME_COMMAND_H
|
||||
|
||||
class GameCommand
|
||||
{
|
||||
public:
|
||||
GameCommand() {};
|
||||
virtual ~GameCommand() {};
|
||||
virtual void Down() = 0;
|
||||
virtual void Up() = 0;
|
||||
};
|
||||
|
||||
#endif
|
19
src/GameCommands/MoveDownCommand.h
Normal file
19
src/GameCommands/MoveDownCommand.h
Normal file
|
@ -0,0 +1,19 @@
|
|||
#ifndef MOVE_DOWN_COMMAND_H
|
||||
#define MOVE_DOWN_COMMAND_H
|
||||
|
||||
#include "GameCommand.h"
|
||||
#include <SDL3/SDL.h>
|
||||
|
||||
class MoveDownCommand : public GameCommand
|
||||
{
|
||||
public:
|
||||
MoveDownCommand(SDL_FPoint & directionInput, bool & buttonInput) : m_directionInput(&directionInput), m_buttonInput(&buttonInput) {};
|
||||
~MoveDownCommand() {};
|
||||
void Down() override { m_directionInput->y += 1; *m_buttonInput = true;}
|
||||
void Up() override { m_directionInput->y -= 1; *m_buttonInput = true;}
|
||||
private:
|
||||
SDL_FPoint * m_directionInput;
|
||||
bool * m_buttonInput;
|
||||
};
|
||||
|
||||
#endif
|
22
src/GameCommands/MoveLeftCommand.h
Normal file
22
src/GameCommands/MoveLeftCommand.h
Normal file
|
@ -0,0 +1,22 @@
|
|||
#ifndef MOVE_LEFT_COMMAND_H
|
||||
#define MOVE_LEFT_COMMAND_H
|
||||
|
||||
#include "GameCommand.h"
|
||||
#include <iostream>
|
||||
#include <memory>
|
||||
#include <SDL3/SDL.h>
|
||||
#include "../Components/MoveComponent.h"
|
||||
|
||||
class MoveLeftCommand : public GameCommand
|
||||
{
|
||||
public:
|
||||
MoveLeftCommand(SDL_FPoint & directionInput, bool & buttonInput) : m_directionInput(&directionInput), m_buttonInput(&buttonInput) {};
|
||||
~MoveLeftCommand() {};
|
||||
void Down() override { m_directionInput->x -= 1; *m_buttonInput = true;}
|
||||
void Up() override { m_directionInput->x += 1; *m_buttonInput = true;}
|
||||
private:
|
||||
SDL_FPoint * m_directionInput;
|
||||
bool * m_buttonInput;
|
||||
};
|
||||
|
||||
#endif
|
22
src/GameCommands/MoveRightCommand.h
Normal file
22
src/GameCommands/MoveRightCommand.h
Normal file
|
@ -0,0 +1,22 @@
|
|||
#ifndef MOVE_RIGHT_COMMAND_H
|
||||
#define MOVE_RIGHT_COMMAND_H
|
||||
|
||||
#include "GameCommand.h"
|
||||
#include <iostream>
|
||||
#include <memory>
|
||||
#include <SDL3/SDL.h>
|
||||
#include "../Components/MoveComponent.h"
|
||||
|
||||
class MoveRightCommand : public GameCommand
|
||||
{
|
||||
public:
|
||||
MoveRightCommand(SDL_FPoint & directionInput, bool & buttonInput) : m_directionInput(&directionInput), m_buttonInput(&buttonInput) {};
|
||||
~MoveRightCommand() {};
|
||||
void Down() override { m_directionInput->x += 1; *m_buttonInput = true;}
|
||||
void Up() override { m_directionInput->x -= 1; *m_buttonInput = true;}
|
||||
private:
|
||||
SDL_FPoint * m_directionInput;
|
||||
bool * m_buttonInput;
|
||||
};
|
||||
|
||||
#endif
|
22
src/GameCommands/MoveUpCommand.h
Normal file
22
src/GameCommands/MoveUpCommand.h
Normal file
|
@ -0,0 +1,22 @@
|
|||
#ifndef MOVE_UP_COMMAND_H
|
||||
#define MOVE_UP_COMMAND_H
|
||||
|
||||
#include "GameCommand.h"
|
||||
#include <iostream>
|
||||
#include <memory>
|
||||
#include <SDL3/SDL.h>
|
||||
#include "../Components/MoveComponent.h"
|
||||
|
||||
class MoveUpCommand : public GameCommand
|
||||
{
|
||||
public:
|
||||
MoveUpCommand(SDL_FPoint & directionInput, bool & buttonInput) : m_directionInput(&directionInput), m_buttonInput(&buttonInput) {};
|
||||
~MoveUpCommand() {};
|
||||
void Down() override { m_directionInput->y -= 1; *m_buttonInput = true;}
|
||||
void Up() override { m_directionInput->y += 1; *m_buttonInput = true;}
|
||||
private:
|
||||
SDL_FPoint * m_directionInput;
|
||||
bool * m_buttonInput;
|
||||
};
|
||||
|
||||
#endif
|
20
src/GameCommands/MoveXCommand.h
Normal file
20
src/GameCommands/MoveXCommand.h
Normal file
|
@ -0,0 +1,20 @@
|
|||
#ifndef MOVE_X_COMMAND_H
|
||||
#define MOVE_X_COMMAND_H
|
||||
|
||||
|
||||
#include "AxisCommand.h"
|
||||
#include <SDL3/SDL.h>
|
||||
|
||||
class MoveXCommand : public AxisCommand
|
||||
{
|
||||
public:
|
||||
MoveXCommand(SDL_FPoint & directionInput) : m_directionInput(&directionInput){};
|
||||
~MoveXCommand() {};
|
||||
void Execute(float value) override { m_directionInput->x = value;}
|
||||
private:
|
||||
SDL_FPoint * m_directionInput;
|
||||
};
|
||||
|
||||
|
||||
|
||||
#endif
|
20
src/GameCommands/MoveYCommand.h
Normal file
20
src/GameCommands/MoveYCommand.h
Normal file
|
@ -0,0 +1,20 @@
|
|||
#ifndef MOVE_Y_COMMAND_H
|
||||
#define MOVE_Y_COMMAND_H
|
||||
|
||||
|
||||
#include "AxisCommand.h"
|
||||
#include <SDL3/SDL.h>
|
||||
|
||||
class MoveYCommand : public AxisCommand
|
||||
{
|
||||
public:
|
||||
MoveYCommand(SDL_FPoint & directionInput) : m_directionInput(&directionInput){};
|
||||
~MoveYCommand() {};
|
||||
void Execute(float value) override { m_directionInput->y = value;}
|
||||
private:
|
||||
SDL_FPoint * m_directionInput;
|
||||
};
|
||||
|
||||
|
||||
|
||||
#endif
|
22
src/GameCommands/Skill1Command.h
Normal file
22
src/GameCommands/Skill1Command.h
Normal file
|
@ -0,0 +1,22 @@
|
|||
#ifndef SKILL_1_COMMAND_H
|
||||
#define SKILL_1_COMMAND_H
|
||||
|
||||
class Skill1Command
|
||||
{
|
||||
private:
|
||||
/* data */
|
||||
public:
|
||||
Skill1Command(/* args */);
|
||||
~Skill1Command();
|
||||
};
|
||||
|
||||
Skill1Command::Skill1Command(/* args */)
|
||||
{
|
||||
}
|
||||
|
||||
Skill1Command::~Skill1Command()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
#endif
|
Loading…
Add table
Add a link
Reference in a new issue