Mercurial > hg > pub > prymula > com
diff trix/src/trix.h @ 0:2787f5e749ae
INIT
author | prymula <prymula76@outlook.com> |
---|---|
date | Thu, 21 Sep 2023 22:33:57 +0200 |
parents | |
children |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/trix/src/trix.h Thu Sep 21 22:33:57 2023 +0200 @@ -0,0 +1,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