mirror of
https://github.com/krislamo/Trololo
synced 2024-11-10 00:30:35 +00:00
A working state
This commit is contained in:
parent
874cc17c40
commit
895eb5ba37
22
core.cpp
22
core.cpp
@ -61,7 +61,7 @@ namespace scrnfunk
|
||||
namespace scrns
|
||||
{
|
||||
// Returns 1 (true) on success, 0 (false) on error.
|
||||
bool initiateSDL(SDL_Surface *screen, int x, int y)
|
||||
SDL_Surface * initiateSDL(SDL_Surface *screen, int x, int y)
|
||||
{
|
||||
SDL_Surface *vid_init;
|
||||
int init, ttf_ret;
|
||||
@ -71,7 +71,7 @@ namespace scrns
|
||||
if(init < 0)
|
||||
{
|
||||
fprintf(stderr, "Unable to initiate SDL: %s\n", SDL_GetError());
|
||||
return false;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
@ -80,19 +80,18 @@ namespace scrns
|
||||
if(vid_init == 0)
|
||||
{
|
||||
fprintf(stderr, "Video initialization failed: %s", SDL_GetError());
|
||||
return false;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
// Get video surface and check
|
||||
screen = SDL_GetVideoSurface();
|
||||
if(screen == 0)
|
||||
if(screen == NULL)
|
||||
{
|
||||
fprintf(stderr, "Failed to get video surface: %s", SDL_GetError());
|
||||
return false;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
// Set window title
|
||||
SDL_WM_SetCaption(WINDOW_TITLE, 0);
|
||||
|
||||
@ -102,11 +101,11 @@ namespace scrns
|
||||
if(ttf_ret == -1)
|
||||
{
|
||||
fprintf(stderr, "True Type Font initialization failed: %s", SDL_GetError());
|
||||
return false;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// Success: return video surface
|
||||
return true;
|
||||
// Success
|
||||
return screen;
|
||||
}
|
||||
|
||||
SDL_Surface * MainMenu()
|
||||
@ -126,9 +125,9 @@ namespace scrns
|
||||
// Char
|
||||
SDL_Rect clip[2];
|
||||
|
||||
initiateSDL(screen, 900, 675);
|
||||
screen = initiateSDL(screen, 900, 675);
|
||||
|
||||
if(screen == 0)
|
||||
if(screen == NULL)
|
||||
{
|
||||
fprintf(stderr, "Start up failure.\n");
|
||||
return NULL;
|
||||
@ -199,4 +198,3 @@ namespace scrns
|
||||
return screen;
|
||||
}
|
||||
}
|
||||
|
||||
|
3
main.cpp
3
main.cpp
@ -9,6 +9,9 @@ int main(int argc, char* args[])
|
||||
|
||||
screen = scrns::MainMenu();
|
||||
|
||||
if(screen == NULL)
|
||||
return 1;
|
||||
|
||||
// Check if user quit
|
||||
while(quit == 1)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user