diff options
| author | Alexander M Pickering <alex@cogarr.net> | 2022-07-04 18:19:26 -0500 |
|---|---|---|
| committer | Alexander M Pickering <alex@cogarr.net> | 2022-07-04 18:19:26 -0500 |
| commit | 9f6b7ecb31179ee980f729578d84d7889f5065b8 (patch) | |
| tree | ed1cc4b2614f2c134830c7431efae9f6afa34faa | |
| parent | cb39716f1ee896473ed03bcb6dbf927715f74cee (diff) | |
| download | brokengine-9f6b7ecb31179ee980f729578d84d7889f5065b8.tar.gz brokengine-9f6b7ecb31179ee980f729578d84d7889f5065b8.tar.bz2 brokengine-9f6b7ecb31179ee980f729578d84d7889f5065b8.zip | |
Minor bugfixes, preparing to overhaul
| -rw-r--r-- | .gitmodules | 2 | ||||
| -rw-r--r-- | Makefile.win | 8 | ||||
| -rw-r--r-- | spec/headless/init.lua | 14 | ||||
| -rw-r--r-- | src/client/lua_api/gui/iguifiledialog.cpp | 34 | ||||
| -rw-r--r-- | src/shared/lua_api/phys/bphysgeneric.cpp | 2 |
5 files changed, 34 insertions, 26 deletions
diff --git a/.gitmodules b/.gitmodules index 9e74966..6efeb5e 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,6 +1,6 @@ [submodule "lib/bullet"] path = lib/bullet - url = http://cogarr.net/source/cgit.cgi/bullet/ + url = https://cogarr.net/source/cgit.cgi/bullet branch = master [submodule "lib/irrlicht"] path = lib/irrlicht diff --git a/Makefile.win b/Makefile.win index 16a081e..2cb4d57 100644 --- a/Makefile.win +++ b/Makefile.win @@ -43,7 +43,7 @@ CLIENT_LIBS=\ -lm #-lstdc++-6 -CFLAGS+=-DNNG_STATIC_LIB +CFLAGS+=-DNNG_STATIC_LIB -g ifeq ($(DEBUG), true) else LDFLAGS += -mwindows @@ -66,6 +66,9 @@ doc: documentation documentation: $(MDOC) -p src -o doc -t "Brok[en]gine" -i README.md -d reference -m "markdown" +test: + busted + bin/client/bin/brokengine_client.exe : $(client_objs) $(shared_objs) $(lib_objs) $(Q)echo "Linking $@" $(Q)$(LD) $(LDFLAGS) -o $@ $^ $(CLIENT_LIB_DIRS) $(CLIENT_LIBS) # -Wl,--verbose @@ -89,6 +92,9 @@ $(server_objs) : build/server/%.o : src/server/%.cpp src/server/%.hpp bin/client/bin/Irrlicht.dll : lib/irrlicht/bin/Win32-gcc/Irrlicht.dll cp $^ $@ +lib/irrlicht/bin/Win32-gcc/Irrlicht.dll : lib/irrlicht/source/Irrlicht/Makefile + cd lib/irrlicht/source/Irrlicht && $(MAKE) win32 + lib/nng/static/libnng.a: $(Q)echo "Make $@" $(Q)mkdir lib/nng/static diff --git a/spec/headless/init.lua b/spec/headless/init.lua index a5cf357..1492087 100644 --- a/spec/headless/init.lua +++ b/spec/headless/init.lua @@ -1,13 +1,5 @@ GAME.crashy()
- local socket = net.newsocket(net.PAIR)
- socket:connect("tcp://127.0.0.1:5555")
- function socket:receive(stream)
- local message = stream:readstring()
- assert(message == "pong")
- end
- socket:send(function(stream)
- stream:writestring("ping")
- end)
-
-
+print("Before openfiledialog called")
+gui.newfileopendialog()
+print("After openfiledialgo called")
GAME.exit()
diff --git a/src/client/lua_api/gui/iguifiledialog.cpp b/src/client/lua_api/gui/iguifiledialog.cpp index 88fcae0..8e038c5 100644 --- a/src/client/lua_api/gui/iguifiledialog.cpp +++ b/src/client/lua_api/gui/iguifiledialog.cpp @@ -26,9 +26,11 @@ extern IrrlichtDevice* device; /*** Creates a new dialog to open a file. The file creation window may have the following fields set for callbacks: + .onDirectorySelect(self) .onFileSelect(self) .onCanceled(self) + @function gui.newfileopendialog() @tparam? string title The rectangle to place the button at. If the box has a parent, it is offset from the upper-left of the parent element. @@ -39,10 +41,11 @@ it is offset from the upper-left of the parent element. */ //gui.newfileopendialog(["title"][,"path"][,parent][,modal]) static int newfileopendialog(lua_State* L){ - wchar_t *title = NULL;// = L"File open dialog"; - io::path::char_type *path = NULL;// = L""; + printf("Creating openfiledialog\n"); + wchar_t *title = (wchar_t*)calloc(sizeof(wchar_t),1);// = L"File open dialog"; + io::path::char_type *path = 0;// = L""; bool modal = true; - IGUIElement* parent = NULL; + IGUIElement* parent = 0; int nargs = lua_gettop(L); if(nargs > 3){ @@ -50,9 +53,13 @@ static int newfileopendialog(lua_State* L){ lua_pop(L,1);//"title","path",{parent} } if(nargs > 2){ - lua_getfield(L,-1,"guielement");//"title","path",{parent},ud_parent - parent = (IGUIElement*)lua_touserdata(L,-1);//"title","path",{parent},ud_parent - lua_pop(L,2);//"title","path" + if(!lua_isnil(L,-1)){ + lua_getfield(L,-1,"guielement");//"title","path",{parent},ud_parent + parent = (IGUIElement*)lua_touserdata(L,-1);//"title","path",{parent},ud_parent + lua_pop(L,2);//"title","path" + }else{ + parent = device->getGUIEnvironment()->getRootGUIElement(); + } } if(nargs > 1){ const char *pathc = lua_tostring(L,-1);//"title","path" @@ -67,25 +74,28 @@ static int newfileopendialog(lua_State* L){ mbstowcs(title,titlec,titlecslen); title[titlecslen] = L'\0'; } - //printf("Got all arguments\n"); + printf("Got all arguments\n"); IGUIEnvironment *env = device->getGUIEnvironment(); + printf("Got gui environment: %p\n",(void*)env); + printf("Test: %ls\n",title); IGUIFileOpenDialog *but = env->addFileOpenDialog(title,modal,parent,-1,false,path); - //printf("Created file open dialog\n"); - //printf("Added file open dialog\n"); + //IGUIFileOpenDialog *but = env->addFileOpenDialog(L"test",true,0,-1,false,"test"); + printf("Created file open dialog\n"); + printf("Added file open dialog\n"); lua_newtable(L);//{} lua_pushlightuserdata(L,but);//{},ud_iguibutton lua_setfield(L,-2,"guielement");//{guielement} luaL_getmetatable(L,"gui.iguifileopendialog");//{guielement},{m_iguibutton} lua_setmetatable(L,-2);//{guielement} - //printf("Created lua representation\n"); + printf("Created lua representation\n"); setelementcallback(L,EGET_DIRECTORY_SELECTED,"onDirectorySelect");// setelementcallback(L,EGET_FILE_SELECTED,"onFileSelect"); setelementcallback(L,EGET_FILE_CHOOSE_DIALOG_CANCELLED,"onCanceled"); - //printf("Finished registering callback\n"); + printf("Finished registering callback\n"); free(title); - //printf("Freed everything\n"); + printf("Freed everything\n"); return 1; } diff --git a/src/shared/lua_api/phys/bphysgeneric.cpp b/src/shared/lua_api/phys/bphysgeneric.cpp index eed9112..3f2114e 100644 --- a/src/shared/lua_api/phys/bphysgeneric.cpp +++ b/src/shared/lua_api/phys/bphysgeneric.cpp @@ -264,7 +264,7 @@ int setrotation(lua_State *L){ //rigidbody:getmass() :: number int getmass(lua_State *L){ btRigidBody *r = popRigidBody(L); - double m = r->getMass(); + double m = 1.0/r->getInvMass(); lua_pushnumber(L,m); return 1; } |
