Mercurial > hg > pub > prymula > com
comparison trix/src/trix.h @ 0:2787f5e749ae
INIT
author | prymula <prymula76@outlook.com> |
---|---|
date | Thu, 21 Sep 2023 22:33:57 +0200 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:2787f5e749ae |
---|---|
1 /* | |
2 * Trix - klikanie po klockach | |
3 * Przemysław R. Pietraszczyk | |
4 * | |
5 * paźdżiernik 2006 r. | |
6 * | |
7 * licencja: Public Domain | |
8 */ | |
9 | |
10 #ifndef TRIX_H | |
11 #define TRIX_H | |
12 | |
13 #include <errno.h> | |
14 #include <fcntl.h> | |
15 #include <dirent.h> | |
16 #include <stdio.h> | |
17 #include <stdlib.h> | |
18 #include <unistd.h> | |
19 #include <limits.h> | |
20 #include <string.h> | |
21 #include <time.h> | |
22 #include <SDL2/SDL.h> | |
23 #include <SDL2/SDL_ttf.h> | |
24 #include <SDL2/SDL_image.h> | |
25 | |
26 #if WINDOWS | |
27 #include <windows.h> | |
28 #endif | |
29 | |
30 | |
31 #if WINDOWS | |
32 //#include "img\\banner.xpm" | |
33 #include "..img/banner.xpm" | |
34 #include "..img/about.xpm" | |
35 #elif LINUX | |
36 #include "../img/banner.xpm" | |
37 #include "../img/about.xpm" | |
38 #endif | |
39 | |
40 | |
41 #define FONTSIZE 25 | |
42 | |
43 #define FIELD_SIZE 20 | |
44 | |
45 | |
46 | |
47 #if WINDOWS | |
48 #define CATALOGUE "img\\bg\\catalogue.txt" | |
49 #define BG_DIR "img\\bg\\" | |
50 #define ICONS "img\\icons.bmp" | |
51 #define HISCORES_FILE "hiscores" | |
52 #define NAMEFONT "ZapfHumanist.ttf" | |
53 //#define SETTINGS "trix.ini" | |
54 #define SETTINGS "settings" | |
55 #elif LINUX | |
56 #define CATALOGUE "/usr/share/trix/img/bg/catalogue.txt" | |
57 #define BG_DIR "/usr/share/trix/img/bg/" | |
58 #define ICONS "/usr/share/trix/img/icons.bmp" | |
59 #define NAMEFONT "/usr/share/trix/ZapfHumanist.ttf" | |
60 #define SETTINGS "/.trix/trixrc" | |
61 | |
62 //#define CATALOGUE "img/bg/catalogue.txt" | |
63 //#define BG_DIR "img/bg/" | |
64 //#define ICONS "img/icons.bmp" | |
65 //#define NAMEFONT "./ZapfHumanist.ttf" | |
66 //#define SETTINGS "/.trix/trixrc" | |
67 | |
68 #endif | |
69 | |
70 #define N_PIC 6 // ilosc zdjec tla | |
71 | |
72 #define START_GAME 1 | |
73 #define HISCORES 2 | |
74 #define QUIT_GAME 3 | |
75 #define ABOUT 4 | |
76 #define OPTIONS 5 | |
77 // #define GAME_OVER 6 | |
78 | |
79 | |
80 #define Y_START 200 // 100 | |
81 #define Y_HISCORES 250 // 150 | |
82 #define Y_OPTIONS 300 | |
83 #define Y_ABOUT 350 | |
84 | |
85 #define X_CENTER(w) (230-w/2) | |
86 | |
87 | |
88 | |
89 extern SDL_Surface * block[8]; | |
90 extern SDL_Surface * explode; | |
91 extern SDL_Surface * bomb; | |
92 extern SDL_Surface * wall; | |
93 extern SDL_Surface * smoke; | |
94 | |
95 extern SDL_Surface * net; | |
96 extern SDL_Surface * banner; | |
97 extern SDL_Surface * bg; | |
98 extern SDL_Surface * screen; | |
99 extern TTF_Font* font; | |
100 | |
101 extern SDL_Renderer * renderer; | |
102 extern SDL_Texture * tex_screen; | |
103 | |
104 extern SDL_Rect source, dest; | |
105 | |
106 | |
107 extern int use_net; // zmienna wyswietlania siatki | |
108 extern int start_level; // start gry od poziomu ... | |
109 extern int score; | |
110 extern int bonus; // nalicza premie | |
111 | |
112 extern char * hifile; // path do hiscore | |
113 | |
114 struct tab { | |
115 char name[20]; | |
116 int score; | |
117 }; | |
118 | |
119 extern struct tab tab_hiscores[5]; | |
120 /* | |
121 struct FIELD{ | |
122 SDL_Surface * type; | |
123 int status; // 0:brak statusu 2:stoi -1:opada 1:znika lub wybucha | |
124 } field[23][26]; | |
125 */ | |
126 struct FIELD{ | |
127 SDL_Surface * type; | |
128 int status; // 0:brak statusu 2:stoi -1:opada 1:znika lub wybucha | |
129 }; | |
130 | |
131 extern struct FIELD field[23][26]; | |
132 | |
133 #define DROP -1 // opada | |
134 #define FADE 1 // element zanika | |
135 #define STAND 2 // stoi | |
136 #define WALL 3 // murek | |
137 | |
138 | |
139 /* struktura przechowuje pozycje kasowanych elementow */ | |
140 struct ghost { | |
141 int x, y; | |
142 }; | |
143 | |
144 /* struktura przechowujaca dane o danym poziomie */ | |
145 struct data_levels { | |
146 int max; // zakres liczb losowych | |
147 int drop; // flaga zrzutu | |
148 int wall; // 1: ustawiony murek na dnie studni 0; brak murka | |
149 }; | |
150 | |
151 extern char catalogue[N_PIC][40]; // tla | |
152 | |
153 SDL_Rect set_rect(int x, int y, int w, int h); | |
154 Uint32 getpixel(SDL_Surface *surface, int x, int y); | |
155 | |
156 #endif |