Re: [AD] mouse pointer colors

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


In reply to Peter Wang <tjaden@xxxxxxxxxx>:
>I like the constructor thing better.  Care to do it? 

OK, it's done. If there are any other dependencies on the mouse code (I
didn't look for them), then we can just change _mouse_constructor() and
add a few function pointers to deal with them nicely :-)

Index: include/allegro/aintern.h
===================================================================
RCS file: /cvsroot/alleg/allegro/include/allegro/aintern.h,v
retrieving revision 1.18
diff -u -r1.18 aintern.h
--- include/allegro/aintern.h	2001/02/14 23:34:03	1.18
+++ include/allegro/aintern.h	2001/03/03 12:47:18
@@ -98,6 +98,7 @@
 /* various bits of mouse stuff */
 AL_FUNC(void, _handle_mouse_input, (void));
 AL_FUNC(void, _set_mouse_range, (void));
+AL_FUNCPTR(void, _set_mouse_range_pointer, (void));
 
 AL_VAR(int, _mouse_x);
 AL_VAR(int, _mouse_y);
Index: src/allegro.c
===================================================================
RCS file: /cvsroot/alleg/allegro/src/allegro.c,v
retrieving revision 1.7
diff -u -r1.7 allegro.c
--- src/allegro.c	2001/02/15 00:56:33	1.7
+++ src/allegro.c	2001/03/03 12:47:36
@@ -257,9 +257,11 @@
       /* call constructor functions manually */
       extern void _initialize_datafile_types();
       extern void _midi_constructor();
+      extern void _mouse_constructor();
 
       _initialize_datafile_types();
       _midi_constructor();
+      _mouse_constructor();
    #endif
 
    if (errno_ptr)
Index: src/graphics.c
===================================================================
RCS file: /cvsroot/alleg/allegro/src/graphics.c,v
retrieving revision 1.4
diff -u -r1.4 graphics.c
--- src/graphics.c	2000/12/10 19:16:18	1.4
+++ src/graphics.c	2001/03/03 12:47:45
@@ -33,6 +33,9 @@
 
 int _safe_gfx_mode_change = 0;	       /* are we getting through GFX_SAFE? */
 
+void (*_set_mouse_range_pointer)() = 0;
+                                       /* set by mouse.c if mouse is linked */
+
 RGB_MAP *rgb_map = NULL;               /* RGB -> palette entry conversion */
 
 COLOR_MAP *color_map = NULL;           /* translucency/lighting table */
@@ -561,7 +564,9 @@
    }
 
    clear(screen);
-   _set_mouse_range();
+
+   if(_set_mouse_range_pointer) _set_mouse_range_pointer();
+
    LOCK_DATA(gfx_driver, sizeof(GFX_DRIVER));
 
    _register_switch_bitmap(screen, NULL);
Index: src/mouse.c
===================================================================
RCS file: /cvsroot/alleg/allegro/src/mouse.c,v
retrieving revision 1.6
diff -u -r1.6 mouse.c
--- src/mouse.c	2001/03/03 00:17:28	1.6
+++ src/mouse.c	2001/03/03 12:48:01
@@ -955,3 +955,16 @@
 
    _remove_exit_func(remove_mouse);
 }
+
+/* _mouse_constructor:
+ *  Register my functions with the code in sound.c.
+ */
+#ifdef CONSTRUCTOR_FUNCTION
+   CONSTRUCTOR_FUNCTION(void _mouse_constructor());
+#endif
+
+void _mouse_constructor()
+{
+   _set_mouse_range_pointer = _set_mouse_range;
+}
+
Bye for now,
-- 
Laurence Withers, lwithers@xxxxxxxxxx
                http://www.lwithers.demon.co.uk/

Attachment: signature.asc
Description: PGP signature



Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/