01/05/13 13:58
Poggi Marco
Intendo definire un record che racchiuda le "proprietà" del mouse, ed usarlo localmente, invece di dichiarare delle variabili globali.
Esempio:
Esempio:
TYPE tMouseDati h AS INTEGER ' coordinata x' v AS INTEGER ' coordinata y' b AS INTEGER ' bottone premuto END TYPE ... ' La funzione diventa: SUB mouse (Funk AS INTEGER, t AS tMouseDati) STATIC Crsr 'Track whether Cursor is shown. IF Funk = 1 THEN Crsr = 1 'Show Cursor. IF Funk = 2 AND Crsr = 0 THEN EXIT SUB 'Don't hide Cursor more than once. IF Funk = 2 AND Crsr = 1 THEN : Crsr = 0 'Hide Cursor. POKE 100, 184: POKE 101, Funk: POKE 102, 0 'Poke machine code necessary for POKE 103, 205: POKE 104, 51: POKE 105, 137 'using the mouse into memory POKE 106, 30: POKE 107, 170: POKE 108, 10 'starting at offset 100 in the POKE 109, 137: POKE 110, 14: POKE 111, 187 'current segment. This code is POKE 112, 11: POKE 113, 137: POKE 114, 22 'then executed as a unit, via the POKE 115, 204: POKE 116, 12: POKE 117, 203 'statement " Call Absolute ". CALL Absolute(100) 'Call machine code. t.b = PEEK(&HAAA) 'Get values for Buttons. t.h = (PEEK(&HBBB) + PEEK(&HBBC) * 256) 'Horizontal position ( 2 bytes ). t.v = (PEEK(&HCCC) + PEEK(&HCCD) * 256) 'Vertical position ( 2 bytes ). END SUB
aaa