2 Cantaveria - action adventure platform game
3 Copyright (C) 2009 2010 Evan Rinehart
5 This program is free software; you can redistribute it and/or
6 modify it under the terms of the GNU General Public License
7 as published by the Free Software Foundation; either version 2
8 of the License, or (at your option) any later version.
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.
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to
18 The Free Software Foundation, Inc.
19 51 Franklin Street, Fifth Floor
20 Boston, MA 02110-1301, USA
22 evanrinehart@gmail.com
48 void (*press
)(input in
);
49 void (*release
)(input in
);
53 static void terminate(){
59 static void press(input in
){ handler
.press(in
); }
60 static void release(input in
){ handler
.release(in
); }
62 void dispatch_error(const char* msg
){
63 error_msg("kernel.c dispatch_input: %s\n", msg
);
66 static void dispatch_input(){
67 input in
= get_input();
68 while(in
.type
!= NO_INPUT
){
70 case BUTTON_PRESS
: press(in
); break;
71 case BUTTON_RELEASE
: release(in
); break;
72 case END_OF_PROGRAM
: game_is_over(); break;
73 case SKIP_INPUT
: dispatch_error("SKIP_INPUT is not supposed to come from generator"); break;
74 case INVALID_INPUT
: dispatch_error("INVALID_INPUT produced in generator"); break;
75 case NO_INPUT
: dispatch_error("NO_INPUT is impossible here"); break;
81 void initialize(int argc
, char* argv
[]){
82 video_init(argc
, argv
);
89 rand_reset(RANDOM_SEED
);
111 void (*press
)(input in
),
112 void (*release
)(input in
)
114 handler
.update
= update
;
116 handler
.press
= press
;
117 handler
.release
= release
;