summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorBoredGuy <osome3717@gmail.com>2025-07-29 11:50:57 +0300
committerBoredGuy <osome3717@gmail.com>2025-07-29 11:50:57 +0300
commit815aec62f8ae3a403e913559d5fe6138c8825007 (patch)
tree3041d4b8a843c05a4da02e66d5e2f63e1e713b72 /include
parent9e1627c229d8d094c7b55751d82db9d3579a16e1 (diff)
Added background entity and asset system
Diffstat (limited to 'include')
-rw-r--r--include/assets.h6
-rw-r--r--include/background.h7
-rw-r--r--include/game.h20
3 files changed, 31 insertions, 2 deletions
diff --git a/include/assets.h b/include/assets.h
new file mode 100644
index 0000000..e2d76b7
--- /dev/null
+++ b/include/assets.h
@@ -0,0 +1,6 @@
+#pragma once
+
+#include <raylib.h>
+
+void LoadAssets();
+Texture2D GetTexture(const char* name);
diff --git a/include/background.h b/include/background.h
new file mode 100644
index 0000000..104db7c
--- /dev/null
+++ b/include/background.h
@@ -0,0 +1,7 @@
+#pragma once
+
+#include "game.h"
+#include "assets.h"
+
+void AddBackground(const char* backgroundTexture);
+void UpdateBackground(Entity* background, float deltaTime);
diff --git a/include/game.h b/include/game.h
index 64da8e7..1039ad5 100644
--- a/include/game.h
+++ b/include/game.h
@@ -1,6 +1,7 @@
#pragma once
#include <raylib.h>
+#include <stdbool.h>
#include <stdint.h>
#include "constants.h"
@@ -11,9 +12,15 @@
typedef enum EntityType {
Player_Entity,
- Wall_Entity
+ Wall_Entity,
+ Background_Entity
} EntityType;
+typedef enum DrawLayer {
+ Background_Layer = 0,
+ Foreground_Layer = 1
+} DrawLayer;
+
typedef struct Entity {
int id;
EntityType type;
@@ -29,6 +36,11 @@ typedef struct Entity {
int numHurtBoxes;
Rectangle hurtBoxes[MAX_AREA_COUNT];
+ //Graphics Information
+ Texture2D texture;
+ DrawLayer drawLayer;
+ Rectangle destRect; //Relative to the players position
+
#ifdef BEATEMUP_DEBUG
//Debug information
Color physicsColliderColor;
@@ -42,6 +54,10 @@ typedef struct Game {
Texture2D background;
float backgroundPosition;
+ #ifdef BEATEMUP_DEBUG
+ //Debug information
+ bool enableDebugOverlay;
+ #endif
} Game;
void AddEntity(Entity* e);
@@ -49,4 +65,4 @@ void AddWall(float xpos, float ypos, float width, float height);
void InitGame();
void UpdateGame(float deltaTime);
-void DrawGame(); \ No newline at end of file
+void DrawGame();