found the problem
// New Screen! -- Draw Background
SDL_BlitSurface(Background[0], PSDLRect(0, 0, GameScreen.w, GameScreen.h), GameScreen, PSDLRect(0, 0, GameScreen.w, GameScreen.h));
the PSDLRect does a new to create a new instance of TSDL_rect then returns the pointer to you, which you must free.
Better to declare a local variable in GameCycle of TSDL_Rect ,
[pascal]
procedure GameCycle;
var Rect: TSDL_Rect;
begin
// Check Player Input
doGameInput(False);
// Game AI Input
// Perform Game Physics
Player1.Move(Levels[0]);
// Check Game Actions
// New Screen! -- Draw Background
Rect := SDLRect(0, 0, GameScreen.w, GameScreen.h)
SDL_BlitSurface(Background[0], @Rect, GameScreen, @Rect);
// Draw Tiles
DrawTiles(Levels[0]);
// Draw Sprites
Player1.Draw(GameScreen, ScreenX, ScreenY);
// Draw Effects
// Draw Foreground
// Draw FramesPerSecond!
{ Update Screen }
SDL_Flip(GameScreen);
end;
[/pascal]
or just pass nil instead of SDL_Rects as this will blit the entire surface. The same thing is in DrawTile as well.
Dean
Bookmarks