Re: Silly Scribble Program

new topic     » goto parent     » topic index » view thread      » older message » newer message

"Cuny, David" wrote:
> I just got around to looking at Hawke's version of TruScribble, and noticed
> that he made many of the mistakes that I documented in my prior post.
*blush*
and what's _really_ funny is that i -did- read that particular
post, and (really!) meant to incorporate those mistake solutions...
personally... i think doing the following is 'cleaner' than
using and_bits... i never found reading code using those functions
to be 'easy to digest'...

if    event = MOVE then
      blahblahblah
elsif event = LEFT_UP        or    --is there a left_up   at all?
      event = MOVE+LEFT_UP   then
      blahblahblah
elsif event = LEFT_DOWN      or    --is there a left_down at all?
      event = MOVE+LEFT_DOWN then
      blahblahblah
end if

i dunno, just seems easier to read to me...
you can see exactly what the coder is 'thinking'...

either solution of course is fine, as long as
one of them is actually *implemented* :)

>Of course, he could always rewrite TruMouse to return the
>mouse events as *seperate* events, like I did in the WinLib
>library I wrote for my version of Scribble.
i don't remember the contents of that post... however,
i'm assuming that your suggestion to change TruMouse
to return individual events would mean a sequence returned
from get_mouse that was always the same length that had a
location for each event, or, naturally, an atom -1 if nuffin
happened as defined by mouse_events.

like:
constant
        MOVE       = 1,
        LEFT_UP    = 2,
        LEFT_DOWN  = 3,
        MIDDLE_UP  = 4,
        MIDDLE_DOWN= 5,
        RIGHT_UP   = 6,
        RIGHT_DOWN = 7,
        MOUSE_X    = 8,
        MOUSE_Y    = 9
object mouse

mouse_events({MOVE,LEFT_DOWN,RIGHT_DOWN}) --note adjusted syntax

if mouse then became {1,0,1,0,0,0,0,251,109}
you would have a MOVE+LEFT_DOWN situation at 251,109?
you would ask questions like:
  if    mouse[LEFT_DOWN]  then --do some action
  elsif mouse[RIGHT_DOWN] then --context menu?
  elsif mouse[MOVE]       then --some sort of 'mouseover' action?
and you wouldn't have to worry about missing any
events, wouldn't need to use and_bits, and wouldn't
have real complex if/elsif/endif statments???

Is this what you meant?

if so, it is easily implementable (i say that -now- ;)
and i would be happy to do so if the consensus of users
of TruMouse desired that... i might do it anyway, cuz
i think i like it better myself anyway... it does make
'clean' reading code, i think...

thanks for noticing that tho... mistakes like that are
so easy to make, and so hard to spot/debug... mebbe I
won't make it again now :)

onwards--Hawke'

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu