-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtexture.c
60 lines (49 loc) · 1.54 KB
/
texture.c
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
#include <stdio.h>
#include "additions.h"
#include "texture.h"
void TextureLoad (SDL_Texture** texture, const char* fileName)
{
if (FileExists (fileName))
*texture = EngineLoadTexture (fileName);
else
printf ("File '%s' doesn't exists!\n", fileName);
}
void LoadTextures()
{
uint16 i;
char textBuffer[30];
/* TEXTURES for PLAYER */
for (i = 0; i < 7; i++)
{
sprintf (textBuffer, "./media/tex/player%i.png", i);
TextureLoad (&playerTextures[i], textBuffer);
}
/* TEXTURES for BIG PLAYER */
for (i = 0; i < 6; i++)
{
sprintf (textBuffer, "./media/tex/big_player%i.png", i);
TextureLoad (&playerTextures[i + 7], textBuffer);
}
/* TEXTURES for GOOMBA */
for (i = 0; i < 3; i++)
{
sprintf (textBuffer, "./media/tex/goomba%i.png", i);
TextureLoad (&goombaTextures[i], textBuffer);
}
/* TEXTURES for LEVEL OBJECTS */
TextureLoad (&levelTextures, "./media/tex/tiles.png");
/* surprises */
TextureLoad (&surpriseTextures[0], "./media/tex/mushroom.png");
/* misc */
TextureLoad (&miscTextures[0], "./media/tex/brick.png");
TextureLoad (&miscTextures[1], "./media/tex/blood.png");
TextureLoad (&miscTextures[2], "./media/tex/dust.png");
}
void TextureArraySetColor (SDL_Texture** textures, const ubyte r, const ubyte g, const ubyte b, uint16 count)
{
for (uint16 i = 0; i < count; i++)
{
SDL_SetTextureColorMod (*textures, r, g, b);
textures++;
}
}