diff options
author | Gentoo <installgentoo@endianness.com> | 2021-01-06 21:45:09 +1100 |
---|---|---|
committer | Gentoo <installgentoo@endianness.com> | 2021-01-06 21:45:09 +1100 |
commit | c7def3172977a8d128ff9882d67e604e480f3499 (patch) | |
tree | 43e0202544ac268462bc6b0ac5228512167a71db /globals.h | |
parent | ba38b130577b92c33a6ef34fec829b38cd647212 (diff) | |
download | nyancat-c7def3172977a8d128ff9882d67e604e480f3499.tar.gz nyancat-c7def3172977a8d128ff9882d67e604e480f3499.tar.bz2 nyancat-c7def3172977a8d128ff9882d67e604e480f3499.zip |
+ported to SDL2 +split cat and rainbow draw calls and functions +/- split cat and rainbow images +/- made rainbows drift off screen +spritesheets are now used instead of individual images +"fixed" indentation +replaced old argument code with getopt +added argument that lets you spawn N cats +/- made scaling work (poor results but no longer crashes) +added option to make cat follow sine wave -removed multi screen code (SDL2 fullscreen only works with one screen)
Diffstat (limited to 'globals.h')
-rw-r--r-- | globals.h | 66 |
1 files changed, 66 insertions, 0 deletions
diff --git a/globals.h b/globals.h new file mode 100644 index 0000000..65b8aaa --- /dev/null +++ b/globals.h @@ -0,0 +1,66 @@ +#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_instance cat_instance;
+struct cat_instance
+ {
+ coords loc;
+ struct list_head list;
+ };
+
+typedef struct rainbow_instance rainbow_instance;
+struct rainbow_instance
+ {
+ coords loc;
+ unsigned sprite;
+ struct list_head list;
+ };
+
+typedef struct sparkle_instance sparkle_instance;
+struct sparkle_instance
+ {
+ unsigned int frame, speed;
+ int frame_mov;
+ unsigned int layer;
+ coords loc;
+ struct list_head list;
+ };
+
+SDL_Event event;
+bool running = true, sound = true, fullscreen = true, cursor = false, sine = false;
+int sound_volume = 128, catsize = 0, sparkle_spawn_counter = 0;
+Mix_Music *music;
+
+#define BASE_PATH "res"
+char *cat_dir;
+LIST_HEAD(sparkle_list);
+LIST_HEAD(cat_list);
+LIST_HEAD(rainbow_list);
+
+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;
+
+unsigned SCREEN_WIDTH = 1200;
+unsigned SCREEN_HEIGHT = 800;
+
+#endif
|