Gfx primitives

Hey, guys.

Before I ask my question let me just inform you that I have never used gfx
primitives before.

Here goes.

Attached should ( hopefully ) be an example of a test program that should
display a green circle on the screen, I think. Yet nothing happens.

Hopefully someone can help. It’s probably something stupid that I have
forgotten.

Thanks in advance.

Mario de Sousa
-------------- next part --------------
A non-text attachment was scrubbed…
Name: SDLgfx.c
Type: application/octet-stream
Size: 451 bytes
Desc: not available
URL: http://lists.libsdl.org/pipermail/sdl-libsdl.org/attachments/20040106/485cfbc3/attachment.obj

Hi,

You’ve made 2 mistakes:

  1. Alpha value of the color of the circle should be greater than 0.
    The color value is in 0xRRGGBBAA format. The right most 1 byte is an
    alpha value and it should be 0xff for your purpose.

  2. Update your screen. For example, simply add "SDL_Flip(screen);"
    after “circleColor()”.

Here is a result.

#include <SDL/SDL.h>
#include <SDL/SDL_gfxPrimitives.h>
#include <stdlib.h>
#include <stdio.h>

SDL_Surface *screen;

int main() {
if ( SDL_Init( SDL_INIT_VIDEO ) != 0 ) {
printf( “%s\n”, SDL_GetError() );
return 1;
}
atexit( SDL_Quit );
screen = SDL_SetVideoMode( 640, 480, 16, 0 );
if ( screen == NULL ) {
printf( “%s\n”, SDL_GetError() );
return 1;
}
circleColor( screen, 320, 240, 50, 0x00ff00ff );
SDL_Flip(screen);
SDL_Delay( 5000 );
return 0;
}

Kentaro

Greets, try…

“int main( int argc, char *argv[])”

“circleColor( screen, 320, 240, 50, SDL_MapRGB( screen->format, 0, 255,
0 ));”

(Haven’t tested, just a suggestion.)

MarkOn Tuesday, January 6, 2004, at 12:27  pm, Mario de Sousa wrote:

Hey, guys.

Before I ask my question let me just inform you that I have never used
gfx
primitives before.

Here goes.

Attached should ( hopefully ) be an example of a test program that
should
display a green circle on the screen, I think. Yet nothing happens.

Hopefully someone can help. It’s probably something stupid that I have
forgotten.

Thanks in advance.

Mario de Sousa