mirror of
https://github.com/ctruLua/ctruLua.git
synced 2025-10-27 16:39:29 +00:00
Updated sf2dlib, added a "thickness" argument to lines (warning: break some old lines), Added WIP render targets, Added arguments (main file and root path)
You'll need to update some of your codes if you used lines with colors, or you'll have some ... Nice line effects.
This commit is contained in:
parent
694159f444
commit
5107f0277c
12 changed files with 477 additions and 41 deletions
|
|
@ -1,3 +1,5 @@
|
|||
#include <unistd.h>
|
||||
|
||||
#include <3ds.h>
|
||||
|
||||
#include <lua.h>
|
||||
|
|
@ -32,7 +34,32 @@ void error(const char *error) {
|
|||
}
|
||||
|
||||
// Main loop
|
||||
int main() {
|
||||
int main(int argc, char** argv) {
|
||||
// Default arguments
|
||||
char* mainFile = "main.lua";
|
||||
|
||||
// Parse arguments
|
||||
for (int i=0;i<argc;i++) {
|
||||
if (argv[i][0] == '-') {
|
||||
switch(argv[i][1]) {
|
||||
case 'm': { // main file replacement
|
||||
mainFile = &argv[i][2];
|
||||
if (argv[i][2] == ' ') mainFile = &argv[i][3];
|
||||
break;
|
||||
}
|
||||
|
||||
case 'r': { // root directory replacement
|
||||
char* root;
|
||||
root = &argv[i][2];
|
||||
if (argv[i][2] == ' ') root = &argv[i][3];
|
||||
if (chdir(root)) error("No such root path");
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Init Lua
|
||||
lua_State *L = luaL_newstate();
|
||||
if (L == NULL) {
|
||||
|
|
@ -43,15 +70,16 @@ int main() {
|
|||
// Load libs
|
||||
luaL_openlibs(L);
|
||||
load_ctr_lib(L);
|
||||
isGfxInitialized = true;
|
||||
|
||||
// Do the actual thing
|
||||
if (luaL_dofile(L, "main.lua")) error(luaL_checkstring(L, -1));
|
||||
if (luaL_dofile(L, mainFile)) error(luaL_checkstring(L, -1));
|
||||
|
||||
// Unload libs
|
||||
unload_ctr_lib(L);
|
||||
|
||||
|
||||
// Unload Lua
|
||||
lua_close(L);
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue