Load zone files.
[cantaveria.git] / main.c
blobf5ad9ad743e13af9b48e8511a3fe84c4a4605a4e
1 /*
2 Cantaveria - action adventure platform game
3 Copyright (C) 2009 Evan Rinehart
5 This program is free software; you can redistribute it and/or
6 modify it under the terms of the GNU General Public License
7 as published by the Free Software Foundation; either version 2
8 of the License, or (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to
18 The Free Software Foundation, Inc.
19 51 Franklin Street, Fifth Floor
20 Boston, MA 02110-1301, USA
23 #include <stdio.h>
25 #include "util.h"
26 #include "game.h"
27 #include "backend.h"
28 #include "intro.h"
29 #include "loader.h"
30 #include "graphics.h"
31 #include "text.h"
33 void update(){
34 animate_sprites();
35 game.update();
38 void main_loop(){
39 since();
40 int T = 0;
41 while(1){
42 T += since();
43 for(int i=0; i<T/dt; i++){
44 input();
45 update();
47 if(T/dt > 0){
48 draw();
49 T %= dt;
51 if(game.end){break;}
52 delay(DELAY_AMOUNT);
56 void main_init(int argc, char* argv[]){
57 backend_init(argc, argv);
58 loader_init();
59 graphics_init();
60 text_init();
63 void main_quit(){
64 loader_quit();
65 backend_quit();
68 int main(int argc, char* argv[]){
70 main_init(argc, argv);
72 intro_setup();
73 main_loop();
75 main_quit();
77 return 0;