From 00fc3347640d41fa348221e15e70627746f66743 Mon Sep 17 00:00:00 2001 From: suchmememanyskill Date: Tue, 13 Jul 2021 16:30:34 +0200 Subject: [PATCH] implement the most important function --- source/script/standardLibrary.c | 11 +++++++++++ source/script/vector.c | 3 --- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/source/script/standardLibrary.c b/source/script/standardLibrary.c index 56d3818..f8d7672 100644 --- a/source/script/standardLibrary.c +++ b/source/script/standardLibrary.c @@ -111,6 +111,11 @@ ClassFunction(stdMountSave){ var.save = save; return copyVariableToPtr(var); } +ClassFunction(stdSetPixel) { + u32 color = getIntValue(args[2]); + gfx_set_pixel_horz(args[0]->integer.value, args[1]->integer.value, color); + return &emptyClass; +} #else ClassFunction(stdMountSysmmc){ return newIntVariablePtr(0); @@ -118,6 +123,9 @@ ClassFunction(stdMountSysmmc){ ClassFunction(stdMountSave){ return newIntVariablePtr(0); } +ClassFunction(stdSetPixel) { + return newIntVariablePtr(0); +} #endif enum standardFunctionIndexes { @@ -129,11 +137,13 @@ enum standardFunctionIndexes { STD_EXIT, STD_BREAK, STD_DICT, + STD_SETPIXEL, }; u8 oneIntoneFunction[] = { IntClass, FunctionClass }; u8 doubleFunctionClass[] = { FunctionClass, FunctionClass }; u8 oneStringArgStd[] = {StringClass}; +u8 threeIntsStd[] = { IntClass, IntClass, IntClass }; ClassFunctionTableEntry_t standardFunctionDefenitions[] = { [STD_IF] = {"if", stdIf, 2, oneIntoneFunction}, @@ -144,6 +154,7 @@ ClassFunctionTableEntry_t standardFunctionDefenitions[] = { [STD_EXIT] = {"exit", stdExit, 0, 0}, [STD_BREAK] = {"break", stdBreak, 0, 0}, [STD_DICT] = {"dict", stdDict, 0, 0}, + [STD_SETPIXEL] = {"setpixel", stdSetPixel, 3, threeIntsStd}, }; ClassFunctionTableEntry_t* searchStdLib(char* funcName) { diff --git a/source/script/vector.c b/source/script/vector.c index b1a09ab..01e833e 100644 --- a/source/script/vector.c +++ b/source/script/vector.c @@ -50,9 +50,6 @@ int vecAddElem(Vector_t* v, void* elem, u8 sz) { u32 usedbytes = v->count * sz; if (usedbytes >= v->capacity) { - if (v->capacity > 5000) { - printf("uhhhh"); - } v->capacity *= 2; void* buff = malloc(v->capacity); if (!buff)