Sdl_gfx & Circlecolor(...);


JyCet

Member
Joined
Feb 23, 2004
Messages
469
Age
118
Location
France
Website
Visit site
Hi all,
I've updated all my lib with the last Prebuilt library packages for my devkit.
The speed are boosted around 15% to 20%, it's fantastic ! But it dont resolve my program crash when I test to use circleColor(...); of sdl_gfx library

I've included SDL_gfx lib in my makefile
Added header #include <SDL_gfxPrimitives.h> in my program
use it here:
CODE
void fade_out()
{
printf("debut fade out\n");
Uint32 Pnoir = SDL_MapRGB(lcd_back->format, 0, 0, 0);
printf("copie lcd\n");
SDL_BlitSurface(lcd_back,0,bg_tmp,0);
signed int rayon = 200;
printf("premier cercle\n");
circleColor(bg_tmp, 160, 120, rayon, Pnoir);
int Exit = 0;
printf("debut boucle\n");
while(!Exit){
if (rayon<0) Exit=1;
SDL_BlitSurface(bg_tmp,0,lcd_back,0);
circleColor(bg_tmp, 160, 120, rayon, Pnoir);
rafraichir_ecran();
--rayon;
}
printf("fin fade out\n");
}


I've no error at compilation ... but the program crash at circleColor(bg_tmp, 160, 120, rayon, Pnoir); :(

Any suggestion or help are welcome :)
JYCET
 
JyCet said:
CODE

circleColor(bg_tmp, 160, 120, rayon, Pnoir);

What happens when you use circleRGBA instead of circleColor? I always use the former, since I don't have to predefine colors.
CODE

circleRGBA(bg_tmp, 160, 120, rayon, 0, 0, 0, 255);
 
Last edited by a moderator:
Allen Schmidt said:
What happens when you use circleRGBA instead of circleColor? I always use the former, since I don't have to predefine colors.
CODE

circleRGBA(bg_tmp, 160, 120, rayon, 0, 0, 0, 255);

unfortunately circleRGBA crash too :(
here my telnet log but i've no more information
CODE
...
debut fade out
copie lcd
premier cercle
Fatal signal: Segmentation Fault (SDL Parachute Deployed)
 
Last edited by a moderator:
Ok, I checked the docs for SDL_BlitSurface.

You should have NULL instead of 0, so try:

CODE

SDL_BlitSurface(lcd_back,NULL,bg_tmp,NULL);


and

CODE

SDL_BlitSurface(bg_tmp,NULL,lcd_back,NULL);



I think what happened is that you copied the screen to the temp background, but used 0, so the bg_temp Surface was completely empty. You then tried to draw to it, which caused it to crash.

Hope that helps!
 
I just downloaded and updated my DevKitGP2X setup, and circleRGBA does not crash. You're using the Open2x tool chain though, right?
 
Allen Schmidt said:
Ok, I checked the docs for SDL_BlitSurface.

You should have NULL instead of 0, so try:

CODE

SDL_BlitSurface(lcd_back,NULL,bg_tmp,NULL);


and

CODE

SDL_BlitSurface(bg_tmp,NULL,lcd_back,NULL);



I think what happened is that you copied the screen to the temp background, but used 0, so the bg_temp Surface was completely empty. You then tried to draw to it, which caused it to crash.

Hope that helps!


True the crash comes when I write something on bg_tmp surface !
With NULL it dont crash :p

Thank you a lot !

For SDL_gfx, I've added another circle function directly in my program and it's very fast, I'll keep it :)
But I ll test circleColor tomorrow after a long night :D

@Alex.
I use DevKitGP2X and the update with all lib of open2x site increase the FPS around +15% to +20%.
Now my new game work perfectly at 45MHz for the best audio quality and 35MHz for the lower audio quality ;)
 
Last edited by a moderator:
Back
Top