-
Notifications
You must be signed in to change notification settings - Fork 0
/
blocks.c
55 lines (45 loc) · 1.51 KB
/
blocks.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
#include <string.h>
#include <malloc.h>
#include "structs.h"
#include "textures.h"
#include "blocks.h"
BlockDefinition Air = {};
BlockDefinition Grass = {};
BlockDefinition Dirt = {};
BlockDefinition* blockDefinitions;
const int blockCount = 5;
void initialize_blocks(){
blockDefinitions = malloc(sizeof(BlockDefinition) * blockCount);
Air.id = 0;
strcpy(Air.name, "Air");
blockDefinitions[0] = Air;
//
// CmiBlock.id = 1;
// strcpy(CmiBlock.name, "CMI");
// all_texture(&CmiBlock, cmiTexture);
// blockDefinitions[1] = CmiBlock;
Grass.id = 1;
strcpy(Grass.name, "Grass");
side_texture(&Grass, grassTexture);
Grass.topTexture = grassTopTexture;
Grass.bottomTexture = dirtTexture;
blockDefinitions[1] = Grass;
Dirt.id = 2;
strcpy(Dirt.name, "Dirt");
all_texture(&Dirt, dirtTexture);
blockDefinitions[2] = Dirt;
}
void all_texture(BlockDefinition* blockDefinition, BlockTexture* blockTexture){
blockDefinition->leftTexture = blockTexture;
blockDefinition->rightTexture = blockTexture;
blockDefinition->closeTexture = blockTexture;
blockDefinition->awayTexture = blockTexture;
blockDefinition->topTexture = blockTexture;
blockDefinition->bottomTexture = blockTexture;
}
void side_texture(BlockDefinition* blockDefinition, BlockTexture* blockTexture){
blockDefinition->leftTexture = blockTexture;
blockDefinition->rightTexture = blockTexture;
blockDefinition->closeTexture = blockTexture;
blockDefinition->awayTexture = blockTexture;
}