Allegro.cc - Online Community

Allegro.cc Forums » Programming Questions » I can't draw_sprite

This thread is locked; no one can reply to it. rss feed Print
I can't draw_sprite
Ricardo Santos
Member #6,609
November 2005
avatar

Hi there!

I've been trying to make a draw_lit_sprite effect, but i don't quite get how to work with truecolor images :-/

I don't even can draw a sprite.. when i use draw_sprite nothing happens but with a normal bit i can see the image. What's missing?

Thanks!

   set_color_conversion(COLORCONV_KEEP_TRANS);
   BITMAP *test = load_bitmap("table.pcx", pal);
   BITMAP *buffer = create_bitmap(screen->w, screen->h);
   
   draw_sprite(test, buffer, 0, 0); // it works if i do a blit
   blit(buffer, screen, 0, 0, 0, 0, buffer->w, buffer->h);

X-G
Member #856
December 2000
avatar

Someone needs to RTFM more closely. In particular, actually look at what each argument is.

--
Since 2008-Jun-18, democracy in Sweden is dead. | 悪霊退散!悪霊退散!怨霊、物の怪、困った時は ドーマン!セーマン!ドーマン!セーマン! 直ぐに呼びましょう陰陽師レッツゴー!

Ricardo Santos
Member #6,609
November 2005
avatar

Oops, you're right. I was playing with blit and draw_sprite and forgot to switch the args. But still I can't get anything good.

The sprite looks like EGA and zoomed with scanlines. Is it colordepth problem? I tried to force colordepth to 8,16 and 32 and won't help anyway.

Todd Cope
Member #998
November 2000
avatar

Quote:

Is it colordepth problem?

Sounds like it. Make sure you set the color depth before setting the graphics mode.

X-G
Member #856
December 2000
avatar

Probably, yes. Make sure the bitmap is of the same color depth as what you're actually running. Draw_sprite won't work well with mixed color depths.

--
Since 2008-Jun-18, democracy in Sweden is dead. | 悪霊退散!悪霊退散!怨霊、物の怪、困った時は ドーマン!セーマン!ドーマン!セーマン! 直ぐに呼びましょう陰陽師レッツゴー!

Ricardo Santos
Member #6,609
November 2005
avatar

Oh i got it!

It was the set_color_conversion(COLORCONV_KEEP_TRANS);

Without conversion all goes well. Thanks

Evert
Member #794
November 2000
avatar

Quote:

It was the set_color_conversion(COLORCONV_KEEP_TRANS);

Without conversion all goes well. Thanks

Eh?
What colour depth is your program and what colour depth are your bitmaps?

James Stanley
Member #7,275
May 2006
avatar

Before calling set_gfx_mode, use set_color_depth(n), where n is an int that is the colour depth you require.

LennyLen
Member #5,313
December 2004
avatar

Quote:

Before calling set_gfx_mode, use set_color_depth(n), where n is an int that is the colour depth you require.

Read before you post! It's already been established that the problem lay elsewhere.

Go to: