fixed input with keyboard and controller at the same time
This commit is contained in:
parent
d8fa53801b
commit
eabeb55115
11 changed files with 95 additions and 68 deletions
|
@ -2,21 +2,16 @@
|
|||
#define MOVE_LEFT_COMMAND_H
|
||||
|
||||
#include "GameCommand.h"
|
||||
#include <iostream>
|
||||
#include <memory>
|
||||
#include <SDL3/SDL.h>
|
||||
#include "../Components/MoveComponent.h"
|
||||
#include "../DataStructures/DirectionButtonStatus.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;}
|
||||
MoveLeftCommand(DirectionButtonStatus & buttonStatus) : m_ButtonStatus(&buttonStatus) {};
|
||||
void Down() override { m_ButtonStatus->LeftPressed = true;}
|
||||
void Up() override { m_ButtonStatus->LeftPressed = false;;}
|
||||
private:
|
||||
SDL_FPoint * m_directionInput;
|
||||
bool * m_buttonInput;
|
||||
DirectionButtonStatus * m_ButtonStatus;
|
||||
};
|
||||
|
||||
#endif
|
Loading…
Add table
Add a link
Reference in a new issue