2010-10-12 10:55:23 +02:00
|
|
|
/*
|
2011-03-05 13:44:21 +01:00
|
|
|
* This software is licensed under the terms of the MIT-License
|
|
|
|
* See COPYING for further information.
|
|
|
|
* ---
|
|
|
|
* Copyright (C) 2011, Lukas Weber <laochailan@web.de>
|
2010-10-12 10:55:23 +02:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include "global.h"
|
2010-10-18 14:40:15 +02:00
|
|
|
#include <SDL/SDL.h>
|
2010-11-14 13:24:56 +01:00
|
|
|
#include "font.h"
|
2010-10-12 10:55:23 +02:00
|
|
|
|
|
|
|
Global global;
|
|
|
|
|
|
|
|
void init_global() {
|
2011-04-24 15:39:17 +02:00
|
|
|
memset(&global, 0, sizeof(global));
|
2011-03-19 16:21:48 +01:00
|
|
|
|
2011-04-02 12:14:37 +02:00
|
|
|
alGenSources(SNDSRC_COUNT, global.sndsrc);
|
|
|
|
|
|
|
|
load_resources();
|
2011-03-19 16:21:48 +01:00
|
|
|
init_fonts();
|
2010-10-17 09:27:44 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void game_over() {
|
|
|
|
global.game_over = 1;
|
2011-03-17 21:13:11 +01:00
|
|
|
printf("Game Over!\n");
|
2010-10-12 18:17:15 +02:00
|
|
|
}
|
2010-10-18 14:40:15 +02:00
|
|
|
|
|
|
|
void frame_rate() {
|
|
|
|
int t = global.lasttime + 1000/FPS - SDL_GetTicks();
|
|
|
|
if(t > 0)
|
|
|
|
SDL_Delay(t);
|
2011-03-05 19:03:32 +01:00
|
|
|
|
2010-10-18 14:40:15 +02:00
|
|
|
global.lasttime = SDL_GetTicks();
|
|
|
|
}
|