www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/03/02/21:06:06

Date: Mon, 2 Mar 1998 18:05:29 -0800 (PST)
Message-Id: <199803030205.SAA00930@adit.ap.net>
Mime-Version: 1.0
To: Lee <jag*NOSPAM*@pangea.ca>, djgpp AT delorie DOT com
From: Nate Eldredge <eldredge AT ap DOT net>
Subject: Re: Allegro : Need help with mouse cursor.

At 03:45  3/2/1998 -0600, Lee wrote:
>I am having some slight difficulty in changing the mouse pointer.  What
>I have done here is taken the ex6.c from examples\ and tried to modify
>it into using a cursor which I have loaded from a bitmap file.
>Apparently, the program won't even run unless I declare int dummy as the
>first variable, 

That almost always means a bug. See below.

>and even with this, it dies after I press a key (After
>the new mouse pointer has shown up).  Any help is appreciated.  Please
>respond by removing *NOSPAM* from my email address.  Thanks.
>
><start code >
>#include <stdlib.h>
>#include <stdio.h>
>#include "allegro.h"
>
>#define XRES 320
>#define YRES 200
>
>void main(void)
>{
>   int dummy;
>   BITMAP *custom_cursor;
>   RGB *custom_pal;
>
>   allegro_init();
>   install_keyboard();
>   install_mouse();
>   install_timer();
>
>   set_gfx_mode(GFX_MODEX, XRES, YRES, 0, 0);
>   set_pallete(desktop_pallete);
>   clear_keybuf();
>   clear(screen);
>   show_mouse(NULL);
>
>   /* Load up our custom cursor  */
>   custom_cursor = load_bitmap ("mouse.bmp",custom_pal);

`custom_pal' doesn't point to anything. Try declaring it as `PALLETE
custom_pal'.

>   set_mouse_sprite(custom_cursor);
>   set_palette(custom_pal);
>   set_mouse_sprite_focus(15, 4);
>   textout_centre(screen, font, "Press a key", SCREEN_W/2, SCREEN_H/2,
>2);
>   show_mouse(screen);
>   readkey();
>
>   show_mouse(NULL);    /* Clean Up */
>   destroy_bitmap(custom_cursor);
>   allegro_exit();
>   return;
>}
><end code>
>
>
>

Nate Eldredge
eldredge AT ap DOT net



- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019