DarknessX
15-08-2007, 05:37 AM
OK. well, simply put, I am making a very basic game, called Tower Invasion, which is a Tower Defense look-alike. I have currently made some graphics, and I'm trying to display the backgrounds and some roads. However, I can't seem to make the program compile unless the sdl_blitsurface(road_vertical,nil,screen,nil); 2nd and 4rth parameters are 'nil'. Anything else, and it won't compile. I'm using Free Pascal, just plain old Free Pascal, no delphi, etc etc. Jedi-SDL is setup properly, and the graphic is working fine...
This is a picture of what it looks like when run:
http://i209.photobucket.com/albums/bb268/Death3464/beginningstage.png
Program TowerInvasion;
uses sdl, sdl_image, crt;
const
//version and author info
appver = 0;
appauthor = 'DarknessX';
appdate = 'Aug 12, 07';
grass = 'C:\Projects\Tower Invasion\gfx\grass.png';
road_vert = 'C:\Projects\Tower Invasion\gfx\road1_vertical.png';
//screen info
resx = 900; //X axis resolution... Width of screen.
resy = 900; //Y axis resolution... height of screen.
var
debugmode : boolean; //This is a switch for several things, including error
//reporting. This switch will force error reporting to save to a file,
//instead of writing it to the screen.
f : text; //This is for any file writing that may occur.
//screens
screen : pSDL_Surface; //the actual screen
background : pSDL_Surface; //forest background
road_vertical : pSDL_Surface; //upward path, no ends.
road_horizontal : pSDL_Surface; //leftward path, no ends.
road_lefturn : pSDL_Surface; //going upward road turns left
road_rigturn : pSDL_Surface; //going upward road turns right
road_dlefturn : pSDL_Surface; //going downward road turns left
road_frigturn : pSDL_Surface; //going downward road turns right
Procedure ReportError(error: integer; writefile: boolean);
begin
.....
end;
Procedure Initiate;
begin
debugmode := true;
SDL_Init(SDL_Init_Video);
screen := SDL_SetVideoMode(resx,resy,32,SDL_SWSURFACE);
if screen = nil then ReportError(1,debugmode);
end;
Procedure Quit;
begin
SDL_FreeSurface(background);
SDL_FreeSurface(screen);
SDL_Quit;
end;
begin
Initiate;
repeat
background := IMG_Load(grass);
if background = nil then ReportError(1,debugmode);
road_vertical := IMG_Load(road_vert);
if road_vertical = nil then ReportError(1,debugmode);
sdl_blitsurface(background,nil,screen,nil);
sdl_blitsurface(road_vertical,nil,screen,nil);
sdl_flip(screen);
until debugmode = false;
readln;
Quit;
end.
This is a picture of what it looks like when run:
http://i209.photobucket.com/albums/bb268/Death3464/beginningstage.png
Program TowerInvasion;
uses sdl, sdl_image, crt;
const
//version and author info
appver = 0;
appauthor = 'DarknessX';
appdate = 'Aug 12, 07';
grass = 'C:\Projects\Tower Invasion\gfx\grass.png';
road_vert = 'C:\Projects\Tower Invasion\gfx\road1_vertical.png';
//screen info
resx = 900; //X axis resolution... Width of screen.
resy = 900; //Y axis resolution... height of screen.
var
debugmode : boolean; //This is a switch for several things, including error
//reporting. This switch will force error reporting to save to a file,
//instead of writing it to the screen.
f : text; //This is for any file writing that may occur.
//screens
screen : pSDL_Surface; //the actual screen
background : pSDL_Surface; //forest background
road_vertical : pSDL_Surface; //upward path, no ends.
road_horizontal : pSDL_Surface; //leftward path, no ends.
road_lefturn : pSDL_Surface; //going upward road turns left
road_rigturn : pSDL_Surface; //going upward road turns right
road_dlefturn : pSDL_Surface; //going downward road turns left
road_frigturn : pSDL_Surface; //going downward road turns right
Procedure ReportError(error: integer; writefile: boolean);
begin
.....
end;
Procedure Initiate;
begin
debugmode := true;
SDL_Init(SDL_Init_Video);
screen := SDL_SetVideoMode(resx,resy,32,SDL_SWSURFACE);
if screen = nil then ReportError(1,debugmode);
end;
Procedure Quit;
begin
SDL_FreeSurface(background);
SDL_FreeSurface(screen);
SDL_Quit;
end;
begin
Initiate;
repeat
background := IMG_Load(grass);
if background = nil then ReportError(1,debugmode);
road_vertical := IMG_Load(road_vert);
if road_vertical = nil then ReportError(1,debugmode);
sdl_blitsurface(background,nil,screen,nil);
sdl_blitsurface(road_vertical,nil,screen,nil);
sdl_flip(screen);
until debugmode = false;
readln;
Quit;
end.