Re: [Pipmak-Devel] mouseloc() crash: Bug in loadnode?
Status: Alpha
Brought to you by:
cwalther
From: Christian W. <cwa...@gm...> - 2007-07-26 08:40:19
|
Andrea Viarengo wrote: > Yes, I'm trying to build a contextual menu which appears on mouse location > when a right button event is trapped. There's no such thing as a "right button event" in Pipmak, and that's by design. Don't assume that people have (or are willing to use) more than one mouse button. > During my experiment I get the crash. > Probably, when you designed mouse methods you have thought which the > logical place where recall these was on onenternode(), and > this is right, perhaps it would be good specify in > the documentation that calling mouseloc in the body of the node return > insignificant values (after off-course, to have modified code to avoid > crash) Thinking about it again, I think that throwing an error would be the best thing to do when that function is called on an incomplete node. I don't feel comfortable with going through the documentation now and marking which functions are useful to call during node loading and which aren't. I'd rather keep this unspecified for the moment, because it may change when node.lua files are run on other occasions in the future (e.g. to build the project map). > I resolve my issue passing event.motion.x, event.motion.y from "C" to "lua" But that's not what pipmak.mouseloc is specified to return. > Another thing regard mouseloc which isn't clear in the documentation: > > On a panel which show an image 128x128 at resolution 640x480, > mouseloc/mouseclick return a couple of values from 0,0 to 128,128 and > not from 0,0 to 640,480 as someone could wrongly think. The documentation says "Returns two values, the coordinates of the mouse pointer *in the coordinate system of the current node*." Two lines above, it explains in more detail what that is. Any suggestions how that can be made clearer? Should the detail description from pipmak.clickloc() be repeated for pipmak.mouseloc()? What sense would it make to return the mouse location in screen pixels anyway? The only meaningful thing you could do with them is to divide them by pipmak.screensize() to get relative values. The fullscreen resolution/window size is an arbitrary user choice and should not matter to your game/application logic. I don't even remember why I put screensize into pipmak and not into pipmak_internal. > This is an other reason for which Mouseloc it doesn't suit well for my > case. I don't have a solution ready for what you want to achieve, but I have the uneasy feeling that you're trying to force square pegs into round holes. That's not necessarily a bad thing - progress comes from that, see the pipmak.setfullscreen case - but still... -Christian |