NEWS: Welcome to my new homepage! <3

util.h - freezo - A retro platform game

freezo

A retro platform game
git clone git://192.168.2.2/freezo
Log | Files | Refs | README

util.h (885B)


      1 #pragma once
      2 
      3 #include <stdbool.h>
      4 
      5 #include "libs/raylib.h"
      6 
      7 #define UNUSED(x) (void)(x)
      8 
      9 typedef Vector2 pos_t;
     10 typedef Rectangle rect_t;
     11 typedef struct Timer timer_t;
     12 
     13 #include "game.h"
     14 
     15 struct Timer {
     16   int frames;
     17   int count;
     18   int step;
     19 };
     20 
     21 timer_t *timer_create(int frames, int step);
     22 bool timer_check(timer_t *timer);
     23 void timer_update(timer_t *timer);
     24 void timer_reset(timer_t *timer);
     25 int timer_get(timer_t *timer);
     26 void timer_free(timer_t *timer);
     27 
     28 pos_t pos_snap(pos_t vec);
     29 
     30 rect_t rect_from_pos(pos_t pos, int width, int height);
     31 bool rect_collide(rect_t a, rect_t b);
     32 
     33 Texture texture_load(char *filename, int scale);
     34 Rectangle texture_rect(int x, int y, int width, int height);
     35 
     36 typedef enum {
     37   TEXT_ALIGNMENT_LEFT,
     38   TEXT_ALIGNMENT_RIGHT,
     39   TEXT_ALIGNMENT_CENTER,
     40 } text_alignment_e;
     41 
     42 void text_draw(pos_t pos, char *text, text_alignment_e alignment, game_t *game);