aboutsummaryrefslogtreecommitdiffstats
path: root/src/yabs_core.h
diff options
context:
space:
mode:
authorsalaaad2 <arthurdurant263@gmail.com>2022-06-26 22:43:58 +0200
committersalaaad2 <arthurdurant263@gmail.com>2022-06-26 22:43:58 +0200
commitfbf68206b15236e41db7f3214a57f80a539dcb15 (patch)
treeac439a71c76df5715ffd62121c4356d01e916eba /src/yabs_core.h
parentrefactor (diff)
downloadyabs-fbf68206b15236e41db7f3214a57f80a539dcb15.tar.gz
yabs-fbf68206b15236e41db7f3214a57f80a539dcb15.tar.bz2
yabs-fbf68206b15236e41db7f3214a57f80a539dcb15.tar.xz
yabs-fbf68206b15236e41db7f3214a57f80a539dcb15.tar.zst
yabs-fbf68206b15236e41db7f3214a57f80a539dcb15.zip
small refactor along with cube slaying
Diffstat (limited to 'src/yabs_core.h')
-rw-r--r--src/yabs_core.h51
1 files changed, 46 insertions, 5 deletions
diff --git a/src/yabs_core.h b/src/yabs_core.h
index 69d44d0..d8f111d 100644
--- a/src/yabs_core.h
+++ b/src/yabs_core.h
@@ -11,15 +11,36 @@
#include "raylib.h"
#include "raymath.h"
+#include <vector>
+
+#ifdef __FreeBSD__
+# define YABS_SCREENWIDTH 1280
+# define YABS_SCREENHEIGHT 720
+#else
+# define YABS_SCREENWIDTH 1600
+# define YABS_SCREENHEIGHT 900
+#endif
-#define YABS_SCREENWIDTH 1600
-#define YABS_SCREENHEIGHT 900
#define YABS_TITLE "YABS"
#define YABS_DOUBLEPI 6.28318530717958647692f
+// half sizes are reduced by 5 pixels to be centered
+#define YABS_HALFSWIDTH (YABS_SCREENWIDTH/2) - 15
+#define YABS_HALFSHEIGHT (YABS_SCREENHEIGHT/2) - 10
+
+// movement sensibility: lower is faster
#define YABS_PLAYER_MOVEMENT_SENSITIVITY 3
#define YABS_CAMERA_MOUSE_MOVE_SENSITIVITY 0.0005f
+#define YABS_GROUND_LEVEL 1.0f
+
+#define YABS_CROSSHAIR_TEX "meta/media/img/crosshair.png"
+#define ENEMIES_N 10
+
+
+
+#define YABS_COOLPURPLE \
+ CLITERAL(Color) { 153, 0, 0, 255 } // cool Purple
namespace yabs {
@@ -39,13 +60,33 @@ typedef enum gameState {
ENDING
} gameState;
-// core functions
+// core functions and structs
namespace core {
+typedef struct Player {
+ int hp;
+ Vector3 pos;
+}Player;
+
+typedef struct Enemy {
+ Vector3 enemyStartPos;
+ Vector3 enemyBoxPos;
+ Vector3 enemyBoxSize;
+ BoundingBox enemyBounds;
+ bool active;
+} Enemy;
+
+typedef struct World {
+ Model & ground;
+ std::vector<Enemy*> enemies;
+ Player * player;
+} World;
+
int reset_camera(Scene3D& scene_3d);
-int draw(Model& model);
-int tick(Scene3D& scene_3d);
+int draw(World& world);
+int tick(World& world, Scene3D& scene_3d);
void init_game();
+void cleanupAndExit(World & world);
} // namespace core