Avoid non-alpha characters in _qdgdfv_alnum in win32.
[qdgdf.git] / qdgdf_i.c
blob13eb8802c72122b59c683c5071d1b44bae57d3c6
1 /*
3 Quick and Dirty Game Development Framework (QDGDF)
5 Copyright (C) 2001/2011 Angel Ortega <angel@triptico.com>
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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
21 http://triptico.com
23 Usage:
24 qdgdf_i [X size] [Y size] [scale] [full screen]
28 #include "config.h"
29 #include "qdgdf_video.h"
30 #include "qdgdf_audio.h"
32 #include <string.h>
34 char *info[100];
36 void build_info(void)
38 int y = 0;
40 info[y++] = strdup(qdgdfv_sprintf("QDGDF %s", _qdgdfv_version));
41 info[y++] = strdup(qdgdfv_sprintf("%d x %d (scale %d)",
42 _qdgdfv_screen_x_size,
43 _qdgdfv_screen_y_size,
44 _qdgdfv_scale));
45 info[y++] = strdup(qdgdfv_sprintf("full screen: %d",
46 _qdgdfv_full_screen));
47 info[y++] = strdup(qdgdfv_sprintf("window position: %d x %d",
48 _qdgdfv_window_x,
49 _qdgdfv_window_y));
50 info[y++] = strdup(qdgdfv_sprintf("pixel size: %d", _qdgdfv_pixel_size));
51 info[y++] = strdup(qdgdfv_sprintf("home dir: %s", qdgdfv_home_dir()));
52 info[y++] = strdup(qdgdfv_sprintf("app dir: %s", qdgdfv_app_dir()));
53 info[y++] = strdup(qdgdfv_sprintf("sound: %d (%d bit)",
54 _qdgdfa_sound,
55 _qdgdfa_16_bit ? 16 : 8));
57 #ifdef CONFOPT_OPENGL
58 info[y++] = "OpenGL support enabled";
59 #else
60 info[y++] = "OpenGL support disabled";
61 #endif
65 void show_info(void)
67 int c = qdgdfv_seek_color(255, 255, 255);
68 int y;
70 qdgdfv_clear_virtual_screen();
72 for (y = 0; info[y] != NULL; y++)
73 qdgdfv_font_print(1, y * _qdgdfv_font_height, info[y], c);
75 qdgdfv_font_print(1, y * _qdgdfv_font_height,
76 qdgdfv_sprintf("%d %c", _qdgdfv_key_alnum, _qdgdfv_alnum),
77 c);
79 qdgdfv_font_print(-1, -1, "Press ESCAPE", c);
81 qdgdfv_dump_virtual_screen();
85 void show_opengl(void)
87 #ifdef CONFOPT_OPENGL
88 static double theta = 0.0;
90 glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
91 glClear(GL_COLOR_BUFFER_BIT);
93 glPushMatrix();
94 glRotatef(theta, 0.0f, 0.0f, 1.0f);
95 glBegin(GL_TRIANGLES);
96 glColor3f(1.0f, 0.0f, 0.0f);
97 glVertex2f(0.0f, 1.0f);
98 glColor3f(0.0f, 1.0f, 0.0f);
99 glVertex2f(0.87f, -0.5f);
100 glColor3f(0.0f, 0.0f, 1.0f);
101 glVertex2f(-0.87f, -0.5f);
102 glEnd();
104 glPopMatrix();
106 theta += 1.0;
108 qdgdfv_dump_virtual_screen();
109 #endif
113 int main(int argc, char *argv[])
115 int n = 1;
117 strcpy(_qdgdfv_window_title, "QDGDF Information");
119 if (argc > n)
120 _qdgdfv_screen_x_size = atoi(argv[n++]);
121 if (argc > n)
122 _qdgdfv_screen_y_size = atoi(argv[n++]);
123 if (argc > n)
124 _qdgdfv_scale = atoi(argv[n++]);
125 if (argc > n)
126 _qdgdfv_full_screen = atoi(argv[n++]);
128 strcpy(_qdgdfv_logger_file, "qdgdf.log");
129 _qdgdfv_use_logger = 1;
131 qdgdfa_startup();
132 qdgdfv_startup();
134 build_info();
136 do {
137 show_info();
138 qdgdfv_input_poll();
139 } while (!_qdgdfv_key_escape);
141 while (_qdgdfv_key_escape)
142 qdgdfv_input_poll();
144 if (qdgdfv_opengl(1)) {
145 do {
146 show_opengl();
147 qdgdfv_input_poll();
148 } while (!_qdgdfv_key_escape);
151 qdgdfv_shutdown();
152 qdgdfa_shutdown();
154 return 0;