Changed the mouse API: mouse_box is gone, there are now mouse_getbox and

mouse_setbox instead. Beware: Current drivers will crash until they're
changed!


git-svn-id: svn://svn.cc65.org/cc65/trunk@4230 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
uz 2009-09-26 11:11:14 +00:00
parent 8be28482ac
commit 16e6deaf86
5 changed files with 37 additions and 48 deletions

View File

@ -6,10 +6,10 @@
;/* */
;/* */
;/* */
;/* (C) 2003-2006 Ullrich von Bassewitz */
;/* Römerstraße 52 */
;/* D-70794 Filderstadt */
;/* EMail: uz@cc65.org */
;/* (C) 2003-2009, Ullrich von Bassewitz */
;/* Roemerstrasse 52 */
;/* D-70794 Filderstadt */
;/* EMail: uz@cc65.org */
;/* */
;/* */
;/* */
@ -61,7 +61,8 @@
UNINSTALL .addr
HIDE .addr
SHOW .addr
BOX .addr
SETBOX .addr
GETBOX .addr
MOVE .addr
BUTTONS .addr
POS .addr
@ -95,7 +96,7 @@
;------------------------------------------------------------------------------
; The mouse API version, stored in MOUSE_HDR::VERSION
MOUSE_API_VERSION = $01
MOUSE_API_VERSION = $02
;------------------------------------------------------------------------------
; Bitmapped mouse driver flags, stored in MOUSE_HDR::FLAGS.
@ -127,6 +128,12 @@ MOUSE_BTN_RIGHT = $01
BUTTONS .byte
.endstruct
.struct MOUSE_BOX
MINX .word
MINY .word
MAXX .word
MAXY .word
.endstruct
;------------------------------------------------------------------------------
; Variables
@ -144,7 +151,8 @@ MOUSE_BTN_RIGHT = $01
.global _mouse_geterrormsg
.global _mouse_hide
.global _mouse_show
.global _mouse_box
.global _mouse_setbox
.global _mouse_getbox
.global _mouse_move
.global _mouse_buttons
.global _mouse_pos
@ -160,7 +168,8 @@ MOUSE_BTN_RIGHT = $01
.global mouse_uninstall
.global mouse_hide
.global mouse_show
.global mouse_box
.global mouse_setbox
.global mouse_getbox
.global mouse_move
.global mouse_buttons
.global mouse_pos

View File

@ -60,8 +60,8 @@
/* Structure containing the mouse coordinates */
struct mouse_pos {
int x;
int y;
int x;
int y;
};
/* Structure containing information about the mouse */
@ -70,6 +70,14 @@ struct mouse_info {
unsigned char buttons; /* Mouse button mask */
};
/* Structure used for getbox/setbox */
struct mouse_box {
int minx;
int miny;
int maxx;
int maxy;
};
/* Structure containing mouse callback functions. These functions are declared
* in C notation here, but they cannot be C functions (at least not easily),
* since they may be called from within an interrupt.
@ -133,7 +141,7 @@ void __fastcall__ mouse_hide (void);
void __fastcall__ mouse_show (void);
/* Show the mouse. See mouse_hide for more information. */
void __fastcall__ mouse_box (int minx, int miny, int maxx, int maxy);
void __fastcall__ mouse_setbox (const struct mouse_box* box);
/* Set the bounding box for the mouse pointer movement. The mouse X and Y
* coordinates will never go outside the given box.
* NOTE: The function does *not* check if the mouse is currently inside the
@ -149,6 +157,9 @@ void __fastcall__ mouse_box (int minx, int miny, int maxx, int maxy);
* are really what you want, you have to use your own cursor routines.
*/
void __fastcall__ mouse_getbox (struct mouse_box* box);
/* Get the current bounding box for the mouse pointer movement. */
void __fastcall__ mouse_move (int x, int y);
/* Set the mouse cursor to the given position. If a mouse cursor is defined
* and currently visible, the mouse cursor is also moved.

View File

@ -13,7 +13,7 @@ AS = ../../src/ca65/ca65
CC = ../../src/cc65/cc65
LD = ../../src/ld65/ld65
AFLAGS = -t $(SYS) -I../../asminc
AFLAGS = -t $(SYS) --forget-inc-paths -I../../asminc
CFLAGS = -Osir -g -T -t $(SYS) --forget-inc-paths -I . -I ../../include
#--------------------------------------------------------------------------
@ -32,8 +32,8 @@ CFLAGS = -Osir -g -T -t $(SYS) --forget-inc-paths -I . -I ../../include
C_OBJS =
S_OBJS = mouse-kernel.o \
mouse_box.o \
mouse_buttons.o \
mouse_getbox.o \
mouse_geterrormsg.o \
mouse_hide.o \
mouse_info.o \
@ -41,6 +41,7 @@ S_OBJS = mouse-kernel.o \
mouse_load.o \
mouse_move.o \
mouse_pos.o \
mouse_setbox.o \
mouse_show.o \
mouse_unload.o

View File

@ -1,5 +1,5 @@
;
; Ullrich von Bassewitz, 2003-12-28
; Ullrich von Bassewitz, 2003-12-28, 2009-09-26
;
; Common functions of the mouse driver API.
;
@ -28,7 +28,8 @@ mouse_install: jmp return0
mouse_uninstall:jmp return0
mouse_hide: jmp return0
mouse_show: jmp return0
mouse_box: jmp return0
mouse_setbox: jmp return0
mouse_getbox: jmp return0
mouse_move: jmp return0
mouse_buttons: jmp return0
mouse_pos: jmp return0

View File

@ -1,33 +0,0 @@
;
; Ullrich von Bassewitz, 2004-03-23
;
; void __fastcall__ mouse_box (int minx, int miny, int maxx, int maxy);
; /* Set the bounding box for the mouse pointer movement. The mouse X and Y
; * coordinates will never go outside the given box.
; * NOTE: The function does *not* check if the mouse is currently inside the
; * given margins. The proper way to use this function therefore is:
; *
; * - Hide the mouse
; * - Set the bounding box
; * - Place the mouse at the desired position
; * - Show the mouse again.
; *
; * NOTE2: When setting the box to something that is larger than the actual
; * screen, the positioning of the mouse cursor can fail. If such margins
; * are really what you want, you have to use your own cursor routines.
; */
;
.import incsp6
.include "mouse-kernel.inc"
.proc _mouse_box
jsr mouse_box ; Call the driver
jmp incsp6 ; Cleanup the stack
.endproc