[SDL] Blitting Problem
Kevin Macey
image28 at xtra.co.nz
Mon Jan 8 14:14:01 PST 2007
I'm having trouble bliting a surface to the screen
surface. it's telling me I'm passing an incorrect
argument type, But the type is SDL_Rect.
Can anyone offer any suggestions.
[ERROR CODE]
src/window.c: In function `window':
src/window.c:95: error: incompatible type for argument 2 of `SDL_UpperBlit'
src/window.c:95: error: incompatible type for argument 4 of `SDL_UpperBlit'
c:\mingw\bin\mingw32-make: *** [lib/window.o] Error 1
[CODE BELLOW] Copyright Kevin Macey 2006 [CODE BELLOW]
void window(struct container *screen, struct colour colour, SDL_Rect
area, struct container *content, char name[1000], int shade, int
titlebar, int border, int close, int iconify, int zoom, int update )
{
int x,y;
SDL_Rect title;
SDL_Rect cbutton;
SDL_Rect shaded;
SDL_Rect windowarea;
struct colour fillcolour;
struct colour background;
fillcolour.R=0;
fillcolour.G=0;
fillcolour.B=colour.B-150;
background.R=25;
background.G=50;
background.B=75;
cbutton.x=area.w-25;
cbutton.y=area.y+5;
cbutton.w=area.w-5;
cbutton.h=area.h-5;
title.x=area.x+4;
title.y=area.y+4;
title.w=area.w-1;
title.h=area.y+30;
windowarea.x=area.x+5;
windowarea.y=area.y+35;
windowarea.w=area.w;
windowarea.h=area.h;
shaded.x=area.x;
shaded.y=area.y;
shaded.w=area.w-1;
shaded.h=area.y+31;
// check if window isnt shaded
if ( titlebar )
{
FillRect(screen, fillcolour, title, 0);
// draw title bar if there is one
DrawFrame(screen,colour,title,0,1,0);
title.x=area.x+15;
title.y=area.y+15;
title.w=area.w-35;
title.h=area.x+25;
drawText(screen, colour, title, name, 1,1, 0);
if ( close )
{
cbutton.x=area.w;
cbutton.y=area.y;
cbutton.w=area.w;
cbutton.h=area.y+25;
//button(screen,colour,cbutton,1,0,0);
}
if ( shade )
{
if ( border )
DrawFrame(screen,colour,shaded,0,2,0);
}else{
if ( border )
DrawFrame(screen,colour,area,0,2,0);
// draw window contents
for(y=windowarea.y; y < windowarea.h; y++)
{
for(x=windowarea.x; x < windowarea.w; x++)
{
DrawPixel(screen,background,x,y,0);
}
}
if( SDL_BlitSurface(content->image, content.area, screen->image,
windowarea) < 0 )
fprintf(stderr, "BlitSurface error: %s\n", SDL_GetError());
}
}
if ( update )
SDL_UpdateRects(screen->image, 1, &area);
}
More information about the SDL
mailing list