parent
6fd58d28b6
commit
f39c5e0347
@ -1,18 +1,28 @@
|
|||||||
|
/**
|
||||||
|
* \file InputProcessor.h
|
||||||
|
* \brief Define a structure, InputProcessor and functions to convert SDL_event to envent for Pontu
|
||||||
|
* \author Martin Rouault
|
||||||
|
* \date 06/12/2021
|
||||||
|
*/
|
||||||
|
|
||||||
#ifndef INPUT_PROCESSOR_INCLUDED
|
#ifndef INPUT_PROCESSOR_INCLUDED
|
||||||
#define INPUT_PROCESSOR_INCLUDED
|
#define INPUT_PROCESSOR_INCLUDED
|
||||||
|
|
||||||
#include "Button.h"
|
#include "engine/Button.h"
|
||||||
|
#include "engine/InputElement.h"
|
||||||
#include "model/Coord.h"
|
#include "model/Coord.h"
|
||||||
#include "InputElement.h"
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \struct
|
||||||
|
*/
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
ArrayButton tabButton;
|
ArrayButton tabButton;
|
||||||
struct Coord selectedCase; ///< Board , (-1;-1) si inexistant
|
Coord selectedCase; ///< Board , (-1;-1) si inexistant
|
||||||
} InputProcessor;
|
} InputProcessor;
|
||||||
|
|
||||||
struct Coord screenCoordToGameCoord(const SDL_Point* point, const SDL_Rect* boardRect);
|
Coord screenCoordToGameCoord(const SDL_Point* point, const SDL_Rect* boardRect);
|
||||||
|
|
||||||
InputElement proccessInput(InputProcessor *inputProcessor, const SDL_Rect* boardRect);
|
InputElement proccessInput(InputProcessor* inputProcessor, const SDL_Rect* boardRect);
|
||||||
|
|
||||||
#endif //INPUT_PROCESSOR_INCLUDED
|
#endif // INPUT_PROCESSOR_INCLUDED
|
||||||
|
@ -0,0 +1,12 @@
|
|||||||
|
#include "model/Coord.h"
|
||||||
|
|
||||||
|
|
||||||
|
bool coordValide(const Coord coord)
|
||||||
|
{
|
||||||
|
return coord.x >= 0 && coord.y >= 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool coordEqual(const Coord a, const Coord b)
|
||||||
|
{
|
||||||
|
return a.x == b.x && a.y == b.y;
|
||||||
|
}
|
Loading…
Reference in new issue