Allegro.cc - Online Community

Allegro.cc Forums » Programming Questions » set color depth, paint, and mouse cursor

This thread is locked; no one can reply to it. rss feed Print
set color depth, paint, and mouse cursor
aadfo824
Member #7,264
May 2006

I'm working my way through Game Programming All in One, I'm up to Chapter 7. Between Chp 7 and Chp 5 I'm trying to figure out how to set the mouse pointer to a bmp I drew with paint. Paint can save as 24 bit, 16 bit, and 256 color (8 bit, right?). The image is a wite x(two lines) with a transparent background. If i save as 16 bit, black works as a transparent color. Pink doesn't work. I tried changing the color depth, but the screen turns blue if I change to 16 bit, and black on 24 bit. Although, on 24 bit the mouse with pink background displays fine. I'm thinking that I have a bad video card, even though the computer isn't that old. Can anybody help me out?

gnolam
Member #2,030
March 2002
avatar

Show us the code.

My guess is you're setting the color depth after setting a graphics mode or loading your bitmaps...

--
Move to the Democratic People's Republic of Vivendi Universal (formerly known as Sweden) - officially democracy- and privacy-free since 2008-06-18!

aadfo824
Member #7,265
May 2006

Here is the code

 allegro_init();
 set_color_depth(8); //What should I set as?
 set_gfx_mode(GFX_AUTODETECT_WINDOWED, 640, 480, 0, 0);
 
 //some irrevelant(to mouse) such as declaring variables 

 install_mouse();
 
 BITMAP * mouse = load_bitmap("pointer.bmp", NULL);
 set_mouse_sprite(mouse);
 set_mouse_sprite_focus(0,0);
 show_mouse(screen);

Remember the MS Paint side of it too.

Onewing
Member #6,152
August 2005
avatar

What edition of the Game Programming All in One book are you using? Anyway, don't forget about allegro.cc's online manual. Look up set_color_depth if you want to know how it works exactly.

Get familiar with the manual. I've used the GPAiO book as well (2nd edition), but the manual completes the knowledge from that book.

------------
Solo-Games.org | My Tech Blog: The Digital Helm

aadfo824
Member #7,265
May 2006

I'm using the 2nd edition. I checked the manual, I'm doing everything right. Maybe I need to call set_color_conversion, but whenever I try, I get

error said:

variable or field `set_color_conversion' declared void

Evert
Member #794
November 2000
avatar

Quote:

set_color_depth(8); //What should I set as?

Whatever youwant to use for colour depth. 16 should be a sensible default value.

Anyway, post your bitmap.

Quote:

variable or field `set_color_conversion' declared void

No idea. Post some code that produces this error.

aadfo824
Member #7,265
May 2006

Hooray that fixes the mouse, but it causes me another problem. I have been using 0-15 for colors, and now They all display as black and blue. Well, I'll just have to fix it with makecol.

Thank you for all your help.

Go to: