76 lines
1.4 KiB
C++
76 lines
1.4 KiB
C++
#pragma once
|
|
|
|
#define SDL3 1
|
|
#define SFML 2
|
|
#define EMSCRIPTEN 3
|
|
|
|
#ifndef BACKEND
|
|
#define BACKEND SDL3
|
|
#endif
|
|
|
|
#include <stdint.h>
|
|
|
|
namespace backend
|
|
{
|
|
enum state_t { running=0, exiting=1, quitting=2 };
|
|
extern state_t current_state;
|
|
|
|
void init();
|
|
void quit();
|
|
void poll_events();
|
|
const state_t& state();
|
|
void exit();
|
|
uint64_t get_time_ms();
|
|
|
|
namespace video
|
|
{
|
|
void init();
|
|
void quit();
|
|
void render();
|
|
void raise_window();
|
|
void cursor(const bool value);
|
|
}
|
|
|
|
namespace audio
|
|
{
|
|
void init();
|
|
void quit();
|
|
void render();
|
|
}
|
|
|
|
namespace input
|
|
{
|
|
void reset();
|
|
|
|
namespace key
|
|
{
|
|
bool down(uint8_t i);
|
|
bool press(uint8_t i);
|
|
int press();
|
|
bool any();
|
|
void text(const bool enable);
|
|
const char *utf8char();
|
|
}
|
|
|
|
namespace mouse
|
|
{
|
|
int posx();
|
|
int posy();
|
|
int wheel();
|
|
bool down(uint8_t i);
|
|
bool press(uint8_t i);
|
|
bool dblclick();
|
|
void discard();
|
|
bool inside(int x, int y, int w, int h);
|
|
}
|
|
|
|
namespace pad
|
|
{
|
|
void init();
|
|
bool down(int8_t i);
|
|
bool press(int8_t i);
|
|
int press();
|
|
}
|
|
}
|
|
}
|