187 lines
4.5 KiB
C++
187 lines
4.5 KiB
C++
#pragma once
|
|
|
|
#include <SDL3/SDL.h>
|
|
|
|
#include "version.h"
|
|
|
|
|
|
|
|
void exception_loop();
|
|
|
|
int scrw();
|
|
int scrh();
|
|
|
|
void raisewindow();
|
|
|
|
namespace mini
|
|
{
|
|
namespace surf
|
|
{
|
|
uint8_t create(int w, int h);
|
|
uint8_t load(const char* filename, const bool external = false);
|
|
void save(uint8_t surface, const char* filename, uint8_t *pal, uint8_t colors=0);
|
|
void destroy(uint8_t surface);
|
|
int width(uint8_t surface);
|
|
int height(uint8_t surface);
|
|
void cls(uint8_t color=0);
|
|
|
|
namespace target {
|
|
void set(uint8_t surface);
|
|
uint8_t get();
|
|
}
|
|
|
|
namespace source {
|
|
void set(uint8_t surface);
|
|
uint8_t get();
|
|
}
|
|
|
|
namespace pixel {
|
|
void set(int x, int y, uint8_t color);
|
|
uint8_t get(int x, int y);
|
|
}
|
|
}
|
|
|
|
namespace map
|
|
{
|
|
namespace surf {
|
|
void set(uint8_t surface);
|
|
uint8_t get();
|
|
}
|
|
void draw(); //int celx, int cely, int sx, int sy, uint8_t celw, uint8_t celh, uint8_t layer=0);
|
|
|
|
namespace tile {
|
|
uint8_t get(int celx, int cely);
|
|
void set(int celx, int cely, uint8_t snum);
|
|
}
|
|
|
|
namespace cell {
|
|
uint8_t getw();
|
|
uint8_t geth();
|
|
void set(int w, int h);
|
|
}
|
|
|
|
}
|
|
}
|
|
|
|
|
|
void shader_init(const char* vshader, const char* fshader);
|
|
void shader_enable();
|
|
void shader_disable();
|
|
|
|
uint8_t loadfont(const char *filename);
|
|
uint8_t getfont();
|
|
void setfont(uint8_t font);
|
|
uint8_t getfontspacing();
|
|
void setfontspacing(uint8_t spacing);
|
|
|
|
|
|
uint32_t *loadpal(const char* filename, uint16_t *palsize=NULL);
|
|
void setpal(uint32_t *pal);
|
|
void setcolor(uint8_t index, uint32_t color);
|
|
uint32_t getcolor(uint8_t index);
|
|
void settrans(uint8_t index);
|
|
uint8_t gettrans();
|
|
uint8_t subpal(uint8_t index, uint8_t color);
|
|
void reset_subpal();
|
|
|
|
namespace mini
|
|
{
|
|
namespace draw
|
|
{
|
|
void line(int x0, int y0, int x1, int y1, uint8_t color);
|
|
void hline(int x0, int y, int x1, uint8_t color);
|
|
void vline(int x, int y0, int y1, uint8_t color);
|
|
|
|
void rect(int x, int y, int w, int h, uint8_t color);
|
|
void rectf(int x, int y, int w, int h, uint8_t color);
|
|
|
|
void circ(int x, int y, uint8_t r, uint8_t color);
|
|
void circf(int x, int y, uint8_t r, uint8_t color);
|
|
|
|
void roundrect(int x, int y, int w, int h, uint8_t r, uint8_t color);
|
|
void roundrectf(int x, int y, int w, int h, uint8_t r, uint8_t color);
|
|
void oval(int x0, int y0, int x1, int y1, uint8_t color);
|
|
void ovalf(int x0, int y0, int x1, int y1, uint8_t color);
|
|
|
|
namespace mode
|
|
{
|
|
void set(uint8_t mode);
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
void fillp(uint16_t pat, bool transparent = false);
|
|
|
|
void print(const char *str, int x, int y, uint8_t color);
|
|
|
|
void clip(int x, int y, int w, int h);
|
|
void clip();
|
|
void origin(int x, int y);
|
|
int camx();
|
|
int camy();
|
|
|
|
uint8_t sget(int x, int y);
|
|
|
|
void blit(int sx, int sy, int sw, int sh, int dx, int dy, int dw=0, int dh=0, bool flip_x = false, bool flip_y = false, bool invert = false);
|
|
void blit_r(int sx, int sy, int sw, int sh, int dx, int dy, int dw, int dh, bool flip_x, bool flip_y, float angle_deg);
|
|
|
|
bool btn(uint8_t i);
|
|
int wbtnp();
|
|
bool btnp(uint8_t i);
|
|
bool anykey();
|
|
void textenable(const bool enable);
|
|
const char *textinput();
|
|
|
|
bool pad(int8_t i);
|
|
bool padp(int8_t i);
|
|
int wpad();
|
|
|
|
int mousex();
|
|
int mousey();
|
|
int mwheel();
|
|
bool mbtn(uint8_t i);
|
|
bool mbtnp(uint8_t i);
|
|
bool doubleclick();
|
|
void mdiscard();
|
|
bool minside(int x, int y, int w, int h);
|
|
|
|
float time();
|
|
float delta();
|
|
bool beat(int16_t i);
|
|
|
|
int getfps();
|
|
|
|
void playmusic(const char *filename, const int loop=-1);
|
|
void pausemusic();
|
|
void resumemusic();
|
|
void stopmusic(const int t=1000);
|
|
void musicpos(float value);
|
|
float musicpos();
|
|
void enablemusic(const bool value);
|
|
const bool ismusicenabled();
|
|
|
|
int loadsound(const char *filename);
|
|
void freesound(int soundfile);
|
|
int playsound(int soundfile, const int volume=-1);
|
|
void stopsound(int soundchannel);
|
|
void enablesound(const bool value);
|
|
const bool issoundenabled();
|
|
|
|
int getzoom();
|
|
void setzoom(const int value);
|
|
void setres(const int w, const int h);
|
|
bool getfullscreen();
|
|
void setfullscreen(const bool value);
|
|
bool getcursor();
|
|
void setcursor(const bool value);
|
|
|
|
const char *getconfig(const char* key);
|
|
void setconfig(const char* key, const char* value);
|
|
const char *configfolder();
|
|
|
|
void setupdatemode(const int value, const int t=0);
|
|
int getupdatemode();
|
|
|
|
void exit();
|