66 lines
1 KiB
C
66 lines
1 KiB
C
|
#include <stdio.h>
|
||
|
#include <time.h>
|
||
|
#include <stdlib.h>
|
||
|
#include <SDL/SDL.h>
|
||
|
#include <SDL/SDL_image.h>
|
||
|
#include <SDL/SDL_ttf.h>
|
||
|
#include "config.h"
|
||
|
#include "Engine.h"
|
||
|
#include "Catbug.h"
|
||
|
#include "Timer.h"
|
||
|
#include "Pickups.h"
|
||
|
|
||
|
int playing = 1;
|
||
|
int quit = 0;
|
||
|
int fullscreen = 0;
|
||
|
int points = 0;
|
||
|
int threshold = 10;
|
||
|
int maxHP = STARTING_HP;
|
||
|
|
||
|
time_t ticker;
|
||
|
Timer fps;
|
||
|
SDL_Event event;
|
||
|
|
||
|
SDL_Surface* screen = NULL;
|
||
|
SDL_Surface* window = NULL;
|
||
|
|
||
|
SDL_Surface* score = NULL;
|
||
|
SDL_Surface* bg = NULL;
|
||
|
SDL_Surface* hpwedge = NULL;
|
||
|
TTF_Font* font = NULL;
|
||
|
TTF_Font* font2 = NULL;
|
||
|
|
||
|
Catbug* player;
|
||
|
Pickup** stuff;
|
||
|
|
||
|
|
||
|
int main(int argc, char* args[])
|
||
|
{
|
||
|
if (!init(argc, args))
|
||
|
{
|
||
|
printf("Init failed\n");
|
||
|
return 1;
|
||
|
}
|
||
|
printf("Init complete\n");
|
||
|
|
||
|
while (playing)
|
||
|
{
|
||
|
title();
|
||
|
resetGame();
|
||
|
while(!quit)
|
||
|
{
|
||
|
timeStart(&fps);
|
||
|
renderBG();
|
||
|
drawCatbug(player);
|
||
|
moveCatbug(player);
|
||
|
managePickups();
|
||
|
updateScore();
|
||
|
drawHP();
|
||
|
interact();
|
||
|
frameAdvance();
|
||
|
checkHP();
|
||
|
}
|
||
|
}
|
||
|
cleanup();
|
||
|
return 0;
|
||
|
}
|