From: John L. <jla...@gm...> - 2005-09-03 14:04:19
|
On 9/3/05, Eike Decker <ei...@cu...> wrote: > Hi > Thanks for the answer and positive feedback on a C compatible header. > I am sorry that I haven't described the full "problem" in my last > request, but I didn't thought it was necessary, but it seems to be more > complicated than I thought (surprise surprise). It always is... :( =20 > The project I talked about is a 3D engine that can be extended by using > lua and it looks currently quite nice > (http://chilli.degnet.de/~e_decker/lux/index.php/Main/Screenshots - Looks nice. > website is under construction...). - anyhow: We are currently using GLFW > as windowenvironment for OpenGL which replaced Glut (we want to be > plattformindependent). Now, the idea about wx was, that we could use it > to extend the engine with GUI elements for making editors, etc. wxLua would be perfect for this, except for the problems... > I have now tried out the loadlib function in lua to load the dll like thi= s: > luaopen =3D loadlib("wxLua.dll", "wxLua") >=20 > unfortunately, calling luaopen in lua itself crashs the application > somewhere deeply in the dll and I can't debug this. Meanwhile I am also > not sure anymore if it is really possible to extend the engine this way > since we need our own mainloop. I guess that creating a new window using > WX makes the engine crash since GLFW did this before - but it's only a > guess, I haven't spend too much time on this window-stuff programming... wxLua relies on the wxWidgets main loop and I don't think that this is avoidable because of the required notification events. Typically you create a wxApp instance that initializes the wxWidgets main loop. (this is a good site for the wxWidgets docs) http://www.lpthe.jussieu.fr/~zeitlin/wxWindows/docs/wxwin_wxappoverview.htm= l#wxappoverview However I have seen people handle initializing the mainloop their own way, = see http://www.lpthe.jussieu.fr/~zeitlin/wxWindows/docs/wxwin_wxapp.html#wxappm= ainloop Also search for IMPLEMENT_APP_NO_MAIN on google http://lists.wxwidgets.org/archive/wx-users/msg33172.html "To use your own "int main()" you'll need to use the IMPLEMENT_APP_NO_MAIN() macro and use wxEntry. On the wiki there's a topic about using wxWidgets in DLLs which is somewhat similar to this." http://wiki.wxwidgets.org/wiki.pl?Creating_A_DLL_Of_An_Application ** I have never tried to use DLLs nor anything like this so I can't be of much help, but maybe the above will get you started and give you some ideas. > As a possibility, we could switch from GLFW to WX - but this would cause > much more work on this (a little bit minor) problem than we wanted to spe= nd. Switching over to wxWidgets is an option, it'll add a lot of features, some useful data structures, and whatnot, but might be a lot of work. > Any creative ideas how to solve this problem without spending too much > work in rewriting the C core of the engine? As as aside, I don't want to start a war here, but C++ is perfect for GUI libs because you can encapsulate the data for a window in a class and use inheritance to reuse code. A button for example, has fore, back colours, size, position and of course so would a generic window, the button just adds a member for the label. You can always compile C w/ C++ if you do this when including headers extern "C" { #include "cheader.h" } I don't know much about the loss in performance of compiling C code as C++, but what what I've seen (Great computer language shootout IIRC) it wasn't too significant. Good luck, John Labenski |