summaryrefslogtreecommitdiffstats
path: root/globals.h
blob: b28bf18542f4db8f93809cfd691207117af5806f (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
#ifndef GLOBALS_H
#define GLOBALS_H

#define FRAMERATE 14
#define BUF_SZ 1024
/* the amount to offset the rainbow off the center of the cat */
#define OFFSET 25
#define PI 3.14159265

/* type definitions */
typedef struct {
    int x, y;
} coords;

typedef struct cat cat_instance;
struct cat
	{
	coords loc;
	/* magic to handle the linked list */
	LIST_ENTRY(cat) entries;
	};
struct head_cat cat_list;

typedef struct rainbow rainbow_instance;
struct rainbow
	{
	coords loc;
	unsigned sprite;
	/* magic to handle the linked list */
	LIST_ENTRY(rainbow) entries;
	};
struct head_rainbow rainbow_list;

typedef struct sparkle sparkle_instance;
struct sparkle
	{
	unsigned short frame, speed;
	short frame_mov;
	unsigned short layer;
	coords loc;
	/* magic to handle the linked list */
	LIST_ENTRY(sparkle) entries;
	};
struct head_sparkle sparkle_list;

SDL_Event event;
bool running = true, sound = true, fullscreen = true, cursor = false, sine = false;
int sound_volume = 128, sparkle_spawn_counter = 0;
Mix_Music *music;

#define BASE_PATH "res"
char *cat_dir;

LIST_HEAD(head_cat, cat);
LIST_HEAD(head_rainbow, rainbow);
LIST_HEAD(head_sparkle, sparkle);

int cat_width, cat_height, rainbow_width, rainbow_height, sparkle_width, sparkle_height;
SDL_Renderer *renderer;
SDL_Texture *cat_texture, *rainbow_texture, *sparkle_texture;
uint32_t cat_sprite, rainbow_sprite, sparkle_sprite;
int cat_count, sparkle_count, rainbow_count;
int sparkle_pos;
/* for sine */
unsigned t;

unsigned cat_num = 1;
double cat_size = 1;

/* default screen size for windowed */
unsigned SCREEN_WIDTH = 1200;
unsigned SCREEN_HEIGHT = 800;

#endif