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