Jump to content
  • Advertisement
Sign in to follow this  
rherm23

Allegro mouse question

This topic is 4352 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I am using C++ and Allegro for this. I have created some games in Allegro but none have had any mouse support so now I am trying to do a simple test of the mouse and i cant seem to get it to work. It compiles fine but i get a runtime error. Can anyone maybe help me out here and tell me whats going on. when i debug it .. my program "craps out" at the lines of draw_sprite() and blit(). Im not sure where exactly the problem is.
#include <allegro.h>

BITMAP* buffer;
BITMAP* cursor;


int main() 
{ 
        
 allegro_init();      
 set_color_depth(24);
 set_gfx_mode(GFX_AUTODETECT_WINDOWED, 640, 480, 0, 0);
 install_keyboard();
 install_mouse();
 install_timer();
 
 buffer = create_bitmap(640,480);
 clear_bitmap(buffer);
 
 cursor = create_bitmap(16,16);
 clear_bitmap(cursor);
 cursor = load_bitmap("cursor.bmp", 0);
 
 while(!key[KEY_ESC])
 {
  clear_bitmap(buffer);
  textprintf(buffer, font, 10, 10, makecol(255,255,255), "x pos = %d   y pos = %d", mouse_x, mouse_y);
  
  draw_sprite(buffer, cursor, mouse_x, mouse_y);
  blit(buffer, screen , 0, 0, 0, 0, 640, 480);
  
 }
 
 destroy_bitmap(buffer);
 buffer = NULL;
 destroy_bitmap(cursor);
 cursor = NULL;
 
 allegro_exit();
 return 0;     
}     

// Some Allegro magic to deal with WinMain().
END_OF_MAIN();



thanks in advance [Edited by - rherm23 on June 27, 2006 1:37:57 PM]

Share this post


Link to post
Share on other sites
Advertisement
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!