diff --git a/.vscode/c_cpp_properties.json b/.vscode/c_cpp_properties.json new file mode 100644 index 0000000..edd2d7c --- /dev/null +++ b/.vscode/c_cpp_properties.json @@ -0,0 +1,25 @@ +{ + "configurations": [ + { + "name": "Release", + "includePath": [ + "${workspaceFolder}/../lua/src", + "${workspaceFolder}/../kolibrios/contrib/sdk/sources/newlib/libc/include", + "${workspaceFolder}/../kolibrios/contrib/sdk/sources/PDCurses" + ], + "defines": [] + }, + { + "name": "Debug", + "includePath": [ + "${workspaceFolder}/../lua/src", + "${workspaceFolder}/../kolibrios/contrib/sdk/sources/newlib/libc/include", + "${workspaceFolder}/../kolibrios/contrib/sdk/sources/PDCurses" + ], + "defines": [ + "NDEBUG" + ] + } + ], + "version": 4 +} \ No newline at end of file diff --git a/.vscode/extensions.json b/.vscode/extensions.json new file mode 100644 index 0000000..aa1e4ad --- /dev/null +++ b/.vscode/extensions.json @@ -0,0 +1,8 @@ +{ + "recommendations": [ + "sumneko.lua", + "ms-vscode.cpptools", + "streetsidesoftware.code-spell-checker-russian", + "streetsidesoftware.code-spell-checker" + ] +} \ No newline at end of file diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..ce6f943 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,35 @@ +{ + "editor.tabSize": 4, + "editor.insertSpaces": false, + "files.associations": { + "stdlib.h": "c" + }, + "cSpell.words": [ + "ksys", + "ksys_oskey_t", + "LUALIB_API", + "luaL_newlib", + "metatable", + "luaL_newmetatable", + "luaL_setmetatable", + "lua_createtable", + "luaL_setfuncs", + "luaL_checkinteger", + "luaL_checkstring", + "luaL_checkudata", + "lua_pushboolean", + "lua_pushinteger", + "lua_pushnumber", + "luaL_optinteger", + "lua_pushstring", + "lua_pushnil", + "lua_touserdata", + "lua_setfield", + "lua_getfield", + "lua_settop", + "lua_islightuserdata", + "luaL_checktype", + "LUA_TTABLE", + ], + "C_Cpp.formatting": "disabled" +} \ No newline at end of file diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..6b2d5c8 --- /dev/null +++ b/Makefile @@ -0,0 +1,43 @@ +LUA_V = 54 + +CC=kos32-gcc +LD=kos32-ld +STRIP=kos32-strip +OBJCOPY=kos32-objcopy +STD=-std=gnu99 +CFLAGS=$(SYSCFLAGS) -O2 -Wall -Wextra -DLUA_COMPAT_5_3 $(STD) $(MYCFLAGS) +LDFLAGS=$(SYSLDFLAGS) $(MYLDFLAGS) +LIBS=$(SYSLIBS) $(MYLIBS) $(TOOLCHAIN_PATH)/mingw32/lib/lua$(LUA_V).dll.a --start-group -lgcc -lc.dll -ldll -lcurses -lSDLn -lSDL_mixer -lsound --end-group + +ifeq ($(OS), Windows_NT) + TOOLCHAIN_PATH=C:/MinGW/msys/1.0/home/autobuild/tools/win32 +else + TOOLCHAIN_PATH=/home/autobuild/tools/win32 +endif + +KOLIBRIOS_REPO=$(abspath ../kolibrios) + + + +SDK_DIR=$(KOLIBRIOS_REPO)/contrib/sdk +NewLib_DIR=$(SDK_DIR)/sources/newlib +PDCurses_DIR=$(SDK_DIR)/sources/PDCurses +SYSCFLAGS=-fno-ident -fomit-frame-pointer -U__WIN32__ -U_Win32 -U_WIN32 -U__MINGW32__ -UWIN32 -I$(NewLib_DIR)/libc/include -I$(abspath .)/../lua/src -I$(PDCurses_DIR) +SYSLDFLAGS=--image-base 0 -shared -T dll.lds --entry _DllStartup +SYSLIBS=-L $(SDK_DIR)/lib -L$(TOOLCHAIN_PATH)/lib -L$(TOOLCHAIN_PATH)/mingw32/lib +MYCFLAGS= +MYLDFLAGS= +MYLIBS= +MYOBJS= + +ALL_O = src/core/curses/curses.o + +ltui.dll: $(ALL_O) + $(LD) $(LDFLAGS) -o $@ $(ALL_O) $(LIBS) + $(STRIP) -S $@ + +clean: + rm -f $(ALL_O) ltui.dll + +src/core/curses/curses.o: src/core/curses/curses.c + diff --git a/src/core/curses/curses.c b/src/core/curses/curses.c index f5b7265..917084a 100644 --- a/src/core/curses/curses.c +++ b/src/core/curses/curses.c @@ -598,23 +598,23 @@ static void lt_curses_register_constants(lua_State* lua) LT_CURSES_CONST(BUTTON4_CLICKED) LT_CURSES_CONST(BUTTON4_DOUBLE_CLICKED) LT_CURSES_CONST(BUTTON4_TRIPLE_CLICKED) - LT_CURSES_CONST(BUTTON_CTRL) + LT_CURSES_CONST(BUTTON_CONTROL) LT_CURSES_CONST(BUTTON_SHIFT) LT_CURSES_CONST(BUTTON_ALT) LT_CURSES_CONST(REPORT_MOUSE_POSITION) LT_CURSES_CONST(ALL_MOUSE_EVENTS) -# if NCURSES_MOUSE_VERSION > 1 +//# if NCURSES_MOUSE_VERSION > 1 LT_CURSES_CONST(BUTTON5_RELEASED) LT_CURSES_CONST(BUTTON5_PRESSED) LT_CURSES_CONST(BUTTON5_CLICKED) LT_CURSES_CONST(BUTTON5_DOUBLE_CLICKED) LT_CURSES_CONST(BUTTON5_TRIPLE_CLICKED) -# else +/*# else LT_CURSES_CONST(BUTTON1_RESERVED_EVENT) LT_CURSES_CONST(BUTTON2_RESERVED_EVENT) LT_CURSES_CONST(BUTTON3_RESERVED_EVENT) LT_CURSES_CONST(BUTTON4_RESERVED_EVENT) -# endif +# endif*/ # endif #endif } @@ -663,7 +663,7 @@ static int lt_curses_stdscr(lua_State* lua) static int lt_curses_getmouse(lua_State* lua) { MEVENT e; - if (getmouse(&e) == OK) + if (nc_getmouse(&e) == OK) { lua_pushinteger(lua, e.bstate); lua_pushinteger(lua, e.x);