mirror of
https://github.com/suchmememanyskill/TegraExplorer.git
synced 2024-11-08 05:01:46 +00:00
as a joke, adding setPixel to Tscript
This commit is contained in:
parent
b0dd71bd4f
commit
baec43da2a
3 changed files with 13 additions and 0 deletions
|
@ -595,6 +595,10 @@ void gfx_set_pixel(u32 x, u32 y, u32 color)
|
||||||
gfx_ctxt.fb[x + y * gfx_ctxt.stride] = color;
|
gfx_ctxt.fb[x + y * gfx_ctxt.stride] = color;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void gfx_set_pixel_horz(int x, int y, u32 color) {
|
||||||
|
*(gfx_ctxt.fb + (YLEFT - x) * gfx_ctxt.stride + y) = color;
|
||||||
|
}
|
||||||
|
|
||||||
void gfx_line(int x0, int y0, int x1, int y1, u32 color)
|
void gfx_line(int x0, int y0, int x1, int y1, u32 color)
|
||||||
{
|
{
|
||||||
int dx = abs(x1 - x0), sx = x0 < x1 ? 1 : -1;
|
int dx = abs(x1 - x0), sx = x0 < x1 ? 1 : -1;
|
||||||
|
|
|
@ -71,6 +71,7 @@ void gfx_puts_limit(const char *s, u32 limit);
|
||||||
void gfx_puts_small(const char *s);
|
void gfx_puts_small(const char *s);
|
||||||
|
|
||||||
void gfx_set_pixel(u32 x, u32 y, u32 color);
|
void gfx_set_pixel(u32 x, u32 y, u32 color);
|
||||||
|
void gfx_set_pixel_horz(int x, int y, u32 color);
|
||||||
void gfx_line(int x0, int y0, int x1, int y1, u32 color);
|
void gfx_line(int x0, int y0, int x1, int y1, u32 color);
|
||||||
void gfx_put_small_sep();
|
void gfx_put_small_sep();
|
||||||
void gfx_put_big_sep();
|
void gfx_put_big_sep();
|
||||||
|
|
|
@ -70,6 +70,13 @@ scriptFunction(funcMakeByteArray){
|
||||||
return newVar(ByteArrayType, 1, .vectorType = v);
|
return newVar(ByteArrayType, 1, .vectorType = v);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
scriptFunction(funcSetPixel){
|
||||||
|
u32 color = 0xFF000000 | ((vars[2].integerType & 0xFF) << 16) | ((vars[3].integerType & 0xFF) << 8) | (vars[4].integerType & 0xFF);
|
||||||
|
gfx_set_pixel_horz(vars[0].integerType, vars[1].integerType, color);
|
||||||
|
return NullVar;
|
||||||
|
}
|
||||||
|
|
||||||
|
u8 fiveInts[] = {IntType, IntType, IntType, IntType, IntType};
|
||||||
u8 singleIntArray[] = { IntArrayType };
|
u8 singleIntArray[] = { IntArrayType };
|
||||||
u8 singleInt[] = { IntType };
|
u8 singleInt[] = { IntType };
|
||||||
u8 singleAny[] = { varArgs };
|
u8 singleAny[] = { varArgs };
|
||||||
|
@ -82,6 +89,7 @@ functionStruct_t scriptFunctions[] = {
|
||||||
{"else", funcElse, 0, NULL},
|
{"else", funcElse, 0, NULL},
|
||||||
{"len", funcLen, 1, singleAny},
|
{"len", funcLen, 1, singleAny},
|
||||||
{"byte", funcMakeByteArray, 1, singleIntArray},
|
{"byte", funcMakeByteArray, 1, singleIntArray},
|
||||||
|
{"setPixel", funcSetPixel, 5, fiveInts},
|
||||||
};
|
};
|
||||||
|
|
||||||
Variable_t executeFunction(scriptCtx_t* ctx, char* func_name, lexarToken_t *start, u32 len) {
|
Variable_t executeFunction(scriptCtx_t* ctx, char* func_name, lexarToken_t *start, u32 len) {
|
||||||
|
|
Loading…
Reference in a new issue