- [WIP] Está tot patas arriba ara...
This commit is contained in:
2326
source/lua.cpp
2326
source/lua.cpp
File diff suppressed because it is too large
Load Diff
1361
source/lua.debug.cpp
Normal file
1361
source/lua.debug.cpp
Normal file
File diff suppressed because it is too large
Load Diff
17
source/lua.debug.h
Normal file
17
source/lua.debug.h
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
#pragma once
|
||||||
|
struct lua_State;
|
||||||
|
|
||||||
|
namespace mini
|
||||||
|
{
|
||||||
|
namespace lua
|
||||||
|
{
|
||||||
|
namespace debug
|
||||||
|
{
|
||||||
|
bool call_and_handle_exceptions(lua_State* L);
|
||||||
|
void kill_thread();
|
||||||
|
void process_commands(lua_State* L);
|
||||||
|
void toggle(lua_State* L);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
25
source/lua.h
25
source/lua.h
@@ -1,11 +1,18 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
bool lua_is_playing();
|
namespace mini
|
||||||
void lua_process_debugger_commands();
|
{
|
||||||
void lua_init(const char* main_lua_file = "main.lua");
|
namespace lua
|
||||||
void lua_call_init();
|
{
|
||||||
void lua_call_update();
|
bool runnning();
|
||||||
void lua_quit();
|
void init(const char* main_lua_file = "main.lua");
|
||||||
void lua_kill_thread();
|
void quit();
|
||||||
void lua_toggle_debug();
|
void cleanup();
|
||||||
//void lua_disable_debug();
|
|
||||||
|
namespace callbacks
|
||||||
|
{
|
||||||
|
void init();
|
||||||
|
void update();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
uint16_t ants = 0xc936;
|
uint16_t ants = 0xc936;
|
||||||
float t = 0;
|
float t = 0;
|
||||||
|
|
||||||
void loop() {
|
void exception_loop() {
|
||||||
//if (t==0) t= time();
|
//if (t==0) t= time();
|
||||||
if (time()-t > 0.25) {
|
if (time()-t > 0.25) {
|
||||||
t = time();
|
t = time();
|
||||||
@@ -15,13 +15,13 @@ void loop() {
|
|||||||
setcolor(1,0xff000000);
|
setcolor(1,0xff000000);
|
||||||
const int w=scrw();
|
const int w=scrw();
|
||||||
const int h=scrh();
|
const int h=scrh();
|
||||||
set_draw_mode(0);
|
mini::draw::mode::set(0);
|
||||||
rect(0,0,w,h,1);
|
mini::draw::rect(0,0,w,h,1);
|
||||||
rect(1,1,w-2,h-2,1);
|
mini::draw::rect(1,1,w-2,h-2,1);
|
||||||
set_draw_mode(1);
|
mini::draw::mode::set(1);
|
||||||
fillp(ants);
|
fillp(ants);
|
||||||
rect(0,0,w,h,0);
|
mini::draw::rect(0,0,w,h,0);
|
||||||
rect(1,1,w-2,h-2,0);
|
mini::draw::rect(1,1,w-2,h-2,0);
|
||||||
ants = (ants<<12) | (ants>>4);
|
ants = (ants<<12) | (ants>>4);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
1258
source/mini.cpp
1258
source/mini.cpp
File diff suppressed because it is too large
Load Diff
230
source/mini.h
230
source/mini.h
@@ -4,141 +4,65 @@
|
|||||||
|
|
||||||
#include "version.h"
|
#include "version.h"
|
||||||
|
|
||||||
#define KEY_UNKNOWN 0
|
|
||||||
#define KEY_A 4
|
|
||||||
#define KEY_B 5
|
|
||||||
#define KEY_C 6
|
|
||||||
#define KEY_D 7
|
|
||||||
#define KEY_E 8
|
|
||||||
#define KEY_F 9
|
|
||||||
#define KEY_G 10
|
|
||||||
#define KEY_H 11
|
|
||||||
#define KEY_I 12
|
|
||||||
#define KEY_J 13
|
|
||||||
#define KEY_K 14
|
|
||||||
#define KEY_L 15
|
|
||||||
#define KEY_M 16
|
|
||||||
#define KEY_N 17
|
|
||||||
#define KEY_O 18
|
|
||||||
#define KEY_P 19
|
|
||||||
#define KEY_Q 20
|
|
||||||
#define KEY_R 21
|
|
||||||
#define KEY_S 22
|
|
||||||
#define KEY_T 23
|
|
||||||
#define KEY_U 24
|
|
||||||
#define KEY_V 25
|
|
||||||
#define KEY_W 26
|
|
||||||
#define KEY_X 27
|
|
||||||
#define KEY_Y 28
|
|
||||||
#define KEY_Z 29
|
|
||||||
#define KEY_1 30
|
|
||||||
#define KEY_2 31
|
|
||||||
#define KEY_3 32
|
|
||||||
#define KEY_4 33
|
|
||||||
#define KEY_5 34
|
|
||||||
#define KEY_6 35
|
|
||||||
#define KEY_7 36
|
|
||||||
#define KEY_8 37
|
|
||||||
#define KEY_9 38
|
|
||||||
#define KEY_0 39
|
|
||||||
#define KEY_RETURN 40
|
|
||||||
#define KEY_ESCAPE 41
|
|
||||||
#define KEY_BACKSPACE 42
|
|
||||||
#define KEY_TAB 43
|
|
||||||
#define KEY_SPACE 44
|
|
||||||
#define KEY_MINUS 45
|
|
||||||
#define KEY_EQUALS 46
|
|
||||||
#define KEY_LEFTBRACKET 47
|
|
||||||
#define KEY_RIGHTBRACKET 48
|
|
||||||
#define KEY_BACKSLASH 49
|
|
||||||
#define KEY_NONUSHASH 50
|
|
||||||
#define KEY_SEMICOLON 51
|
|
||||||
#define KEY_APOSTROPHE 52
|
|
||||||
#define KEY_GRAVE 53
|
|
||||||
#define KEY_COMMA 54
|
|
||||||
#define KEY_PERIOD 55
|
|
||||||
#define KEY_SLASH 56
|
|
||||||
#define KEY_CAPSLOCK 57
|
|
||||||
#define KEY_F1 58
|
|
||||||
#define KEY_F2 59
|
|
||||||
#define KEY_F3 60
|
|
||||||
#define KEY_F4 61
|
|
||||||
#define KEY_F5 62
|
|
||||||
#define KEY_F6 63
|
|
||||||
#define KEY_F7 64
|
|
||||||
#define KEY_F8 65
|
|
||||||
#define KEY_F9 66
|
|
||||||
#define KEY_F10 67
|
|
||||||
#define KEY_F11 68
|
|
||||||
#define KEY_F12 69
|
|
||||||
#define KEY_PRINTSCREEN 70
|
|
||||||
#define KEY_SCROLLLOCK 71
|
|
||||||
#define KEY_PAUSE 72
|
|
||||||
#define KEY_INSERT 73
|
|
||||||
#define KEY_HOME 74
|
|
||||||
#define KEY_PAGEUP 75
|
|
||||||
#define KEY_DELETE 76
|
|
||||||
#define KEY_END 77
|
|
||||||
#define KEY_PAGEDOWN 78
|
|
||||||
#define KEY_RIGHT 79
|
|
||||||
#define KEY_LEFT 80
|
|
||||||
#define KEY_DOWN 81
|
|
||||||
#define KEY_UP 82
|
|
||||||
#define KEY_NUMLOCKCLEAR 83
|
|
||||||
#define KEY_KP_DIVIDE 84
|
|
||||||
#define KEY_KP_MULTIPLY 85
|
|
||||||
#define KEY_KP_MINUS 86
|
|
||||||
#define KEY_KP_PLUS 87
|
|
||||||
#define KEY_KP_ENTER 88
|
|
||||||
#define KEY_KP_1 89
|
|
||||||
#define KEY_KP_2 90
|
|
||||||
#define KEY_KP_3 91
|
|
||||||
#define KEY_KP_4 92
|
|
||||||
#define KEY_KP_5 93
|
|
||||||
#define KEY_KP_6 94
|
|
||||||
#define KEY_KP_7 95
|
|
||||||
#define KEY_KP_8 96
|
|
||||||
#define KEY_KP_9 97
|
|
||||||
#define KEY_KP_0 98
|
|
||||||
#define KEY_KP_PERIOD 99
|
|
||||||
#define KEY_NONUSBACKSLASH 100
|
|
||||||
#define KEY_APPLICATION 101
|
|
||||||
#define KEY_LCTRL 224
|
|
||||||
#define KEY_LSHIFT 225
|
|
||||||
#define KEY_LALT 226
|
|
||||||
#define KEY_LGUI 227
|
|
||||||
#define KEY_RCTRL 228
|
|
||||||
#define KEY_RSHIFT 229
|
|
||||||
#define KEY_RALT 230
|
|
||||||
#define KEY_RGUI 231
|
|
||||||
|
|
||||||
#define DRAWMODE_NORMAL 0
|
|
||||||
#define DRAWMODE_PATTERN 1
|
|
||||||
#define DRAWMODE_AND 2
|
|
||||||
#define DRAWMODE_OR 3
|
|
||||||
#define DRAWMODE_XOR 4
|
|
||||||
#define DRAWMODE_NOT 5
|
|
||||||
|
|
||||||
void loop();
|
void exception_loop();
|
||||||
|
|
||||||
int scrw();
|
int scrw();
|
||||||
int scrh();
|
int scrh();
|
||||||
|
|
||||||
void raisewindow();
|
void raisewindow();
|
||||||
|
|
||||||
uint8_t newsurf(int w, int h);
|
namespace mini
|
||||||
uint8_t loadsurf(const char* filename, const bool external = false);
|
{
|
||||||
void savesurf(uint8_t surface, const char* filename, uint8_t *pal, uint8_t colors=0);
|
namespace surf
|
||||||
void freesurf(uint8_t surface);
|
{
|
||||||
int surfw(uint8_t surface);
|
uint8_t create(int w, int h);
|
||||||
int surfh(uint8_t surface);
|
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 setdest(uint8_t surface);
|
|
||||||
void setsource(uint8_t surface);
|
|
||||||
void setmap(uint8_t surface);
|
|
||||||
uint8_t getdest();
|
|
||||||
uint8_t getsource();
|
|
||||||
uint8_t getmap();
|
|
||||||
|
|
||||||
void shader_init(const char* vshader, const char* fshader);
|
void shader_init(const char* vshader, const char* fshader);
|
||||||
void shader_enable();
|
void shader_enable();
|
||||||
@@ -150,7 +74,6 @@ void setfont(uint8_t font);
|
|||||||
uint8_t getfontspacing();
|
uint8_t getfontspacing();
|
||||||
void setfontspacing(uint8_t spacing);
|
void setfontspacing(uint8_t spacing);
|
||||||
|
|
||||||
void cls(uint8_t color=0);
|
|
||||||
|
|
||||||
uint32_t *loadpal(const char* filename, uint16_t *palsize=NULL);
|
uint32_t *loadpal(const char* filename, uint16_t *palsize=NULL);
|
||||||
void setpal(uint32_t *pal);
|
void setpal(uint32_t *pal);
|
||||||
@@ -161,17 +84,32 @@ uint8_t gettrans();
|
|||||||
uint8_t subpal(uint8_t index, uint8_t color);
|
uint8_t subpal(uint8_t index, uint8_t color);
|
||||||
void reset_subpal();
|
void reset_subpal();
|
||||||
|
|
||||||
void set_draw_mode(uint8_t mode);
|
namespace mini
|
||||||
void pset(int x, int y, uint8_t color);
|
{
|
||||||
|
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);
|
||||||
|
|
||||||
uint8_t pget(int x, int y);
|
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 line(int x0, int y0, int x1, int y1, uint8_t color);
|
void circ(int x, int y, uint8_t r, uint8_t color);
|
||||||
void hline(int x0, int y, int x1, uint8_t color);
|
void circf(int x, int y, uint8_t r, uint8_t color);
|
||||||
void vline(int x, int y0, int y1, 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 rect(int x, int y, int w, int h, uint8_t color);
|
|
||||||
void rectfill(int x, int y, int w, int h, uint8_t color);
|
|
||||||
|
|
||||||
void fillp(uint16_t pat, bool transparent = false);
|
void fillp(uint16_t pat, bool transparent = false);
|
||||||
|
|
||||||
@@ -183,29 +121,11 @@ void origin(int x, int y);
|
|||||||
int camx();
|
int camx();
|
||||||
int camy();
|
int camy();
|
||||||
|
|
||||||
void circ(int x, int y, uint8_t r, uint8_t color);
|
|
||||||
void circfill(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 roundrectfill(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 ovalfill(int x0, int y0, int x1, int y1, uint8_t color);
|
|
||||||
|
|
||||||
uint8_t sget(int x, int y);
|
uint8_t sget(int x, int y);
|
||||||
void sset(int x, int y, uint8_t color);
|
|
||||||
|
|
||||||
void spr(uint8_t n, int x, int y, float w = 1.0f, float h = 1.0f, bool flip_x = false, bool flip_y = false);
|
|
||||||
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(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 x, int y, float a);
|
|
||||||
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);
|
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);
|
||||||
|
|
||||||
uint8_t mget(int celx, int cely);
|
|
||||||
void mset(int celx, int cely, uint8_t snum);
|
|
||||||
uint8_t gettilew();
|
|
||||||
uint8_t gettileh();
|
|
||||||
void settilesize(int w, int h);
|
|
||||||
void map(); //int celx, int cely, int sx, int sy, uint8_t celw, uint8_t celh, uint8_t layer=0);
|
|
||||||
|
|
||||||
bool btn(uint8_t i);
|
bool btn(uint8_t i);
|
||||||
int wbtnp();
|
int wbtnp();
|
||||||
bool btnp(uint8_t i);
|
bool btnp(uint8_t i);
|
||||||
@@ -227,6 +147,7 @@ void mdiscard();
|
|||||||
bool minside(int x, int y, int w, int h);
|
bool minside(int x, int y, int w, int h);
|
||||||
|
|
||||||
float time();
|
float time();
|
||||||
|
float delta();
|
||||||
bool beat(int16_t i);
|
bool beat(int16_t i);
|
||||||
|
|
||||||
int getfps();
|
int getfps();
|
||||||
@@ -259,9 +180,6 @@ const char *getconfig(const char* key);
|
|||||||
void setconfig(const char* key, const char* value);
|
void setconfig(const char* key, const char* value);
|
||||||
const char *configfolder();
|
const char *configfolder();
|
||||||
|
|
||||||
#define UPDATE_ALWAYS 0
|
|
||||||
#define UPDATE_WAIT 1
|
|
||||||
#define UPDATE_TIMEOUT 2
|
|
||||||
void setupdatemode(const int value, const int t=0);
|
void setupdatemode(const int value, const int t=0);
|
||||||
int getupdatemode();
|
int getupdatemode();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user