aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/3rdparty/cembed/cembed.c10
-rw-r--r--src/libjin-lua/embed/ai.lua.h9
-rw-r--r--src/libjin-lua/embed/boot.lua.h209
-rw-r--r--src/libjin-lua/embed/embed.h19
-rw-r--r--src/libjin-lua/embed/graphics.lua.h131
-rw-r--r--src/libjin-lua/embed/keyboard.lua.h15
-rw-r--r--src/libjin-lua/embed/mouse.lua.h14
-rw-r--r--src/libjin-lua/embed/net.lua.h6
-rw-r--r--src/libjin-lua/embed/path.lua.h16
-rw-r--r--src/libjin-lua/embed/scripts/ai.lua19
-rw-r--r--src/libjin-lua/embed/scripts/ai.lua.h26
-rw-r--r--src/libjin-lua/embed/scripts/boot.lua5
-rw-r--r--src/libjin-lua/embed/scripts/boot.lua.h139
-rw-r--r--src/libjin-lua/embed/scripts/graphics.lua5
-rw-r--r--src/libjin-lua/embed/scripts/graphics.lua.h139
-rw-r--r--src/libjin-lua/embed/scripts/keyboard.lua3
-rw-r--r--src/libjin-lua/embed/scripts/keyboard.lua.h17
-rw-r--r--src/libjin-lua/embed/scripts/mouse.lua4
-rw-r--r--src/libjin-lua/embed/scripts/mouse.lua.h16
-rw-r--r--src/libjin-lua/embed/scripts/net.lua5
-rw-r--r--src/libjin-lua/embed/scripts/net.lua.h7
-rw-r--r--src/libjin-lua/embed/scripts/path.lua5
-rw-r--r--src/libjin-lua/embed/scripts/path.lua.h16
23 files changed, 427 insertions, 408 deletions
diff --git a/src/3rdparty/cembed/cembed.c b/src/3rdparty/cembed/cembed.c
index 0488b67..f64d084 100644
--- a/src/3rdparty/cembed/cembed.c
+++ b/src/3rdparty/cembed/cembed.c
@@ -118,7 +118,15 @@ static void write_embedded(FILE *fp, const char *filename,
if (strlen(filename) >= sizeof(varname)) {
error("filename too long");
}
- safename(varname, filename);
+
+ // only filename, without directory
+ const char name[256];
+ memset(name, 0, sizeof(name));
+ int st = strlen(filename) - 1;
+ for (; st >= 0 && filename[st] != '\\' && filename[st] != '/' ; --st);
+ strcpy(name, filename + st + 1);
+
+ safename(varname, name);
if (!nostatic) { fprintf(fp, "static "); }
fprintf(fp, "unsigned char %s%s[] = {", varprefix, varname);
diff --git a/src/libjin-lua/embed/ai.lua.h b/src/libjin-lua/embed/ai.lua.h
new file mode 100644
index 0000000..112706e
--- /dev/null
+++ b/src/libjin-lua/embed/ai.lua.h
@@ -0,0 +1,9 @@
+static unsigned char ai_lua[] = {
+13,10,106,105,110,46,97,105,32,61,32,106,105,110,46,97,105,32,111,114,
+32,123,125,32,13,10,13,10,108,111,99,97,108,32,106,97,32,61,32,106,
+105,110,46,97,105,13,10,13,10,106,97,46,83,116,97,116,101,77,97,99,
+104,105,110,101,84,121,112,101,32,61,32,123,13,10,32,32,32,32,83,84,
+69,80,87,73,83,69,32,61,32,49,44,32,13,10,32,32,32,32,73,84,
+69,82,65,84,73,86,69,32,61,32,50,44,13,10,125,13,10
+};
+
diff --git a/src/libjin-lua/embed/boot.lua.h b/src/libjin-lua/embed/boot.lua.h
new file mode 100644
index 0000000..51f1044
--- /dev/null
+++ b/src/libjin-lua/embed/boot.lua.h
@@ -0,0 +1,209 @@
+static unsigned char boot_lua[] = {
+13,10,108,111,99,97,108,32,99,119,100,32,61,32,106,105,110,46,97,114,
+103,115,91,39,99,119,100,39,93,32,111,114,32,39,46,39,13,10,106,105,
+110,46,102,105,108,101,115,121,115,116,101,109,46,105,110,105,116,40,41,13,
+10,106,105,110,46,102,105,108,101,115,121,115,116,101,109,46,109,111,117,110,
+116,40,99,119,100,41,13,10,13,10,45,45,45,45,45,45,45,45,45,45,
+45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,
+45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,
+45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,
+45,45,45,13,10,45,45,32,67,111,110,102,105,103,32,103,97,109,101,13,
+10,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,
+45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,
+45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,
+45,45,45,45,45,45,45,45,45,45,45,45,45,45,13,10,13,10,106,105,
+110,46,99,111,110,102,105,103,32,32,61,32,123,125,32,13,10,105,102,32,
+106,105,110,46,102,105,108,101,115,121,115,116,101,109,46,101,120,105,115,116,
+40,34,99,111,110,102,105,103,46,108,117,97,34,41,32,116,104,101,110,32,
+13,10,32,32,32,32,120,112,99,97,108,108,40,102,117,110,99,116,105,111,
+110,40,41,106,105,110,46,99,111,110,102,105,103,32,61,32,114,101,113,117,
+105,114,101,32,34,99,111,110,102,105,103,34,32,101,110,100,44,32,102,117,
+110,99,116,105,111,110,40,41,101,110,100,41,32,32,32,32,13,10,101,110,
+100,13,10,106,105,110,46,99,111,110,102,105,103,46,119,105,100,116,104,32,
+32,32,32,32,32,61,32,106,105,110,46,99,111,110,102,105,103,46,119,105,
+100,116,104,32,32,32,32,32,32,111,114,32,53,56,48,32,13,10,106,105,
+110,46,99,111,110,102,105,103,46,104,101,105,103,104,116,32,32,32,32,32,
+61,32,106,105,110,46,99,111,110,102,105,103,46,104,101,105,103,104,116,32,
+32,32,32,32,111,114,32,52,53,48,32,13,10,106,105,110,46,99,111,110,
+102,105,103,46,118,115,121,110,99,32,32,32,32,32,32,61,32,106,105,110,
+46,99,111,110,102,105,103,46,118,115,121,110,99,32,32,32,32,32,32,111,
+114,32,116,114,117,101,13,10,106,105,110,46,99,111,110,102,105,103,46,116,
+105,116,108,101,32,32,32,32,32,32,61,32,106,105,110,46,99,111,110,102,
+105,103,46,116,105,116,108,101,32,32,32,32,32,32,111,114,32,40,34,106,
+105,110,32,118,34,32,46,46,32,106,105,110,46,118,101,114,115,105,111,110,
+41,13,10,106,105,110,46,99,111,110,102,105,103,46,114,101,115,105,122,97,
+98,108,101,32,32,61,32,106,105,110,46,99,111,110,102,105,103,46,114,101,
+115,105,122,97,98,108,101,32,32,111,114,32,102,97,108,115,101,32,13,10,
+106,105,110,46,99,111,110,102,105,103,46,102,117,108,108,115,99,114,101,101,
+110,32,61,32,106,105,110,46,99,111,110,102,105,103,46,102,117,108,108,115,
+99,114,101,101,110,32,111,114,32,102,97,108,115,101,13,10,106,105,110,46,
+99,111,110,102,105,103,46,102,112,115,32,32,32,32,32,32,32,32,32,32,
+61,32,106,105,110,46,99,111,110,102,105,103,46,102,112,115,32,32,32,32,
+32,32,32,32,32,32,111,114,32,54,48,13,10,106,105,110,46,99,111,110,
+102,105,103,46,105,99,111,110,32,32,32,32,32,32,32,61,32,106,105,110,
+46,99,111,110,102,105,103,46,105,99,111,110,32,32,32,32,32,32,32,111,
+114,32,34,34,13,10,13,10,45,45,45,45,45,45,45,45,45,45,45,45,
+45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,
+45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,
+45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,
+45,13,10,45,45,32,68,101,102,97,117,108,116,32,103,97,109,101,32,108,
+111,111,112,13,10,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,
+45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,
+45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,
+45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,13,10,
+13,10,108,111,99,97,108,32,102,117,110,99,116,105,111,110,32,99,97,108,
+108,40,102,117,110,99,44,32,46,46,46,41,13,10,32,32,32,32,105,102,
+32,102,117,110,99,32,116,104,101,110,32,13,10,32,32,32,32,32,32,32,
+32,114,101,116,117,114,110,32,102,117,110,99,40,46,46,46,41,13,10,32,
+32,32,32,101,110,100,13,10,101,110,100,13,10,13,10,108,111,99,97,108,
+32,115,116,101,112,32,61,32,106,105,110,46,116,105,109,101,46,115,116,101,
+112,13,10,106,105,110,46,116,105,109,101,46,115,116,101,112,32,61,32,110,
+105,108,13,10,13,10,102,117,110,99,116,105,111,110,32,106,105,110,46,99,
+111,114,101,46,114,117,110,40,41,13,10,32,32,32,32,106,105,110,46,103,
+114,97,112,104,105,99,115,46,114,101,115,101,116,40,41,13,10,32,32,32,
+32,99,97,108,108,40,106,105,110,46,99,111,114,101,46,111,110,76,111,97,
+100,41,13,10,32,32,32,32,108,111,99,97,108,32,100,116,32,61,32,48,
+13,10,32,32,32,32,119,104,105,108,101,32,106,105,110,46,99,111,114,101,
+46,114,117,110,110,105,110,103,40,41,32,100,111,13,10,32,32,32,32,32,
+32,32,32,102,111,114,32,95,44,32,101,32,105,110,32,112,97,105,114,115,
+40,106,105,110,46,101,118,101,110,116,46,112,111,108,108,40,41,41,32,100,
+111,32,13,10,32,32,32,32,32,32,32,32,32,32,32,32,105,102,32,101,
+46,116,121,112,101,32,61,61,32,34,75,101,121,68,111,119,110,34,32,116,
+104,101,110,32,13,10,32,32,32,32,32,32,32,32,32,32,32,32,32,32,
+32,32,106,105,110,46,107,101,121,98,111,97,114,100,46,115,101,116,40,101,
+46,107,101,121,44,32,116,114,117,101,41,32,13,10,32,32,32,32,32,32,
+32,32,32,32,32,32,101,108,115,101,105,102,32,101,46,116,121,112,101,32,
+61,61,32,34,75,101,121,85,112,34,32,116,104,101,110,32,13,10,32,32,
+32,32,32,32,32,32,32,32,32,32,32,32,32,32,106,105,110,46,107,101,
+121,98,111,97,114,100,46,115,101,116,40,101,46,107,101,121,44,32,102,97,
+108,115,101,41,13,10,32,32,32,32,32,32,32,32,32,32,32,32,101,110,
+100,13,10,32,32,32,32,32,32,32,32,32,32,32,32,99,97,108,108,40,
+106,105,110,46,99,111,114,101,46,111,110,69,118,101,110,116,44,32,101,41,
+13,10,32,32,32,32,32,32,32,32,101,110,100,13,10,32,32,32,32,32,
+32,32,32,115,116,101,112,40,41,13,10,32,32,32,32,32,32,32,32,100,
+116,32,61,32,106,105,110,46,116,105,109,101,46,103,101,116,68,101,108,116,
+97,40,41,13,10,32,32,32,32,32,32,32,32,99,97,108,108,40,106,105,
+110,46,99,111,114,101,46,111,110,85,112,100,97,116,101,44,32,100,116,41,
+13,10,32,32,32,32,32,32,32,32,106,105,110,46,103,114,97,112,104,105,
+99,115,46,99,108,101,97,114,40,41,32,32,32,32,32,32,32,32,13,10,
+32,32,32,32,32,32,32,32,99,97,108,108,40,106,105,110,46,99,111,114,
+101,46,111,110,68,114,97,119,41,13,10,32,32,32,32,32,32,32,32,106,
+105,110,46,103,114,97,112,104,105,99,115,46,112,114,101,115,101,110,116,40,
+41,13,10,32,32,32,32,32,32,32,32,106,105,110,46,116,105,109,101,46,
+115,108,101,101,112,40,48,46,48,48,49,41,13,10,32,32,32,32,101,110,
+100,13,10,101,110,100,13,10,13,10,45,45,45,45,45,45,45,45,45,45,
+45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,
+45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,
+45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,
+45,45,45,13,10,45,45,32,66,111,111,116,32,103,97,109,101,13,10,45,
+45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,
+45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,
+45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,
+45,45,45,45,45,45,45,45,45,45,45,45,13,10,13,10,45,45,32,68,
+105,115,112,108,97,121,32,101,114,114,111,114,32,109,101,115,115,97,103,101,
+46,13,10,108,111,99,97,108,32,102,117,110,99,116,105,111,110,32,111,110,
+69,114,114,111,114,40,109,115,103,41,32,13,10,32,32,32,32,106,105,110,
+46,97,117,100,105,111,46,100,101,115,116,114,111,121,40,41,13,10,32,32,
+32,32,106,105,110,46,103,114,97,112,104,105,99,115,46,115,104,111,119,87,
+105,110,100,111,119,40,41,13,10,32,32,32,32,108,111,99,97,108,32,101,
+114,114,32,61,32,34,69,114,114,111,114,58,92,110,34,32,46,46,32,109,
+115,103,32,46,46,32,34,92,110,34,32,46,46,32,100,101,98,117,103,46,
+116,114,97,99,101,98,97,99,107,40,41,13,10,32,32,32,32,106,105,110,
+46,103,114,97,112,104,105,99,115,46,114,101,115,101,116,40,41,13,10,32,
+32,32,32,106,105,110,46,103,114,97,112,104,105,99,115,46,115,101,116,67,
+108,101,97,114,67,111,108,111,114,40,49,48,48,44,32,49,48,48,44,32,
+49,48,48,44,32,50,53,53,41,13,10,32,32,32,32,106,105,110,46,103,
+114,97,112,104,105,99,115,46,99,108,101,97,114,40,41,13,10,32,32,32,
+32,106,105,110,46,103,114,97,112,104,105,99,115,46,112,114,105,110,116,40,
+101,114,114,44,32,53,44,32,53,41,13,10,32,32,32,32,106,105,110,46,
+103,114,97,112,104,105,99,115,46,112,114,101,115,101,110,116,40,41,13,10,
+32,32,32,32,119,104,105,108,101,32,106,105,110,46,99,111,114,101,46,114,
+117,110,110,105,110,103,40,41,32,100,111,32,13,10,32,32,32,32,32,32,
+32,32,102,111,114,32,95,44,32,101,32,105,110,32,112,97,105,114,115,40,
+106,105,110,46,101,118,101,110,116,46,112,111,108,108,40,41,41,32,100,111,
+32,13,10,32,32,32,32,32,32,32,32,32,32,32,32,105,102,32,101,46,
+116,121,112,101,32,61,61,32,34,81,117,105,116,34,32,116,104,101,110,32,
+13,10,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,106,105,
+110,46,99,111,114,101,46,115,116,111,112,40,41,13,10,32,32,32,32,32,
+32,32,32,32,32,32,32,101,110,100,13,10,32,32,32,32,32,32,32,32,
+101,110,100,13,10,32,32,32,32,32,32,32,32,106,105,110,46,116,105,109,
+101,46,115,108,101,101,112,40,48,46,48,48,49,41,13,10,32,32,32,32,
+101,110,100,13,10,101,110,100,13,10,13,10,45,45,32,78,111,32,103,97,
+109,101,32,115,99,114,101,101,110,46,13,10,108,111,99,97,108,32,102,117,
+110,99,116,105,111,110,32,110,111,71,97,109,101,40,41,13,10,32,32,32,
+32,106,105,110,46,103,114,97,112,104,105,99,115,46,115,104,111,119,87,105,
+110,100,111,119,40,41,13,10,32,32,32,32,106,105,110,46,103,114,97,112,
+104,105,99,115,46,114,101,115,101,116,40,41,13,10,32,32,32,32,106,105,
+110,46,103,114,97,112,104,105,99,115,46,115,101,116,67,108,101,97,114,67,
+111,108,111,114,40,49,48,48,44,32,49,48,48,44,32,49,48,48,44,32,
+50,53,53,41,13,10,32,32,32,32,106,105,110,46,103,114,97,112,104,105,
+99,115,46,99,108,101,97,114,40,41,13,10,32,32,32,32,106,105,110,46,
+103,114,97,112,104,105,99,115,46,112,114,105,110,116,40,34,78,111,32,71,
+97,109,101,34,44,32,53,44,32,53,41,32,13,10,32,32,32,32,106,105,
+110,46,103,114,97,112,104,105,99,115,46,112,114,101,115,101,110,116,40,41,
+13,10,32,32,32,32,119,104,105,108,101,32,106,105,110,46,99,111,114,101,
+46,114,117,110,110,105,110,103,40,41,32,100,111,32,13,10,32,32,32,32,
+32,32,32,32,102,111,114,32,95,44,32,101,32,105,110,32,112,97,105,114,
+115,40,106,105,110,46,101,118,101,110,116,46,112,111,108,108,40,41,41,32,
+100,111,32,13,10,32,32,32,32,32,32,32,32,32,32,32,32,105,102,32,
+101,46,116,121,112,101,32,61,61,32,34,81,117,105,116,34,32,116,104,101,
+110,32,13,10,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,
+106,105,110,46,99,111,114,101,46,115,116,111,112,40,41,13,10,32,32,32,
+32,32,32,32,32,32,32,32,32,101,110,100,13,10,32,32,32,32,32,32,
+32,32,101,110,100,13,10,32,32,32,32,32,32,32,32,106,105,110,46,116,
+105,109,101,46,115,108,101,101,112,40,48,46,48,48,49,41,13,10,32,32,
+32,32,101,110,100,13,10,101,110,100,13,10,13,10,108,111,99,97,108,32,
+102,117,110,99,116,105,111,110,32,98,111,111,116,40,41,32,13,10,32,32,
+32,32,105,102,32,106,105,110,46,102,105,108,101,115,121,115,116,101,109,46,
+101,120,105,115,116,40,34,109,97,105,110,46,108,117,97,34,41,32,116,104,
+101,110,32,13,10,32,32,32,32,32,32,32,32,99,97,108,108,40,102,117,
+110,99,116,105,111,110,40,41,32,13,10,32,32,32,32,32,32,32,32,32,
+32,32,32,114,101,113,117,105,114,101,34,109,97,105,110,34,32,13,10,32,
+32,32,32,32,32,32,32,32,32,32,32,106,105,110,46,99,111,114,101,46,
+114,117,110,40,41,13,10,32,32,32,32,32,32,32,32,101,110,100,41,13,
+10,32,32,32,32,101,108,115,101,13,10,32,32,32,32,32,32,32,32,110,
+111,71,97,109,101,40,41,13,10,32,32,32,32,101,110,100,13,10,101,110,
+100,13,10,13,10,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,
+45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,
+45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,
+45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,13,10,
+45,45,32,73,110,105,116,105,97,108,105,122,101,32,115,117,98,32,115,121,
+115,116,101,109,115,13,10,45,45,45,45,45,45,45,45,45,45,45,45,45,
+45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,
+45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,
+45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,
+13,10,13,10,106,105,110,46,97,117,100,105,111,46,105,110,105,116,40,41,
+13,10,106,105,110,46,103,114,97,112,104,105,99,115,46,105,110,105,116,40,
+106,105,110,46,99,111,110,102,105,103,41,13,10,13,10,45,45,45,45,45,
+45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,
+45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,
+45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,
+45,45,45,45,45,45,45,45,13,10,45,45,32,66,111,111,116,32,103,97,
+109,101,13,10,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,
+45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,
+45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,
+45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,13,10,13,
+10,120,112,99,97,108,108,40,98,111,111,116,44,32,111,110,69,114,114,111,
+114,41,13,10,13,10,45,45,45,45,45,45,45,45,45,45,45,45,45,45,
+45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,
+45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,
+45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,13,
+10,45,45,32,68,101,115,116,114,111,121,32,115,117,98,45,115,121,115,116,
+101,109,115,13,10,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,
+45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,
+45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,
+45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,13,10,
+13,10,106,105,110,46,103,114,97,112,104,105,99,115,46,100,101,115,116,114,
+111,121,40,41,13,10,106,105,110,46,97,117,100,105,111,46,100,101,115,116,
+114,111,121,40,41,13,10,13,10,45,45,45,45,45,45,45,45,45,45,45,
+45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,
+45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,
+45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,
+45,45,13,10,45,45,32,81,117,105,116,32,103,97,109,101,13,10,45,45,
+45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,
+45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,
+45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,
+45,45,45,45,45,45,45,45,45,45,45,13,10,13,10,106,105,110,46,99,
+111,114,101,46,113,117,105,116,40,41,13,10
+};
+
diff --git a/src/libjin-lua/embed/embed.h b/src/libjin-lua/embed/embed.h
index 1928dd5..c1d1ef5 100644
--- a/src/libjin-lua/embed/embed.h
+++ b/src/libjin-lua/embed/embed.h
@@ -10,14 +10,15 @@ namespace JinEngine
// Embed structure.
struct jin_Embed
{
- const char* file, *source;
+ const char* file;
+ const unsigned char* source;
};
// Embed scripts.
- #include "scripts/graphics.lua.h"
- #include "scripts/keyboard.lua.h"
- #include "scripts/mouse.lua.h"
- #include "scripts/boot.lua.h"
+ #include "graphics.lua.h"
+ #include "keyboard.lua.h"
+ #include "mouse.lua.h"
+ #include "boot.lua.h"
// In order.
static const jin_Embed modules[] = {
@@ -31,13 +32,17 @@ namespace JinEngine
static void run(lua_State* L)
{
+ const char* file, *source;
for (int i = 0; modules[i].file; ++i)
{
- const char* file = modules[i].file, *source = modules[i].source;
+ file = (const char*)modules[i].file;
+ source = (const char*)modules[i].source;
if (luax_loadbuffer(L, source, strlen(source), file) == 0)
luax_call(L, 0, 0);
}
- if (luax_loadbuffer(L, bootscript.source, strlen(bootscript.source), bootscript.file) == 0)
+ file = (const char*)bootscript.source;
+ source = (const char*)bootscript.source;
+ if (luax_loadbuffer(L, source, strlen(source), file) == 0)
luax_call(L, 0, 0);
}
diff --git a/src/libjin-lua/embed/graphics.lua.h b/src/libjin-lua/embed/graphics.lua.h
new file mode 100644
index 0000000..e5b5c2f
--- /dev/null
+++ b/src/libjin-lua/embed/graphics.lua.h
@@ -0,0 +1,131 @@
+static unsigned char graphics_lua[] = {
+13,10,106,105,110,46,103,114,97,112,104,105,99,115,32,61,32,106,105,110,
+46,103,114,97,112,104,105,99,115,32,111,114,32,123,125,32,13,10,13,10,
+108,111,99,97,108,32,106,103,32,61,32,106,105,110,46,103,114,97,112,104,
+105,99,115,13,10,13,10,106,103,46,82,101,110,100,101,114,77,111,100,101,
+32,61,32,123,13,10,32,32,32,32,70,73,76,76,32,61,32,49,44,32,
+13,10,32,32,32,32,76,73,78,69,32,61,32,50,44,13,10,125,13,10,
+13,10,106,103,46,83,112,114,105,116,101,79,114,105,103,105,110,32,61,32,
+123,13,10,32,32,32,32,84,79,80,76,69,70,84,32,61,32,48,44,13,
+10,32,32,32,32,84,79,80,67,69,78,84,69,82,32,61,32,49,44,13,
+10,32,32,32,32,84,79,80,82,73,71,72,84,32,61,32,50,44,13,10,
+32,32,32,32,77,73,68,68,76,69,76,69,70,84,32,61,32,51,44,13,
+10,32,32,32,32,77,73,68,68,76,69,67,69,78,84,69,82,32,61,32,
+52,44,13,10,32,32,32,32,77,73,68,68,76,69,82,73,71,72,84,32,
+61,32,53,44,13,10,32,32,32,32,66,79,84,84,79,77,76,69,70,84,
+32,61,32,54,44,13,10,32,32,32,32,66,79,84,84,79,77,67,69,78,
+84,69,82,32,61,32,55,44,13,10,32,32,32,32,66,79,84,84,79,77,
+82,73,71,72,84,32,61,32,56,13,10,125,13,10,13,10,106,103,46,83,
+112,114,105,116,101,77,111,100,101,32,61,32,123,13,10,32,32,32,32,83,
+73,78,71,76,69,32,61,32,49,44,13,10,32,32,32,32,82,65,78,68,
+79,77,32,61,32,50,44,13,10,32,32,32,32,65,78,73,77,65,84,69,
+68,32,61,32,51,13,10,125,13,10,13,10,45,45,32,98,117,105,108,116,
+32,105,110,32,115,104,97,100,101,114,115,13,10,106,103,46,83,104,97,100,
+101,114,115,32,61,32,123,13,10,9,70,111,110,116,32,61,32,110,105,108,
+44,32,13,10,9,84,101,120,116,117,114,101,32,61,32,110,105,108,44,32,
+13,10,9,83,112,114,105,116,101,32,61,32,110,105,108,44,32,13,10,9,
+83,112,114,105,116,101,83,104,101,101,116,32,61,32,110,105,108,44,13,10,
+9,68,101,102,97,117,108,116,32,61,32,110,105,108,13,10,125,13,10,13,
+10,108,111,99,97,108,32,102,117,110,99,116,105,111,110,32,99,111,109,112,
+105,108,101,66,117,105,108,116,73,110,83,104,97,100,101,114,115,40,41,32,
+13,10,9,106,103,46,83,104,97,100,101,114,115,46,70,111,110,116,32,61,
+32,106,103,46,110,101,119,83,104,97,100,101,114,40,91,91,13,10,9,9,
+35,86,69,82,84,69,88,95,83,72,65,68,69,82,13,10,9,9,86,101,
+114,116,101,120,32,118,101,114,116,40,86,101,114,116,101,120,32,118,41,13,
+10,9,9,123,13,10,9,9,9,114,101,116,117,114,110,32,118,59,13,10,
+9,9,125,13,10,9,9,35,69,78,68,95,86,69,82,84,69,88,95,83,
+72,65,68,69,82,13,10,9,9,35,70,82,65,71,77,69,78,84,95,83,
+72,65,68,69,82,13,10,9,9,67,111,108,111,114,32,102,114,97,103,40,
+67,111,108,111,114,32,99,111,108,44,32,84,101,120,116,117,114,101,32,116,
+101,120,44,32,86,101,114,116,101,120,32,118,41,13,10,9,9,123,13,10,
+9,9,9,114,101,116,117,114,110,32,67,111,108,111,114,40,99,111,108,46,
+114,103,98,44,32,116,101,120,101,108,40,116,101,120,44,32,118,46,117,118,
+41,46,97,41,59,13,10,9,9,125,13,10,9,9,35,69,78,68,95,70,
+82,65,71,77,69,78,84,95,83,72,65,68,69,82,13,10,9,93,93,41,
+13,10,9,106,103,46,83,104,97,100,101,114,115,46,84,101,120,116,117,114,
+101,32,61,32,106,103,46,110,101,119,83,104,97,100,101,114,40,91,91,13,
+10,9,9,35,86,69,82,84,69,88,95,83,72,65,68,69,82,13,10,9,
+9,86,101,114,116,101,120,32,118,101,114,116,40,86,101,114,116,101,120,32,
+118,41,13,10,9,9,123,13,10,9,9,9,114,101,116,117,114,110,32,118,
+59,13,10,9,9,125,13,10,9,9,35,69,78,68,95,86,69,82,84,69,
+88,95,83,72,65,68,69,82,13,10,9,9,35,70,82,65,71,77,69,78,
+84,95,83,72,65,68,69,82,13,10,9,9,67,111,108,111,114,32,102,114,
+97,103,40,67,111,108,111,114,32,99,111,108,44,32,84,101,120,116,117,114,
+101,32,116,101,120,44,32,86,101,114,116,101,120,32,118,41,13,10,9,9,
+123,13,10,9,9,9,114,101,116,117,114,110,32,99,111,108,32,42,32,116,
+101,120,101,108,40,116,101,120,44,32,118,46,117,118,41,59,13,10,9,9,
+125,13,10,9,9,35,69,78,68,95,70,82,65,71,77,69,78,84,95,83,
+72,65,68,69,82,13,10,9,93,93,41,13,10,9,106,103,46,83,104,97,
+100,101,114,115,46,83,112,114,105,116,101,32,61,32,106,103,46,110,101,119,
+83,104,97,100,101,114,40,91,91,13,10,9,9,35,86,69,82,84,69,88,
+95,83,72,65,68,69,82,13,10,9,9,86,101,114,116,101,120,32,118,101,
+114,116,40,86,101,114,116,101,120,32,118,41,13,10,9,9,123,13,10,9,
+9,9,114,101,116,117,114,110,32,118,59,13,10,9,9,125,13,10,9,9,
+35,69,78,68,95,86,69,82,84,69,88,95,83,72,65,68,69,82,13,10,
+9,9,35,70,82,65,71,77,69,78,84,95,83,72,65,68,69,82,13,10,
+9,9,67,111,108,111,114,32,102,114,97,103,40,67,111,108,111,114,32,99,
+111,108,44,32,84,101,120,116,117,114,101,32,116,101,120,44,32,86,101,114,
+116,101,120,32,118,41,13,10,9,9,123,13,10,9,9,9,114,101,116,117,
+114,110,32,99,111,108,32,42,32,116,101,120,101,108,40,116,101,120,44,32,
+118,46,117,118,41,59,13,10,9,9,125,13,10,9,9,35,69,78,68,95,
+70,82,65,71,77,69,78,84,95,83,72,65,68,69,82,13,10,9,93,93,
+41,13,10,9,106,103,46,83,104,97,100,101,114,115,46,83,112,114,105,116,
+101,83,104,101,101,116,32,61,32,106,103,46,110,101,119,83,104,97,100,101,
+114,40,91,91,13,10,9,9,35,86,69,82,84,69,88,95,83,72,65,68,
+69,82,13,10,9,9,86,101,114,116,101,120,32,118,101,114,116,40,86,101,
+114,116,101,120,32,118,41,13,10,9,9,123,13,10,9,9,9,114,101,116,
+117,114,110,32,118,59,13,10,9,9,125,13,10,9,9,35,69,78,68,95,
+86,69,82,84,69,88,95,83,72,65,68,69,82,13,10,9,9,35,70,82,
+65,71,77,69,78,84,95,83,72,65,68,69,82,13,10,9,9,67,111,108,
+111,114,32,102,114,97,103,40,67,111,108,111,114,32,99,111,108,44,32,84,
+101,120,116,117,114,101,32,116,101,120,44,32,86,101,114,116,101,120,32,118,
+41,13,10,9,9,123,13,10,9,9,9,114,101,116,117,114,110,32,99,111,
+108,32,42,32,116,101,120,101,108,40,116,101,120,44,32,118,46,117,118,41,
+59,13,10,9,9,125,13,10,9,9,35,69,78,68,95,70,82,65,71,77,
+69,78,84,95,83,72,65,68,69,82,13,10,9,93,93,41,13,10,9,106,
+103,46,83,104,97,100,101,114,115,46,68,101,102,97,117,108,116,32,61,32,
+106,103,46,110,101,119,83,104,97,100,101,114,40,91,91,13,10,9,9,35,
+86,69,82,84,69,88,95,83,72,65,68,69,82,13,10,9,9,86,101,114,
+116,101,120,32,118,101,114,116,40,86,101,114,116,101,120,32,118,41,13,10,
+9,9,123,13,10,9,9,9,114,101,116,117,114,110,32,118,59,13,10,9,
+9,125,13,10,9,9,35,69,78,68,95,86,69,82,84,69,88,95,83,72,
+65,68,69,82,13,10,9,9,35,70,82,65,71,77,69,78,84,95,83,72,
+65,68,69,82,13,10,9,9,67,111,108,111,114,32,102,114,97,103,40,67,
+111,108,111,114,32,99,111,108,44,32,84,101,120,116,117,114,101,32,116,101,
+120,44,32,86,101,114,116,101,120,32,118,41,13,10,9,9,123,13,10,9,
+9,9,114,101,116,117,114,110,32,99,111,108,32,42,32,116,101,120,101,108,
+40,116,101,120,44,32,118,46,117,118,41,59,13,10,9,9,125,13,10,9,
+9,35,69,78,68,95,70,82,65,71,77,69,78,84,95,83,72,65,68,69,
+82,13,10,9,93,93,41,13,10,101,110,100,13,10,13,10,108,111,99,97,
+108,32,95,105,110,105,116,32,61,32,106,103,46,105,110,105,116,13,10,108,
+111,99,97,108,32,105,110,105,116,105,97,108,105,122,101,100,32,61,32,102,
+97,108,115,101,13,10,106,103,46,105,110,105,116,32,61,32,102,117,110,99,
+116,105,111,110,40,115,101,116,116,105,110,103,41,32,13,10,32,32,32,32,
+105,102,32,105,110,105,116,105,97,108,105,122,101,100,32,116,104,101,110,32,
+13,10,32,32,32,32,32,32,32,32,114,101,116,117,114,110,32,105,110,105,
+116,105,97,108,105,122,101,100,13,10,32,32,32,32,101,110,100,13,10,32,
+32,32,32,105,110,105,116,105,97,108,105,122,101,100,32,61,32,95,105,110,
+105,116,40,115,101,116,116,105,110,103,41,13,10,32,32,32,32,105,102,32,
+105,110,105,116,105,97,108,105,122,101,100,32,116,104,101,110,32,13,10,32,
+32,32,32,32,32,32,32,99,111,109,112,105,108,101,66,117,105,108,116,73,
+110,83,104,97,100,101,114,115,40,41,13,10,32,32,32,32,32,32,32,32,
+106,103,46,117,115,101,83,104,97,100,101,114,40,106,103,46,83,104,97,100,
+101,114,115,46,68,101,102,97,117,108,116,41,13,10,32,32,32,32,101,110,
+100,13,10,32,32,32,32,114,101,116,117,114,110,32,105,110,105,116,105,97,
+108,105,122,101,100,32,13,10,101,110,100,13,10,13,10,106,103,46,117,110,
+117,115,101,83,104,97,100,101,114,32,61,32,102,117,110,99,116,105,111,110,
+40,41,13,10,32,32,32,32,106,103,46,117,115,101,83,104,97,100,101,114,
+40,106,103,46,83,104,97,100,101,114,115,46,68,101,102,97,117,108,116,41,
+13,10,101,110,100,13,10,13,10,45,45,32,82,101,115,101,116,32,97,108,
+108,32,97,116,116,114,105,98,117,116,101,115,32,116,111,32,100,101,102,97,
+117,108,116,32,118,97,108,117,101,46,13,10,106,103,46,114,101,115,101,116,
+32,61,32,102,117,110,99,116,105,111,110,40,41,13,10,32,32,32,32,106,
+103,46,115,101,116,67,111,108,111,114,40,50,53,53,44,32,50,53,53,44,
+32,50,53,53,44,32,50,53,53,41,13,10,32,32,32,32,106,103,46,115,
+101,116,67,108,101,97,114,67,111,108,111,114,40,48,44,32,48,44,32,48,
+44,32,50,53,53,41,13,10,32,32,32,32,106,103,46,99,108,101,97,114,
+40,41,13,10,32,32,32,32,106,103,46,117,110,115,101,116,70,111,110,116,
+40,41,13,10,32,32,32,32,106,103,46,117,110,117,115,101,83,104,97,100,
+101,114,40,41,13,10,101,110,100,13,10
+};
+
diff --git a/src/libjin-lua/embed/keyboard.lua.h b/src/libjin-lua/embed/keyboard.lua.h
new file mode 100644
index 0000000..6c0caf0
--- /dev/null
+++ b/src/libjin-lua/embed/keyboard.lua.h
@@ -0,0 +1,15 @@
+static unsigned char keyboard_lua[] = {
+13,10,106,105,110,46,107,101,121,98,111,97,114,100,32,61,32,106,105,110,
+46,107,101,121,98,111,97,114,100,32,111,114,32,123,125,32,13,10,13,10,
+108,111,99,97,108,32,106,107,32,61,32,106,105,110,46,107,101,121,98,111,
+97,114,100,13,10,13,10,108,111,99,97,108,32,107,101,121,115,32,61,32,
+123,125,32,13,10,13,10,102,117,110,99,116,105,111,110,32,106,105,110,46,
+107,101,121,98,111,97,114,100,46,105,115,80,114,101,115,115,101,100,40,107,
+41,32,13,10,32,32,32,32,114,101,116,117,114,110,32,107,101,121,115,91,
+107,93,13,10,101,110,100,32,32,13,10,13,10,102,117,110,99,116,105,111,
+110,32,106,105,110,46,107,101,121,98,111,97,114,100,46,115,101,116,40,107,
+44,32,115,116,97,116,117,115,41,32,13,10,32,32,32,32,107,101,121,115,
+91,107,93,32,61,32,115,116,97,116,117,115,32,13,10,101,110,100,32,13,
+10
+};
+
diff --git a/src/libjin-lua/embed/mouse.lua.h b/src/libjin-lua/embed/mouse.lua.h
new file mode 100644
index 0000000..af720d5
--- /dev/null
+++ b/src/libjin-lua/embed/mouse.lua.h
@@ -0,0 +1,14 @@
+static unsigned char mouse_lua[] = {
+13,10,106,105,110,46,109,111,117,115,101,32,61,32,106,105,110,46,109,111,
+117,115,101,32,111,114,32,123,125,32,13,10,13,10,108,111,99,97,108,32,
+106,109,32,61,32,106,105,110,46,109,111,117,115,101,13,10,13,10,108,111,
+99,97,108,32,98,117,116,116,111,110,32,61,32,123,125,32,13,10,13,10,
+102,117,110,99,116,105,111,110,32,106,105,110,46,109,111,117,115,101,46,105,
+115,68,111,119,110,40,98,116,110,41,32,13,10,32,32,32,32,114,101,116,
+117,114,110,32,98,117,116,116,111,110,91,98,116,110,93,13,10,101,110,100,
+32,13,10,13,10,102,117,110,99,116,105,111,110,32,106,105,110,46,109,111,
+117,115,101,46,115,101,116,40,98,116,110,44,32,115,116,97,116,117,115,41,
+32,13,10,32,32,32,32,98,117,116,116,111,110,91,98,116,110,93,32,61,
+32,115,116,97,116,117,115,13,10,101,110,100,32,13,10
+};
+
diff --git a/src/libjin-lua/embed/net.lua.h b/src/libjin-lua/embed/net.lua.h
new file mode 100644
index 0000000..5953e8d
--- /dev/null
+++ b/src/libjin-lua/embed/net.lua.h
@@ -0,0 +1,6 @@
+static unsigned char net_lua[] = {
+13,10,106,105,110,46,110,101,116,32,61,32,106,105,110,46,110,101,116,32,
+111,114,32,123,125,32,13,10,13,10,108,111,99,97,108,32,106,110,32,61,
+32,106,105,110,46,110,101,116,13,10
+};
+
diff --git a/src/libjin-lua/embed/path.lua.h b/src/libjin-lua/embed/path.lua.h
new file mode 100644
index 0000000..859b35b
--- /dev/null
+++ b/src/libjin-lua/embed/path.lua.h
@@ -0,0 +1,16 @@
+static unsigned char path_lua[] = {
+13,10,106,105,110,46,112,97,116,104,32,61,32,106,105,110,46,112,97,116,
+104,32,111,114,32,123,125,32,13,10,13,10,108,111,99,97,108,32,106,112,
+32,61,32,106,105,110,46,112,97,116,104,13,10,13,10,45,45,32,103,97,
+109,101,32,114,111,111,116,32,100,105,114,101,99,116,111,114,121,32,13,10,
+106,105,110,46,95,114,111,111,116,32,61,32,110,105,108,32,13,10,13,10,
+45,45,32,114,101,116,117,114,110,32,102,117,108,108,32,112,97,116,104,32,
+111,102,32,97,32,103,105,118,101,110,32,112,97,116,104,32,13,10,102,117,
+110,99,116,105,111,110,32,106,105,110,46,112,97,116,104,46,102,117,108,108,
+40,112,97,116,104,41,13,10,32,32,32,32,108,111,99,97,108,32,114,111,
+111,116,32,61,32,106,105,110,46,95,100,105,114,32,46,46,32,39,47,39,
+32,46,46,32,106,105,110,46,95,97,114,103,118,91,50,93,13,10,32,32,
+32,32,114,101,116,117,114,110,32,114,111,111,116,32,46,46,32,39,47,39,
+32,46,46,32,112,97,116,104,32,13,10,101,110,100,13,10
+};
+
diff --git a/src/libjin-lua/embed/scripts/ai.lua b/src/libjin-lua/embed/scripts/ai.lua
index a69da84..c9f6ff1 100644
--- a/src/libjin-lua/embed/scripts/ai.lua
+++ b/src/libjin-lua/embed/scripts/ai.lua
@@ -1,5 +1,4 @@
-/* graphics.lua */
-static const char* ai_lua = R"(
+
jin.ai = jin.ai or {}
local ja = jin.ai
@@ -8,19 +7,3 @@ ja.StateMachineType = {
STEPWISE = 1,
ITERATIVE = 2,
}
-
-
-
-)";
-
-
-//local sp = jin.graphics.newSprite()
-//local sm = jin.ai.newStateMachine(jin.StateMachineMode.STEPWISE, sp)
-//sm:addState("run")
-//sm:addEnterCallback("run", function(spr)
-// spr:setRun()
-//end)
-//
-//function jin.core.onUpdate(dt)
-// sm:update()
-//end
diff --git a/src/libjin-lua/embed/scripts/ai.lua.h b/src/libjin-lua/embed/scripts/ai.lua.h
deleted file mode 100644
index a69da84..0000000
--- a/src/libjin-lua/embed/scripts/ai.lua.h
+++ /dev/null
@@ -1,26 +0,0 @@
-/* graphics.lua */
-static const char* ai_lua = R"(
-jin.ai = jin.ai or {}
-
-local ja = jin.ai
-
-ja.StateMachineType = {
- STEPWISE = 1,
- ITERATIVE = 2,
-}
-
-
-
-)";
-
-
-//local sp = jin.graphics.newSprite()
-//local sm = jin.ai.newStateMachine(jin.StateMachineMode.STEPWISE, sp)
-//sm:addState("run")
-//sm:addEnterCallback("run", function(spr)
-// spr:setRun()
-//end)
-//
-//function jin.core.onUpdate(dt)
-// sm:update()
-//end
diff --git a/src/libjin-lua/embed/scripts/boot.lua b/src/libjin-lua/embed/scripts/boot.lua
index 4b97b69..cfcf264 100644
--- a/src/libjin-lua/embed/scripts/boot.lua
+++ b/src/libjin-lua/embed/scripts/boot.lua
@@ -1,5 +1,4 @@
-/* boot.lua */
-static const char* boot_lua = R"(
+
local cwd = jin.args['cwd'] or '.'
jin.filesystem.init()
jin.filesystem.mount(cwd)
@@ -135,5 +134,3 @@ jin.audio.destroy()
-------------------------------------------------------------------------
jin.core.quit()
-
-)"; \ No newline at end of file
diff --git a/src/libjin-lua/embed/scripts/boot.lua.h b/src/libjin-lua/embed/scripts/boot.lua.h
deleted file mode 100644
index 4b97b69..0000000
--- a/src/libjin-lua/embed/scripts/boot.lua.h
+++ /dev/null
@@ -1,139 +0,0 @@
-/* boot.lua */
-static const char* boot_lua = R"(
-local cwd = jin.args['cwd'] or '.'
-jin.filesystem.init()
-jin.filesystem.mount(cwd)
-
--------------------------------------------------------------------------
--- Config game
--------------------------------------------------------------------------
-
-jin.config = {}
-if jin.filesystem.exist("config.lua") then
- xpcall(function()jin.config = require "config" end, function()end)
-end
-jin.config.width = jin.config.width or 580
-jin.config.height = jin.config.height or 450
-jin.config.vsync = jin.config.vsync or true
-jin.config.title = jin.config.title or ("jin v" .. jin.version)
-jin.config.resizable = jin.config.resizable or false
-jin.config.fullscreen = jin.config.fullscreen or false
-jin.config.fps = jin.config.fps or 60
-jin.config.icon = jin.config.icon or ""
-
--------------------------------------------------------------------------
--- Default game loop
--------------------------------------------------------------------------
-
-local function call(func, ...)
- if func then
- return func(...)
- end
-end
-
-local step = jin.time.step
-jin.time.step = nil
-
-function jin.core.run()
- jin.graphics.reset()
- call(jin.core.onLoad)
- local dt = 0
- while jin.core.running() do
- for _, e in pairs(jin.event.poll()) do
- if e.type == "KeyDown" then
- jin.keyboard.set(e.key, true)
- elseif e.type == "KeyUp" then
- jin.keyboard.set(e.key, false)
- end
- call(jin.core.onEvent, e)
- end
- step()
- dt = jin.time.getDelta()
- call(jin.core.onUpdate, dt)
- jin.graphics.clear()
- call(jin.core.onDraw)
- jin.graphics.present()
- jin.time.sleep(0.001)
- end
-end
-
--------------------------------------------------------------------------
--- Boot game
--------------------------------------------------------------------------
-
--- Display error message.
-local function onError(msg)
- jin.audio.destroy()
- jin.graphics.showWindow()
- local err = "Error:\n" .. msg .. "\n" .. debug.traceback()
- jin.graphics.reset()
- jin.graphics.setClearColor(100, 100, 100, 255)
- jin.graphics.clear()
- jin.graphics.print(err, 5, 5)
- jin.graphics.present()
- while jin.core.running() do
- for _, e in pairs(jin.event.poll()) do
- if e.type == "Quit" then
- jin.core.stop()
- end
- end
- jin.time.sleep(0.001)
- end
-end
-
--- No game screen.
-local function noGame()
- jin.graphics.showWindow()
- jin.graphics.reset()
- jin.graphics.setClearColor(100, 100, 100, 255)
- jin.graphics.clear()
- jin.graphics.print("No Game", 5, 5)
- jin.graphics.present()
- while jin.core.running() do
- for _, e in pairs(jin.event.poll()) do
- if e.type == "Quit" then
- jin.core.stop()
- end
- end
- jin.time.sleep(0.001)
- end
-end
-
-local function boot()
- if jin.filesystem.exist("main.lua") then
- call(function()
- require"main"
- jin.core.run()
- end)
- else
- noGame()
- end
-end
-
--------------------------------------------------------------------------
--- Initialize sub systems
--------------------------------------------------------------------------
-
-jin.audio.init()
-jin.graphics.init(jin.config)
-
--------------------------------------------------------------------------
--- Boot game
--------------------------------------------------------------------------
-
-xpcall(boot, onError)
-
--------------------------------------------------------------------------
--- Destroy sub-systems
--------------------------------------------------------------------------
-
-jin.graphics.destroy()
-jin.audio.destroy()
-
--------------------------------------------------------------------------
--- Quit game
--------------------------------------------------------------------------
-
-jin.core.quit()
-
-)"; \ No newline at end of file
diff --git a/src/libjin-lua/embed/scripts/graphics.lua b/src/libjin-lua/embed/scripts/graphics.lua
index 0a66127..41c481c 100644
--- a/src/libjin-lua/embed/scripts/graphics.lua
+++ b/src/libjin-lua/embed/scripts/graphics.lua
@@ -1,5 +1,4 @@
-/* graphics.lua */
-static const char* graphics_lua = R"(
+
jin.graphics = jin.graphics or {}
local jg = jin.graphics
@@ -135,5 +134,3 @@ jg.reset = function()
jg.unsetFont()
jg.unuseShader()
end
-
-)"; \ No newline at end of file
diff --git a/src/libjin-lua/embed/scripts/graphics.lua.h b/src/libjin-lua/embed/scripts/graphics.lua.h
deleted file mode 100644
index 0a66127..0000000
--- a/src/libjin-lua/embed/scripts/graphics.lua.h
+++ /dev/null
@@ -1,139 +0,0 @@
-/* graphics.lua */
-static const char* graphics_lua = R"(
-jin.graphics = jin.graphics or {}
-
-local jg = jin.graphics
-
-jg.RenderMode = {
- FILL = 1,
- LINE = 2,
-}
-
-jg.SpriteOrigin = {
- TOPLEFT = 0,
- TOPCENTER = 1,
- TOPRIGHT = 2,
- MIDDLELEFT = 3,
- MIDDLECENTER = 4,
- MIDDLERIGHT = 5,
- BOTTOMLEFT = 6,
- BOTTOMCENTER = 7,
- BOTTOMRIGHT = 8
-}
-
-jg.SpriteMode = {
- SINGLE = 1,
- RANDOM = 2,
- ANIMATED = 3
-}
-
--- built in shaders
-jg.Shaders = {
- Font = nil,
- Texture = nil,
- Sprite = nil,
- SpriteSheet = nil,
- Default = nil
-}
-
-local function compileBuiltInShaders()
- jg.Shaders.Font = jg.newShader([[
- #VERTEX_SHADER
- Vertex vert(Vertex v)
- {
- return v;
- }
- #END_VERTEX_SHADER
- #FRAGMENT_SHADER
- Color frag(Color col, Texture tex, Vertex v)
- {
- return Color(col.rgb, texel(tex, v.uv).a);
- }
- #END_FRAGMENT_SHADER
- ]])
- jg.Shaders.Texture = jg.newShader([[
- #VERTEX_SHADER
- Vertex vert(Vertex v)
- {
- return v;
- }
- #END_VERTEX_SHADER
- #FRAGMENT_SHADER
- Color frag(Color col, Texture tex, Vertex v)
- {
- return col * texel(tex, v.uv);
- }
- #END_FRAGMENT_SHADER
- ]])
- jg.Shaders.Sprite = jg.newShader([[
- #VERTEX_SHADER
- Vertex vert(Vertex v)
- {
- return v;
- }
- #END_VERTEX_SHADER
- #FRAGMENT_SHADER
- Color frag(Color col, Texture tex, Vertex v)
- {
- return col * texel(tex, v.uv);
- }
- #END_FRAGMENT_SHADER
- ]])
- jg.Shaders.SpriteSheet = jg.newShader([[
- #VERTEX_SHADER
- Vertex vert(Vertex v)
- {
- return v;
- }
- #END_VERTEX_SHADER
- #FRAGMENT_SHADER
- Color frag(Color col, Texture tex, Vertex v)
- {
- return col * texel(tex, v.uv);
- }
- #END_FRAGMENT_SHADER
- ]])
- jg.Shaders.Default = jg.newShader([[
- #VERTEX_SHADER
- Vertex vert(Vertex v)
- {
- return v;
- }
- #END_VERTEX_SHADER
- #FRAGMENT_SHADER
- Color frag(Color col, Texture tex, Vertex v)
- {
- return col * texel(tex, v.uv);
- }
- #END_FRAGMENT_SHADER
- ]])
-end
-
-local _init = jg.init
-local initialized = false
-jg.init = function(setting)
- if initialized then
- return initialized
- end
- initialized = _init(setting)
- if initialized then
- compileBuiltInShaders()
- jg.useShader(jg.Shaders.Default)
- end
- return initialized
-end
-
-jg.unuseShader = function()
- jg.useShader(jg.Shaders.Default)
-end
-
--- Reset all attributes to default value.
-jg.reset = function()
- jg.setColor(255, 255, 255, 255)
- jg.setClearColor(0, 0, 0, 255)
- jg.clear()
- jg.unsetFont()
- jg.unuseShader()
-end
-
-)"; \ No newline at end of file
diff --git a/src/libjin-lua/embed/scripts/keyboard.lua b/src/libjin-lua/embed/scripts/keyboard.lua
index e989928..452e0f7 100644
--- a/src/libjin-lua/embed/scripts/keyboard.lua
+++ b/src/libjin-lua/embed/scripts/keyboard.lua
@@ -1,5 +1,4 @@
-static const char* keyboard_lua = R"(
jin.keyboard = jin.keyboard or {}
local jk = jin.keyboard
@@ -13,5 +12,3 @@ end
function jin.keyboard.set(k, status)
keys[k] = status
end
-
-)";
diff --git a/src/libjin-lua/embed/scripts/keyboard.lua.h b/src/libjin-lua/embed/scripts/keyboard.lua.h
deleted file mode 100644
index e989928..0000000
--- a/src/libjin-lua/embed/scripts/keyboard.lua.h
+++ /dev/null
@@ -1,17 +0,0 @@
-
-static const char* keyboard_lua = R"(
-jin.keyboard = jin.keyboard or {}
-
-local jk = jin.keyboard
-
-local keys = {}
-
-function jin.keyboard.isPressed(k)
- return keys[k]
-end
-
-function jin.keyboard.set(k, status)
- keys[k] = status
-end
-
-)";
diff --git a/src/libjin-lua/embed/scripts/mouse.lua b/src/libjin-lua/embed/scripts/mouse.lua
index ca070a3..876bf1d 100644
--- a/src/libjin-lua/embed/scripts/mouse.lua
+++ b/src/libjin-lua/embed/scripts/mouse.lua
@@ -1,4 +1,4 @@
-static const char* mouse_lua = R"(
+
jin.mouse = jin.mouse or {}
local jm = jin.mouse
@@ -12,5 +12,3 @@ end
function jin.mouse.set(btn, status)
button[btn] = status
end
-
-)"; \ No newline at end of file
diff --git a/src/libjin-lua/embed/scripts/mouse.lua.h b/src/libjin-lua/embed/scripts/mouse.lua.h
deleted file mode 100644
index ca070a3..0000000
--- a/src/libjin-lua/embed/scripts/mouse.lua.h
+++ /dev/null
@@ -1,16 +0,0 @@
-static const char* mouse_lua = R"(
-jin.mouse = jin.mouse or {}
-
-local jm = jin.mouse
-
-local button = {}
-
-function jin.mouse.isDown(btn)
- return button[btn]
-end
-
-function jin.mouse.set(btn, status)
- button[btn] = status
-end
-
-)"; \ No newline at end of file
diff --git a/src/libjin-lua/embed/scripts/net.lua b/src/libjin-lua/embed/scripts/net.lua
index a986ce6..946b55f 100644
--- a/src/libjin-lua/embed/scripts/net.lua
+++ b/src/libjin-lua/embed/scripts/net.lua
@@ -1,7 +1,4 @@
-/* net.lua */
-static const char* net_lua = R"(
+
jin.net = jin.net or {}
local jn = jin.net
-
-)"; \ No newline at end of file
diff --git a/src/libjin-lua/embed/scripts/net.lua.h b/src/libjin-lua/embed/scripts/net.lua.h
deleted file mode 100644
index a986ce6..0000000
--- a/src/libjin-lua/embed/scripts/net.lua.h
+++ /dev/null
@@ -1,7 +0,0 @@
-/* net.lua */
-static const char* net_lua = R"(
-jin.net = jin.net or {}
-
-local jn = jin.net
-
-)"; \ No newline at end of file
diff --git a/src/libjin-lua/embed/scripts/path.lua b/src/libjin-lua/embed/scripts/path.lua
index f7e1ec3..ede7f62 100644
--- a/src/libjin-lua/embed/scripts/path.lua
+++ b/src/libjin-lua/embed/scripts/path.lua
@@ -1,5 +1,4 @@
-/* path.lua */
-static const char* path_lua = R"(
+
jin.path = jin.path or {}
local jp = jin.path
@@ -12,5 +11,3 @@ function jin.path.full(path)
local root = jin._dir .. '/' .. jin._argv[2]
return root .. '/' .. path
end
-
-)"; \ No newline at end of file
diff --git a/src/libjin-lua/embed/scripts/path.lua.h b/src/libjin-lua/embed/scripts/path.lua.h
deleted file mode 100644
index f7e1ec3..0000000
--- a/src/libjin-lua/embed/scripts/path.lua.h
+++ /dev/null
@@ -1,16 +0,0 @@
-/* path.lua */
-static const char* path_lua = R"(
-jin.path = jin.path or {}
-
-local jp = jin.path
-
--- game root directory
-jin._root = nil
-
--- return full path of a given path
-function jin.path.full(path)
- local root = jin._dir .. '/' .. jin._argv[2]
- return root .. '/' .. path
-end
-
-)"; \ No newline at end of file