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
|
/* c-basic-offset: 2; tab-width: 2; indent-tabs-mode: nil
* vi: set shiftwidth=2 tabstop=2 expandtab:
* :indentSize=2:tabSize=2:noTabs=true:
*/
#ifndef __H_GAME_UTILS__
#define __H_GAME_UTILS__
/*
* This file, as the rest of the project is under MIT license.
* see http://opensource.org/licenses/MIT
*
* Author Gustav Hartvigsson <gustav.hartvigsson _at_ gmail.com> 2014
*/
#include <SDL2/SDL.h>
/** @file
* This file contains a set of utility functions.
*/
/**
* Sets the renderer draw colour to the color inputted, and returns the old
* renderer colour.
*/
SDL_Color game_color_set_draw_color (SDL_Renderer * renderer,
const SDL_Color color);
/**
* create a colour.
*/
SDL_Color game_color_create_color (int r, int g, int b, int a);
/**
* Create a rectangle;
*/
SDL_Rect game_rect_create_rect (int x, int y, int h, int w);
/**
* allocate a new rectangle.
*
* This must be freed by the user.
*/
SDL_Rect * game_rect_new (int x, int y, int h, int w);
/**
* Print a good loocking warning message.
*/
void print_error (const char * str, ... );
#endif
|