aboutsummaryrefslogtreecommitdiffstats
path: root/src/yabs_core.h
blob: d8f111dee5035d5ef2c3f23d731899b82f3017de (plain)
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
87
88
89
90
91
92
93
94
95
#ifndef YABS_CORE_H
#define YABS_CORE_H

/*********************************/
/*   YABS             (  //      */
/*   yabs_CORE         ( )/      */
/*   by salade         )(/       */
/*  ________________  ( /)       */
/* ()__)____________)))))   :^}  */
/*********************************/

#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_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 {

typedef struct Scene3D {
    Camera camera;
    Vector3 movement;
    Vector3 rotation;
    Vector2 lastMousePos;
} Scene3D;

typedef enum gameState {
    TITLE = 0,
    PICK,
    DEATH,
    GAMEPLAY,
    NEXT,
    ENDING
} gameState;

// 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(World& world);
int tick(World& world, Scene3D& scene_3d);
void init_game();
void cleanupAndExit(World & world);

}  // namespace core

}  // namespace yabs

#endif /* YABS_CORE_H */