Silly Scribble Program

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

Ad asked for conversion of David's scribble program
to "dos", using any library of choice...

below is my answer to that 'challenge'...
it reads as easy (if not easier) as the original
winsnorz program, and doesn't require the 80 or more
megs of winsnorz *bloat*... :)

side note: since the latest update of TrueEU affects
   confined mouse work, it's best to use that latest
   version of TruMouse/TrueEU with this program...
   I'm not sure how an older version of TrueEU would
   behave while running this scribble program...

enjoy! --Hawke'

---------------------begin TruScribble.ex
include trumouse.e
object mouse
integer draw, x, y, oldx, oldy, event

procedure drawline(integer sx,integer sy,integer ex,integer ey)
   mouse_pointer(MOUSEOFF)          --hide the mouse
   true_line(sx,sy,ex,ey,TrueWhite) --draw a line
   mouse_pointer(MOUSEON)           --show the mouse
end procedure

x    = 0      y    = 0
oldx = 0      oldy = 0
draw = FALSE

mouse_cursor("cursor.tga")
mouse_init()
mouse_events(MOVE+LEFT_DOWN+LEFT_UP)

--set up a 'window'
mouse_pointer(MOUSEOFF)
mouse_confine({100,100},{250,250})
true_box(99,99,251,251,TrueBlue,FALSE)
mouse_pointer(MOUSEON)

while 1 do
        mouse = -1
        while atom(mouse) do
           mouse = get_mouse()
           if get_key()!=-1 then GoodBye() end if
        end while
        event = mouse[1]
        if event = MOVE then
           if draw then
              x = mouse[2]  y = mouse[3]
              drawline(oldx,oldy,x,y)
              oldx = x      oldy = y
           end if
        elsif event = LEFT_DOWN then
           oldx = mouse[2]  oldy = mouse[3]
           draw = TRUE
        elsif event = LEFT_UP then
           x    = mouse[2]  y    = mouse[3]
           draw = FALSE
        end if
end while
---------------------end   TruScribble.ex

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

Search



Quick Links

User menu

Not signed in.

Misc Menu