epicbeast9022 0 Newbie Poster

Hi,
I'm trying to make a pong game on Xcode 3.2 with SDL but nothing displays, just a black window.
Codes:

#include "includes.h"
#include "constants.h"
#include "functions.h"
int pscore=0,cscore=0,ppaddle=185,cpaddle=185,ballSpeed = 0,cpuPadSpd = 0,frame = 0;
SDL_Surface *screen=NULL,*secondary=NULL,*playerscore=NULL,*cpuscore=NULL,*cpuwin=NULL,*playerwin=NULL; bool gameEnded = false,selectedDiff=false;
TTF_Font *font,*humungo;
SDL_Event e;
//PongBall ball;
void cleanup() {
	SDL_Quit();
	SDL_EnableUNICODE(0);
	exit(0);
}
bool init() {
	if (SDL_Init(SDL_INIT_EVERYTHING) == -1) return false;
	if (TTF_Init() == -1) return false;
	screen = SDL_SetVideoMode(SCREEN_WIDTH,SCREEN_HEIGHT,COLORDEPTH,SDL_HWSURFACE);
	if (screen == NULL) return false;
	SDL_EnableUNICODE(1);
	SDL_WM_SetCaption("Pong", NULL);
	font = TTF_OpenFont("imagine_font.ttf",72);
	humungo = TTF_OpenFont("denmark.ttf",96);
	SDL_EnableKeyRepeat(50, 5);
	cpuwin = TTF_RenderText_Blended(humungo,"You lose!",createColor(255,255,255));
	playerwin = TTF_RenderText_Blended(humungo,"You win!",createColor(255,255,255));
	return true;
}

int main (int argc, char *argv[]) {
	if (!init()) return 1;
	fillRect(0,0,SCREEN_WIDTH,SCREEN_HEIGHT,0,0,0);
	secondary = loadImage("c0v3r.png");
	applySurface(0,0,secondary,screen);
	SDL_Flip(screen);
	SDL_Delay(2500);
	cleanup();
	return 0;
}

Other functions definitely work.

Does anybody have advice for me? (By the way it works fine in Visual C++ 2010 on Windows 7...)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.