From: klaas.holwerda <kho...@xs...> - 2006-01-16 21:12:27
|
Hi, I made a sample to demo how to use wxLua in an application. It is a simple canvas + nested objects being a container for circle and rect object. It is rendered non flicker etc., and not optimized like wxArt2D. It has a commandprocessor, with undo and redo of moving objects, which can be easily extended if we want. There is also a wxlCanObjScript, which i have in mind to be draw by a lua script string. And that is not workling yet ;-) The idea is to make lua script to add object to the canvas and to define new objects being drawn by lua. The first i think i know how, the second not yet. For the rest it is all Cmake generated project files, which you need to generate using Cmake. Please build outside the wxLua tree itself, since that is what i do. http://www.xs4all.nl/~kholwerd/tmp/wxLua2.tgz Is anyone against if i add the sample to CVS + the Cmake files for building using Cmake? Next we can extend it to demo all ins and outs of wxLua integration into an App. Only tested with VC6 yet. Please let me know if there is any trouble with building it. regards, Klaas |
From: klaas.holwerda <kho...@xs...> - 2006-01-16 21:15:33
|
I forgot, using Cmake there is no "/NODEFAULTLIB:MSVCRT.LIB" needed. I think bakefile is doing something wrong. Klaas klaas.holwerda wrote: > Hi, > > I made a sample to demo how to use wxLua in an application. |
From: k. h. <kla...@nl...> - 2006-01-17 08:40:27
|
Ooh yes, lua is no with debug info ( in Cmake ). A lot easier to follow, and actually fun to see what is happening internal. Maybe i will find my problem now ;-) I think that bakefile is not used to non graphical application, and that is why lua has no debug and there is the switch problems. regards, Klaas klaas.holwerda wrote: > I forgot, using Cmake there is no "/NODEFAULTLIB:MSVCRT.LIB" needed. > > I think bakefile is doing something wrong. > > Klaas > > -- Unclassified |
From: John L. <jla...@gm...> - 2006-01-19 04:55:55
|
Sorry, I've been away. I'll try it out tomorrow, does it depend on anything? It sounds good if not. I've been playing with writing a simple Sudoku solver, something where I could make the drawing of the grid in c++, as a widget. I'd bind that to lua that would run the code to solve it. It'd be pretty basic, but vaguely useful to people who like Sudoku. You could of course just do the whole thing in lua, but I couldn't think of another binding demo... Regards, John Labenski On 1/17/06, k. holwerda <kla...@nl...> wrote: > Ooh yes, lua is no with debug info ( in Cmake ). > A lot easier to follow, and actually fun to see what is happening interna= l. > Maybe i will find my problem now ;-) > > I think that bakefile is not used to non graphical application, and that > is why lua has no debug and there is the switch problems. > > regards, > > Klaas > > klaas.holwerda wrote: > > > I forgot, using Cmake there is no "/NODEFAULTLIB:MSVCRT.LIB" needed. > > > > I think bakefile is doing something wrong. > > > > Klaas > > > > > > -- > Unclassified > > > > ------------------------------------------------------- > This SF.net email is sponsored by: Splunk Inc. Do you grep through log fi= les > for problems? Stop! Download the new AJAX search engine that makes > searching your log files as easy as surfing the web. DOWNLOAD SPLUNK! > http://sel.as-us.falkag.net/sel?cmd=3Dlnk&kid=3D103432&bid=3D230486&dat= =3D121642 > _______________________________________________ > Wxlua-users mailing list > Wxl...@li... > https://lists.sourceforge.net/lists/listinfo/wxlua-users > |
From: k. h. <kla...@nl...> - 2006-01-19 09:08:53
|
Hi John, John Labenski wrote: >Sorry, I've been away. > I expected something like that. > I'll try it out tomorrow, does it depend on >anything? > It depends on nothing, only Cmake to generate all makestuff needed. > It sounds good if not. > > I think the nice thing is that there will be a canvas object which calls function from C++ in Lua. e.g. to draw the object a function is called in lua with as input parameter wxDC (comming from the C++ cnavs object). The same could be done for the hit test function. The second feature is the command processor. It has do undo. And we can use as a central point for wrapping functions. The nice thing would be to wrap all classes in this sample. I managed to do the rectangle (working around all the wrapping problem we have ), what i found as a bug the next. delete m_pTrackedList; One can add object to the canvas, and of course they will be owned by the canvas. But Lua wants to delete them whn closing the program. I think there are two solution: - make in the *.i file a %notrack keyword, which in this constrcutor function static int LUACALL wxlCanObj_constructor(lua_State *L) removes this line wxLua_addToTrackedMemoryList(wxlState, (wxlCanObj *)returns); OR use smart pointers for situations like this, where it does not matter when who deletes the object first, lua or the C++ canvas. I think the first solution is for the moment the easiest. Would it be simple to add this? >I've been playing with writing a simple Sudoku solver, something where > > Do you have a link? I never heard of Sudoku? >I could make the drawing of the grid in c++, as a widget. > Sounds like canvas needs too? > I'd bind >that to lua that would run the code to solve it. It'd be pretty basic, >but vaguely useful to people who like Sudoku. You could of course just >do the whole thing in lua, but I couldn't think of another binding >demo... > > Several sample/demos would not be bad, and maybe we can combine your idea with my sample. e.g Objects on a canvas which can be dragged, which form together the game?? But lets make the bindings work first. I will try to test your new mods today, regards, Klaas -- Unclassified |
From: klaas.holwerda <kho...@xs...> - 2006-01-19 22:05:26
|
I uploaded what i tested today ( with the latest namespace changes and such ). http://www.xs4all.nl/~kholwerd/tmp/wxLua2.zip The sample works a little because i changed the order of registering bindings, but this does not solve anything. I think that the problem of all is the Itag that is coupled to each class. This must be unique, since this Itag result in calling functions for __gc etc. Now with two bindings the same Itag is used for two different classes, and depending on what is registered first one of them works or not. With the same namespace into two bindings there is the problem with a table with the same name created i think. How to organize it better i do not see yet, it looks like the m_lastTag should move up a bit, to make it unique for all classes in all bindings?? regards, Klaas > > > But lets make the bindings work first. I will try to test your new > mods today, |
From: John L. <jla...@gm...> - 2006-01-20 04:39:33
Attachments:
Makefile
wxluacan.rules.in
|
On 1/19/06, klaas.holwerda <kho...@xs...> wrote: > I uploaded what i tested today ( with the latest namespace changes and > such ). > > http://www.xs4all.nl/~kholwerd/tmp/wxLua2.zip I'm using gtk2 in unicode w/ wxWidgets CVS head. 1) Unicode fix, add wxT(""), cancom.cpp line 48 wxlMoveObjectCmd::wxlMoveObjectCmd( wxlCanObj* object, double x, double y ) :wxCommand( true, wxT("drag object") ) 2) In gtk2 I get an invalid bitmap assert in wxlCan in canslm.cpp MyFrame::MyFrame( wxWindow *parent, wxWindowID id, const wxString &title, ... // give it some initial size to make it happy mainCan =3D m_canvas =3D new wxlCan( this, wxID_ANY, wxPoint(0,0), wxSize(10,10) ); ... // else this code asserts when it tries to use wxlCan::m_bitmap m_canvas->SetYaxis( false ); //true ); //defines the minimum x and y to show and the number of world units per pixel in x and y m_canvas->SetMappingUpp( m_xOrigin, m_yOrigin, m_xScale, m_yScale ); > The sample works a little because i changed the order of registering > bindings, > but this does not solve anything. It works well for me after regenerating the bindings (I removed the wx_XXX stuff), I haven't tested everything though or look too much at the code. I've attached my Makefile (using wx-config) and an updated wxlcan.rules.in file that uses simpler paths, just "." will suffice since you want them in the current dir anyway. See also the genwxbind tag in the Makefile, eg "$make genwxbind" to generate them. It looks really great, no flicker at all! > I think that the problem of all is the Itag that is coupled to each class= . > This must be unique, since this Itag result in calling functions for > __gc etc. > Now with two bindings the same Itag is used for two different classes, > and depending on what is registered first one of them works or not. With > the same namespace into two bindings there is the problem with a table > with the same name created i think. > How to organize it better i do not see yet, it looks like the m_lastTag > should move up a bit, to make it unique for all classes in all bindings?? Let me know if things work for you now, I'll try my best to try it again in windows tomorrow. I just got a newer (but still old) machine that seems a little flaky, but I managed to get VC Express 2005 on it. Regards, John Labenski |
From: k. h. <kla...@nl...> - 2006-01-20 09:53:40
|
Hi John, John Labenski wrote: >I'm using gtk2 in unicode w/ wxWidgets CVS head. > > Oke did not test on linux, but did add your changes. > > > >>The sample works a little because i changed the order of registering >>bindings, >> but this does not solve anything. >> >> > >It works well for me after regenerating the bindings (I removed the >wx_XXX stuff), I haven't tested everything though or look too much at >the code. > No nothing has changed, if i change the order of registration again void wxLuaState::RegisterBindings(bool registerTypes) { ..................... for (node = M_WXLSTATEDATA->m_bindings.GetFirst(); node; node = node->GetNext() ) //for (node = M_WXLSTATEDATA->m_bindings.GetLast(); node; node = node->GetPrevious() ) It does not work anymore. Run the script i wxluacan/scripts, and you will see it. I think the problem is as i explained in the other mails. Also when you run that script and add a rectangle that way, and next close the program, you should get a crash. > I've attached my Makefile (using wx-config) and an updated >wxlcan.rules.in file that uses simpler paths, just "." will suffice >since you want them in the current dir anyway. See also the genwxbind >tag in the Makefile, eg "$make genwxbind" to generate them. > > Will add that makefile too. I assume it is used/generated by bakefile? >It looks really great, no flicker at all! > > Right, same structure as in wxArt2d, but stripped to the bone ;-) Once we add to CVS, and get it to work really with the bindings, i think we can demo with almost all situations one can encounter in an appplication. The trick is of course in the interactive behaviour, which is not only about dialogs and such. Make lua scripts part of canvas objects and going back and forth between C++ and wxLua is a nice thing to demo. But i do need your help do make that happen ;-) >Let me know if things work for you now, I'll try my best to try it >again in windows tomorrow. > Nothing has changed, we need to modify the code in wxLua to make this work. I understand the problem more or less, but lack the knowledge to make it really work correctly. I wonder how you used wxLua as is until now. How do you do it? >I just got a newer (but still old) machine >that seems a little flaky, but I managed to get VC Express 2005 on it. > > Oke, it might be easier for debugging, but the problem is not the platform here. regards, Klaas -- Unclassified |