More menu clean-ups and simplifications
[tennix.git] / tennix.h
blob17b3fd6d1588d88a4e4d4c31f51692f4e3984f82
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_OPTIONS_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_OPTIONS(y) (y>MENU_OPTIONS_YPOS && y<MENU_OPTIONS_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,
53 MENU_OPTIONS,
54 MENU_QUIT
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_OPTIONS(y))?(MENU_OPTIONS):(MENU_NONE)))):(MENU_NONE))
60 extern SDL_Surface *screen;
62 typedef struct {
63 const char* data;
64 unsigned int size;
65 } ResourceData;
67 #define RESOURCE(x) ((ResourceData){ x, sizeof( x) })
69 typedef struct {
70 int x;
71 int y;
72 float current_x;
73 float current_y;
74 int new_x;
75 int new_y;
76 int w;
77 int h;
78 float phase;
79 int r;
80 int g;
81 int b;
82 int size;
83 int new_size;
84 } Point;
86 #endif