Separated backend.c into backend graphics and text .c
[cantaveria.git] / backend.h
blobae99a77a066cec68b09a7cb15c8d030864bb1031
1 /*
2 Cantaveria - action adventure platform game
3 Copyright (C) 2009 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
23 enum {
24 ESCAPE_KEY,
25 PAUSE_KEY,
27 LEFT_KEY,
28 RIGHT_KEY,
29 UP_KEY,
30 DOWN_KEY,
32 FIRE_KEY,
33 JUMP_KEY,
34 INVENTORY_KEY,
35 SPECIAL_KEY,
37 L_KEY,
38 R_KEY,
39 START_KEY,
40 SELECT_KEY
43 enum{
44 FIRE_BUTTON,
45 JUMP_BUTTON,
46 INVENTORY_BUTTON,
47 SPECIAL_BUTTON,
48 L_BUTTON,
49 R_BUTTON,
50 START_BUTTON,
51 SELECT_BUTTON
54 enum{
55 KEYUP,
56 KEYDOWN,
57 JOYMOVEX,
58 JOYMOVEY,
59 JOYPRESS,
60 JOYRELEASE,
61 FOOBAR
64 #define VERSION_MAJOR 0
65 #define VERSION_MINOR 0
67 #define JOY_MAX 32767
68 #define JOY_MIN -32768
70 #define MAX_PLAYERS 6
72 #define dt 10
73 #define DELAY_AMOUNT 1
75 #define SCREEN_W 320
76 #define SCREEN_H 240
78 #define MAX_GFX 256
81 #define COLOR_KEY 0x000000
83 #define SAMPLE_RATE 44100
84 #define BUFFER_SIZE 1024
86 #define RANDOM_SEED 57
89 void backend_init(int argc, char* argv[]);
90 void backend_quit();
92 void input(); /* pump event system */
93 void draw(); /* draw all active graphics */
95 int since(); /* ms since last time since() was called */
96 void delay(int ms); /* wait ms ms */
98 void update_video();
99 void clear_video();
101 /* input */
102 int keynum(int name); /* get key number for key name */
103 int butnum(int joy, int name); /* get button number for button name */
104 void control(int type, int par1, int par2); /* automatic control */
106 /* gfx control */
107 int load_gfx(char* filename);
108 void draw_gfx(int gfxid, int x, int y, int X, int Y, int W, int H);
109 int gfx_width(int gfxid);
110 int gfx_height(int gfxid);
112 /* sound control */
113 int load_sound(char* filename);
114 void play_sound(int id);
115 int load_music(char* filename);
116 int play_music(int id);