2024-01-29 02:29:22 +01:00
|
|
|
#ifndef TOUCH_H
|
|
|
|
#define TOUCH_H
|
|
|
|
|
|
|
|
#include <SDL.h>
|
|
|
|
|
|
|
|
#include <vector>
|
|
|
|
|
|
|
|
struct VVV_Finger
|
|
|
|
{
|
|
|
|
float x;
|
|
|
|
float y;
|
|
|
|
bool pressed;
|
|
|
|
bool on_button;
|
|
|
|
SDL_FingerID id;
|
|
|
|
};
|
|
|
|
|
|
|
|
enum TouchButtonID
|
|
|
|
{
|
|
|
|
/* General */
|
|
|
|
TOUCH_BUTTON_LEFT,
|
|
|
|
TOUCH_BUTTON_RIGHT,
|
|
|
|
|
|
|
|
/* Gameplay */
|
|
|
|
TOUCH_BUTTON_MAP,
|
|
|
|
|
|
|
|
/* Menus */
|
|
|
|
TOUCH_BUTTON_CANCEL,
|
|
|
|
TOUCH_BUTTON_CONFIRM,
|
|
|
|
|
|
|
|
NUM_TOUCH_BUTTONS
|
|
|
|
};
|
|
|
|
|
|
|
|
struct TouchButton
|
|
|
|
{
|
|
|
|
int x;
|
|
|
|
int y;
|
|
|
|
int width;
|
|
|
|
int height;
|
|
|
|
bool down;
|
|
|
|
bool active;
|
|
|
|
SDL_Texture* image;
|
|
|
|
SDL_FingerID fingerId;
|
|
|
|
};
|
|
|
|
|
|
|
|
namespace touch
|
|
|
|
{
|
|
|
|
extern std::vector<VVV_Finger> fingers;
|
|
|
|
extern TouchButton buttons[NUM_TOUCH_BUTTONS];
|
2024-04-12 00:58:49 +02:00
|
|
|
extern int scale;
|
2024-01-29 02:29:22 +01:00
|
|
|
|
|
|
|
void refresh_buttons(void);
|
|
|
|
void reset(void);
|
|
|
|
void update_buttons(void);
|
|
|
|
|
|
|
|
void init(void);
|
|
|
|
void render(void);
|
|
|
|
|
|
|
|
bool button_tapped(TouchButtonID button);
|
|
|
|
bool touching_right(void);
|
2024-04-12 00:55:03 +02:00
|
|
|
bool screen_down(void);
|
2024-01-29 02:29:22 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
#endif /* TOUCH_H */
|