- [CHG] draw.rect i draw.rectFill ara pillen (x,y,w,h), com les persones normals, no (x1,y1,x2,y2) com el subnormal de pico-8
This commit is contained in:
20
lua.cpp
20
lua.cpp
@@ -407,22 +407,22 @@ extern "C" {
|
||||
}
|
||||
|
||||
static int cpp_draw_rect(lua_State *L) {
|
||||
int x0 = luaL_checknumber(L, 1);
|
||||
int y0 = luaL_checknumber(L, 2);
|
||||
int x1 = luaL_checknumber(L, 3);
|
||||
int y1 = luaL_checknumber(L, 4);
|
||||
int x = luaL_checknumber(L, 1);
|
||||
int y = luaL_checknumber(L, 2);
|
||||
int w = luaL_checknumber(L, 3);
|
||||
int h = luaL_checknumber(L, 4);
|
||||
uint8_t color = luaL_checkinteger(L, 5);
|
||||
rect(x0, y0, x1, y1, color);
|
||||
rect(x, y, w, h, color);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int cpp_draw_rectfill(lua_State *L) {
|
||||
int x0 = luaL_checknumber(L, 1);
|
||||
int y0 = luaL_checknumber(L, 2);
|
||||
int x1 = luaL_checknumber(L, 3);
|
||||
int y1 = luaL_checknumber(L, 4);
|
||||
int x = luaL_checknumber(L, 1);
|
||||
int y = luaL_checknumber(L, 2);
|
||||
int w = luaL_checknumber(L, 3);
|
||||
int h = luaL_checknumber(L, 4);
|
||||
uint8_t color = luaL_checkinteger(L, 5);
|
||||
rectfill(x0, y0, x1, y1, color);
|
||||
rectfill(x, y, w, h, color);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
26
mini.cpp
26
mini.cpp
@@ -676,25 +676,29 @@ void vline(int x, int y0, int y1, uint8_t color) {
|
||||
vline(x, y0, y1);
|
||||
}
|
||||
|
||||
void rect(int x0, int y0, int x1, int y1) {
|
||||
hline(x0, y0, x1);
|
||||
hline(x0, y1, x1);
|
||||
vline(x0, y0, y1);
|
||||
vline(x1, y0, y1);
|
||||
void rect(int x, int y, int w, int h) {
|
||||
int x1 = w-x+1;
|
||||
int y1 = h-y+1;
|
||||
hline(x, y, x1);
|
||||
hline(x, y1, x1);
|
||||
vline(x, y, y1);
|
||||
vline(x1, y, y1);
|
||||
}
|
||||
|
||||
void rect(int x0, int y0, int x1, int y1, uint8_t color) {
|
||||
void rect(int x, int y, int w, int h, uint8_t color) {
|
||||
ds::pen_color = color;
|
||||
rect(x0, y0, x1, y1);
|
||||
rect(x, y, w, h);
|
||||
}
|
||||
|
||||
void rectfill(int x0, int y0, int x1, int y1) {
|
||||
for (int y=y0; y<=y1; ++y) hline(x0, y, x1);
|
||||
void rectfill(int x, int y, int w, int h) {
|
||||
int x1 = w-x+1;
|
||||
int y1 = h-y+1;
|
||||
for (int y=y; y<=y1; ++y) hline(x, y, x1);
|
||||
}
|
||||
|
||||
void rectfill(int x0, int y0, int x1, int y1, uint8_t color) {
|
||||
void rectfill(int x, int y, int w, int h, uint8_t color) {
|
||||
ds::pen_color = color;
|
||||
rectfill(x0, y0, x1, y1);
|
||||
rectfill(x, y, w, h);
|
||||
}
|
||||
|
||||
void fillp(uint16_t pat, bool transparent) {
|
||||
|
||||
8
mini.h
8
mini.h
@@ -156,11 +156,11 @@ void hline(int x0, int y, int x1, uint8_t color);
|
||||
void vline(int x, int y0, int y1);
|
||||
void vline(int x, int y0, int y1, uint8_t color);
|
||||
|
||||
void rect(int x0, int y0, int x1, int y1);
|
||||
void rect(int x0, int y0, int x1, int y1, uint8_t color);
|
||||
void rect(int x, int y, int w, int h);
|
||||
void rect(int x, int y, int w, int h, uint8_t color);
|
||||
|
||||
void rectfill(int x0, int y0, int x1, int y1);
|
||||
void rectfill(int x0, int y0, int x1, int y1, uint8_t color);
|
||||
void rectfill(int x, int y, int w, int h);
|
||||
void rectfill(int x, int y, int w, int h, uint8_t color);
|
||||
|
||||
void fillp(uint16_t pat, bool transparent = false);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user