so://phie

freezo

A retro platform game
git clone git://soophie.de/freezo

blob: 135e9b968e58d5ac7090f76f8170f4879c6d7e21 (1013 bytes)[doc][blame][raw]

1#pragma once

2

3#include <stdbool.h>

4

5#include "../lib/raylib.h"

6

7#define UNUSED(x) (void)(x)

8

9typedef Vector2 pos_t;

10typedef Rectangle rect_t;

11typedef struct Timer fz_timer_t;

12

13#include "game.h"

14

15struct Timer {

16 int frames;

17 int count;

18 int step;

19};

20

21fz_timer_t *fz_timer_create(int frames, int step);

22bool fz_timer_check(fz_timer_t *timer);

23void fz_timer_update(fz_timer_t *timer);

24void fz_timer_reset(fz_timer_t *timer);

25int fz_timer_get(fz_timer_t *timer);

26void fz_timer_free(fz_timer_t *timer);

27

28pos_t pos_snap(pos_t vec);

29

30rect_t rect_from_pos(pos_t pos, int width, int height);

31bool rect_collide(rect_t a, rect_t b);

32

33Texture texture_load(char *filename, int scale);

34Rectangle texture_rect(int x, int y, int width, int height);

35Rectangle texture_rect_v(int x, int y, int width, int height, int size_x, int size_y);

36

37typedef enum {

38 TEXT_ALIGNMENT_LEFT,

39 TEXT_ALIGNMENT_RIGHT,

40 TEXT_ALIGNMENT_CENTER,

41} text_alignment_e;

42

43void text_draw(pos_t pos, char *text, text_alignment_e alignment, game_t *game);