forked from Derailedzack/Client-C-Version
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathEntity.h
86 lines (78 loc) · 1.94 KB
/
Entity.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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
#pragma once
#include <stdbool.h>
#include<SDL.h>
#include "lauxlib.h"
#include<lua.h>
#include"cute_c2.h"
typedef struct {
int w;
int h;
int x;
int y;
}rect;
//Currently Unused Values
//Will be used later. as in when player collision is working properly
int Entity_X_Velocity;
int Entity_Y_Velocity;
float Entity_Position_X;
float Entity_Position_Y;
const char* name;
rect Entity_Rectangle;
typedef void (Draw_func)();
typedef void (Redraw_func)();
typedef void (OnError_func)();
typedef void (OnCullsion_func)(rect*);
//todo:Document all code
/*All EntityTypes aren't implemented yet.Some wont be implemented at all.*/
enum EntityType {
RENDERABLE,
PLAYER,
SOUND,
CAMERA,
GUI,
MAINMENU,
};
typedef struct Size{
float width;
float height;
bool Shouldscale;
float scalewidth;
float scaleheight;
}Size;
typedef struct {
const char* name;
rect Entity_Sprite;
Size Entity_Size;
float posX;
float posY;
int Enitiy_Speed_Multiplier;
int Entity_X_Speed;
int Entity_Y_Speed;
int Entity_ID;
char* Entity_CustomData;
c2AABB Entity_BB;
}EntityData;
//TODO Prefix Function names with Entity_FUNCNAME
int CreateEntityDataLua(lua_State *L);
int ScaleEntityLua(lua_State *L);
int SetDrawCallbackLua(lua_State *L);
int SetXpositionLua(lua_State *L);
int SetYpositionLua(lua_State *L);
int LoadEntityLibrary(lua_State *L);
void Draw(Draw_func* draw);
void Redraw(Redraw_func* redraw);
void OnError(OnError_func* onerror);
void OnCullsion(OnCullsion_func* oncullsion);
void SetSize(int w, int h,rect rectangle);
//void SetSize(int w, int h);
void SetWidth(int w);
void SetHeight(int h);
int* GetSize();
void CollsionTest(EntityData ent_data, EntityData ent_other_data);
/*For Server*/
void SendEntity (EntityData* entity); //SendEntity really means SendEntityData
void SendCullsionData();
void SDL2_CreateEntityRect();
void Jump(EntityData* entityData);
SDL_Rect* ConvertEntityRectToSDLRect(rect* entity_rect);
void ScaleEntity(int widthMulti,int heightMulti);