Files
mini/source/mini.h

253 lines
6.0 KiB
C++

#pragma once
#include <SDL3/SDL.h>
#include "version.h"
void exception_loop();
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);
}
}
namespace pal
{
uint32_t *load(const char* filename, uint16_t *palsize=NULL);
void set(uint32_t *pal);
namespace color {
void set(uint8_t index, uint32_t color);
uint32_t get(uint8_t index);
}
namespace trans {
void set(uint8_t index);
uint8_t get();
}
namespace subpal {
uint8_t set(uint8_t index, uint8_t color);
void reset();
}
}
namespace view
{
namespace clip {
void set(int x, int y, int w, int h);
void reset();
}
namespace origin {
void set(int x, int y);
int getx();
int gety();
}
}
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 pattern {
void set(uint16_t pat, bool transparent = false);
}
void surf(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 surfrot(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);
void text(const char *str, int x, int y, uint8_t color);
namespace mode
{
void set(uint8_t mode);
}
}
namespace shader
{
void init(const char* vshader, const char* fshader);
void enable();
void disable();
}
namespace audio
{
namespace music
{
void play(const char *filename, const int loop=-1);
void pause();
void resume();
void stop(const int t=1000);
namespace pos {
void set(float value);
float get();
}
namespace enable {
void set(const bool value);
const bool get();
}
}
namespace sound
{
int load(const char *filename);
void free(int soundfile);
int play(int soundfile, const int volume=-1);
void stop(int soundchannel);
namespace enable {
void set(const bool value);
const bool get();
}
}
}
namespace sys
{
float delta();
float time();
bool beat(int16_t i);
int getfps();
namespace update {
void set(const int value, const int t=0);
int get();
}
void exit();
}
namespace win
{
namespace zoom {
void set(const int value);
int get();
}
namespace fullscreen {
void set(const bool value);
bool get();
}
namespace cursor {
void set(const bool value);
bool get();
}
namespace res {
void set(const int w, const int h);
int getw();
int geth();
}
}
namespace config
{
namespace key {
void set(const char* key, const char* value);
const char *get(const char* key);
}
const char *folder();
}
namespace font
{
uint8_t load(const char *filename);
namespace current {
void set(uint8_t font);
uint8_t get();
}
namespace spacing {
void set(uint8_t spacing);
uint8_t get();
}
}
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 key
{
bool down(uint8_t i);
bool press(uint8_t i);
int press();
bool any();
void text(const bool enable);
const char *utf8char();
}
namespace pad
{
bool down(int8_t i);
bool press(int8_t i);
int press();
}
}