FPS Limiting for the main menu display code
[tennix.git] / tennix.h
blobb137bd4918622bc6457583808add944150adde5a
2 /**
4 * Tennix! SDL Port
5 * Copyright (C) 2003, 2007, 2008 Thomas Perl <thp@perli.net>
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version 2
10 * of the License, or (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
20 * MA 02110-1301, USA.
22 **/
24 #ifndef __TENNIX_H
25 #define __TENNIX_H
27 #include <sys/param.h>
29 #include "SDL.h"
32 #define COPYRIGHT "Copyright 2003, 2007, 2008 Thomas Perl"
33 #define URL "http://icculus.org/tennix/"
35 #define WIDTH 640
36 #define HEIGHT 480
38 #define MENU_BUTTON_HEIGHT 62
39 #define MENU_BUTTON_WIDTH 185
41 #define MENU_START_YPOS 150
42 #define MENU_RESUME_YPOS 230
43 #define MENU_QUIT_YPOS 350
45 #define M_POS_XPOS(x) (x>WIDTH-MENU_BUTTON_WIDTH)
46 #define M_POS_START(y) (y>MENU_START_YPOS && y<MENU_START_YPOS+MENU_BUTTON_HEIGHT)
47 #define M_POS_RESUME(y) (y>MENU_RESUME_YPOS && y<MENU_RESUME_YPOS+MENU_BUTTON_HEIGHT)
48 #define M_POS_QUIT(y) (y>MENU_QUIT_YPOS && y<MENU_QUIT_YPOS+MENU_BUTTON_HEIGHT)
50 enum {
51 MENU_NONE = 0,
52 MENU_START = 1,
53 MENU_RESUME = 2,
54 MENU_QUIT = 4
57 #define M_POS_DECODE(x,y) (M_POS_XPOS(x)?((M_POS_START(y))?(MENU_START):((M_POS_QUIT(y))?(MENU_QUIT):((M_POS_RESUME(y))?(MENU_RESUME):(MENU_NONE)))):(MENU_NONE))
60 /* Comment the following #define to disable FPS limiting */
61 #define ENABLE_FPS_LIMIT
62 #define DEFAULT_FPS 33
65 extern SDL_Surface *screen;
67 typedef struct {
68 const char* data;
69 unsigned int size;
70 } ResourceData;
72 #define RESOURCE(x) ((ResourceData){ x, sizeof( x) })
74 typedef struct {
75 int x;
76 int y;
77 float current_x;
78 float current_y;
79 int new_x;
80 int new_y;
81 int w;
82 int h;
83 float phase;
84 int r;
85 int g;
86 int b;
87 int size;
88 int new_size;
89 } Point;
91 #endif