From: John L. <jla...@gm...> - 2006-02-03 22:54:44
|
> Allow me to ask a question. > I think it would be cool to wxCanObjScript working. > I am thinking of deriving the wxCanvasObj from wxEvtHandler, and that > way sent and event to wxLua to draw the object and another to Hittest > the object. > But maybe that is way to complex. And how to intercept those two > functions in wxlua m_script of the object. > In principle m_script in the C++ object, should contain two functions. > On with input parameter a wxDC* etc. and this one is used for drawing. > The other Is IsHit( x, y etc. ) and is used for hit testing, and return > true to C++ if hit. > Now do you have any idea on how to best call those function in m_script > from the coresponding C++ functions? You can have your C function just call lua code directly. m_wxlState.RunString(wxString::Format(wxT("hittest(%f, %f)"), x, y))); in the lua code you can then set variables back to C++ through the binding. Maybe I don't understand fully though. > The next step is of course to have the whole derived wxCanObj defined in > a lua script. > But one step first ;-) Whatever would be easier. -John |