-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtileObject.h
69 lines (49 loc) · 1.55 KB
/
tileObject.h
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
61
62
63
64
65
66
67
68
69
#pragma once
#ifndef TILE_OBJECT_H
#define TILE_OBJECT_H
#include "SDL2/SDL.h"
#include "SDL2/SDL_image.h"
#include "chipmunk/chipmunk_private.h"
#include "defines.h"
#include "list.h"
/* simple tile */
typedef struct
{
cpVect pos;
float w, h;
int texIndex;
} STile;
/* tile object with angles and sizes */
typedef struct
{
cpVect pos;
float w, h;
float angle;
SDL_Texture* texture;
} STileObject;
// íàø óðîâåíü ñîñòîèò ìàññèâà òàéëîâûõ îáúåêòîâ,
// êîòîðûå ñòàòè÷íû â ïðîñòðàíñòâå è èìåþò îäèííàêîâûé ðàçìåð, ïîâîðîò
// + äâóõ ñïèñêà äëÿ çàäíèõ è ïåðåäíèõ îáúåêòîâ
SList* backTiles;
SList* frontTiles;
STile* tiles [LEVEL_HEIGHT][LEVEL_WIDTH];
// ðèñóåì ôîíîâóþ êàðòèíêó
void BackgroundDraw();
/* operations with tiles */
STile* TileCreate (int texIndex);
void TileDestroy (STile** tile);
void TileClearAll ();
/*void TileGetSdlRect (STile* tile, SDL_Rect* rect);
SDL_Texture* TileObjectGetTexture (STile* tile);*/
void TilesUpdateAndRender ();
/* operations with tile objects */
STileObject* TileObjectCreate (float x, float y,
float w, float h,
float angle,
SDL_Texture* texture);
void TileObjectDestroy (STileObject** tileObject);
void TileObjectClearAll ();
void TileObjectGetSdlRect (STileObject* tileObject, SDL_Rect* rect);
SDL_Texture* TileObjectGetTexture (STileObject* tileObject);
void TileObjectsUpdateAndRender (SList* tilesList);
#endif // BACKGROUND_OBJECT_H