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

From: Lee <jag*NOSPAM*@pangea.ca>
Newsgroups: comp.os.msdos.djgpp
Subject: Allegro : Need help with mouse cursor.
Date: Mon, 02 Mar 1998 15:45:37 -0600
Organization: Pangea.CA, Inc.
Lines: 50
Message-ID: <34FB2881.F4D4118F@pangea.ca>
NNTP-Posting-Host: tifa.pangea.ca
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

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, 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);
   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>

- Raw text -


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