* Add "less" target to view make output through less.
[matthijs/ABM2.git] / ABM2 / Amaltheia / main.cpp
1 /***************************************************************************
2  *   Copyright (C) 2005 by Dimitris Saougos & Filippos Papadopoulos   *
3  *   <psybases@gmail.com>                                                             *
4  *                                                                                                       *
5  *   This program is free software; you can redistribute it and/or modify  *
6  *   it under the terms of the GNU Library General Public License as       *
7  *   published by the Free Software Foundation; either version 2 of the    *
8  *   License, or (at your option) any later version.                                    *
9  *                                                                                                           *
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.                          *
14  *                                                                         *
15  *   You should have received a copy of the GNU Library General Public     *
16  *   License along with this program; if not, write to the                 *
17  *   Free Software Foundation, Inc.,                                       *
18  *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
19  ***************************************************************************/
20
21 //Include files
22
23 #include "Graphics.h"
24 #include "Input.h"
25 #include "md2model.h"
26 #include "Sprite.h"
27 #include "System.h"
28 #include <SDL/SDL.h>
29
30 extern bool init();
31 extern bool cleanup();
32 extern bool renderFrame();
33
34 #define _DEBUG
35
36 int key_val = 0;
37 bool key_press = false;
38 int argc = 0;
39 char **argv = 0;
40
41 int main( int _argc, char **_argv )
42 {
43         argc = _argc;
44         argv = _argv;
45
46
47 #ifndef _DEBUG
48         init();
49         while ( renderFrame() ) 
50         { ; }
51
52         cleanup();
53         return 0;
54 #else
55         SDL_Event event;
56         init(); 
57         while(renderFrame())
58         {
59                 SDL_PollEvent(&event);
60                 switch( event.type )
61                 {
62                         case SDL_KEYDOWN:
63                                 if(1 /*(&event.key.keysym)->sym == key*/)
64                                 {  
65                                 
66                                         key_val = (&event.key.keysym)->sym;/* - (((&event.key.keysym)->mod & KMOD_RSHIFT) ? 32: 0);*/
67                                         //printf("Pressed = %d\n", key_val);
68                                         if(key_val > 256)
69                                         {
70                                                 key_val = 0;
71                                                 break;
72                                         }
73                                         key_press = true;
74                                         
75                                 }
76                                 break;
77                         case SDL_KEYUP:
78                                 key_press = false;
79                                 break;
80                         default:
81                                 key_press = false;
82                                 break;
83                 }
84         }
85         cleanup();
86         return 0;
87 #endif
88 }
89