Re: Neil.E and mouse...

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

>From: Mike Hurley

>are there any current mouse libraries that will work with Neil w/o any
>modification?

       I just pasted in the following mouse code from an earlier version of
Neil
(Just before the palette code) and it seemed to work fine when I was playing
with it.

-----------------------------------------------------------------
-- MOUSE STUFF --------------------------------------------------
-----------------------------------------------------------------
global constant RESET_MOUSE = -1
global integer mouse_x, mouse_y, mouse_b,
    mouse_minx, mouse_maxx, mouse_miny, mouse_maxy
global atom mouse_sprite
mouse_b = RESET_MOUSE

global procedure mouse()
--> Updates the global mouse variables:
-->   mouse_x, mouse_y, mouse_b
--> Set mouse_minx, mouse_maxx, mouse_miny, mouse_maxy, to limit the
-->   values of mouse_x and mouse_y.
--> Set mouse_sprite to a command handle for an automatic mouse cursor.
    sequence REGS
    integer i
    if mouse_b = RESET_MOUSE then
        REGS = repeat(0, 10)
        REGS = dos_interrupt(#33, REGS) -- reset mouse
        mouse_x = 0
        mouse_y = 0
        mouse_b = 0
        mouse_minx = 0
        mouse_miny = 0
        mouse_maxx = SCREEN_W - 1
        mouse_maxy = SCREEN_H - 1
        mouse_sprite = 0
    end if

    REGS = repeat(0, 10)
    REGS[REG_AX] = #B              -- get relative motion counters
    REGS = dos_interrupt(#33, REGS)
    i = REGS[REG_CX]
    if i then
        mouse_x = mouse_x + i - 2 * and_bits(i, #8000)
        if mouse_x < mouse_minx then mouse_x = mouse_minx
        elsif mouse_x > mouse_maxx then mouse_x = mouse_maxx end if
        if mouse_sprite then
            poke4(mouse_sprite + dest_x, mouse_x)
        end if
    end if

    i = REGS[REG_DX]
    if i then
        mouse_y = mouse_y + i - 2 * and_bits(i, #8000)
        if mouse_y < mouse_miny then mouse_y = mouse_miny
        elsif mouse_y > mouse_maxy then mouse_y = mouse_maxy end if
        if mouse_sprite then
            poke4(mouse_sprite + dest_y, mouse_y)
        end if
    end if

    REGS[REG_AX] = 3               -- get mouse buttons in BX
    REGS = dos_interrupt(#33, REGS)
    mouse_b = REGS[REG_BX]
end procedure

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

Search



Quick Links

User menu

Not signed in.

Misc Menu