ref: 45b732d48348446f166f47cfb18226cef897b9d2
parent: a46617166919cacc82243bf4d78125cfb7c3c7e9
author: telephil9 <telephil9@gmail.com>
date: Sun Oct 25 05:35:29 EDT 2020
Add missing color.c and event.c files
--- /dev/null
+++ b/color.c
@@ -1,0 +1,57 @@
+#include <draw.h>
+#include <lua.h>
+#include <lauxlib.h>
+#include <lualib.h>
+#include "utils.h"
+
+static const struct luaL_Reg libcolor[] = {
+ { NULL, NULL },
+};
+
+int
+openlibcolor(lua_State *L)
+{
+ luaL_newlib(L, libcolor);
+ pushglobal(L, "OPAQUE", DOpaque);
+ pushglobal(L, "TRANSPARENT", DTransparent);
+ pushglobal(L, "BLACK", DBlack);
+ pushglobal(L, "WHITE", DWhite);
+ pushglobal(L, "RED", DRed);
+ pushglobal(L, "GREEN", DGreen);
+ pushglobal(L, "BLUE", DBlue);
+ pushglobal(L, "CYAN", DCyan);
+ pushglobal(L, "MAGENTA", DMagenta);
+ pushglobal(L, "YELLOW", DYellow);
+ pushglobal(L, "PALE_YELLOW", DPaleyellow);
+ pushglobal(L, "DARK_YELLOW", DDarkyellow);
+ pushglobal(L, "PALE_GREEN", DPalegreen);
+ pushglobal(L, "DARK_GREEN", DDarkgreen);
+ pushglobal(L, "MED_GREEN", DMedgreen);
+ pushglobal(L, "DARK_BLUE", DDarkblue);
+ pushglobal(L, "PALE_BLUE_GREEN", DPalebluegreen);
+ pushglobal(L, "PALE_BLUE", DPaleblue);
+ pushglobal(L, "BLUE_GREEN", DBluegreen);
+ pushglobal(L, "GREY_GREEN", DGreygreen);
+ pushglobal(L, "PALE_GREY_GREEN", DPalegreygreen);
+ pushglobal(L, "YELLOW_GREEN", DYellowgreen);
+ pushglobal(L, "MED_BLUE", DMedblue);
+ pushglobal(L, "GREY_BLUE", DGreyblue);
+ pushglobal(L, "PALE_GREY_BLUE", DPalegreyblue);
+ pushglobal(L, "PURPLE_BLUE", DPurpleblue);
+ pushglobal(L, "NOT_A_COLOR", DNotacolor);
+ pushglobal(L, "NO_FILL", DNofill);
+ return 1;
+}
+
+
+
+
+
+
+
+
+
+
+
+
+
--- /dev/null
+++ b/event.c
@@ -1,0 +1,51 @@
+#include <u.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <draw.h>
+#include <event.h>
+#include <keyboard.h>
+#include <lua.h>
+#include <lauxlib.h>
+#include <lualib.h>
+#include "ldraw.h"
+#include "utils.h"
+
+static int
+leinit(lua_State *L)
+{
+ lua_Integer i;
+
+ i = luaL_checknumber(L, -1);
+ einit((ulong)i);
+ return 0;
+}
+
+static int
+levent(lua_State *L)
+{
+ Event ev;
+ int e;
+
+ e = event(&ev);
+ lua_pushnumber(L, e);
+ lua_newtable(L);
+ lua_pushinteger(L, ev.kbdc);
+ lua_setfield(L, -2, "kbdc");
+ return 2;
+}
+
+static const struct luaL_Reg libevent [] = {
+ { "init", leinit },
+ { "event", levent },
+ { NULL, NULL }
+};
+
+int
+openlibevent(lua_State *L)
+{
+ luaL_newlib(L, libevent);
+ pushglobal(L, "MOUSE", Emouse);
+ pushglobal(L, "KEYBOARD", Ekeyboard);
+ return 1;
+}