108 lines
2.8 KiB
C++
108 lines
2.8 KiB
C++
#pragma once
|
|
#include <cstdint>
|
|
#include <cstddef>
|
|
#include "include/raylib.h"
|
|
#pragma GCC diagnostic push
|
|
#pragma GCC diagnostic ignored "-Wmissing-field-initializers"
|
|
#include "include/raymath.h"
|
|
#pragma GCC diagnostic pop
|
|
|
|
typedef uint8_t u8;
|
|
typedef uint16_t u16;
|
|
typedef int16_t i16;
|
|
typedef int32_t i32;
|
|
typedef uint32_t u32;
|
|
typedef uint64_t u64;
|
|
typedef float f32;
|
|
typedef double f64;
|
|
typedef uintptr_t uptr;
|
|
typedef char sbyte;
|
|
typedef ptrdiff_t size;
|
|
typedef size_t usize;
|
|
|
|
typedef Vector2 Point;
|
|
|
|
typedef struct Size {
|
|
float width;
|
|
float height;
|
|
} Size;
|
|
|
|
typedef struct Rect {
|
|
Point position;
|
|
Size size;
|
|
} Rect;
|
|
|
|
typedef union {
|
|
Rect components;
|
|
Rectangle rect;
|
|
} RectU;
|
|
|
|
|
|
extern "C" {
|
|
void D_DrawTextureRec(Texture2D texture, Rectangle source, Vector2 position, Color tint);
|
|
void D_DrawTexturePro(Texture2D texture, Rectangle source, Rectangle dest, Vector2 origin, float rotation, Color tint);
|
|
void D_DrawTextureV(Texture2D texture, Vector2 position, Color tint);
|
|
}
|
|
|
|
#ifdef ENNIX_LIB_IMPLEMENTATION
|
|
extern bool global_debug_mode;
|
|
inline void D_DrawTextureV(Texture2D texture, Vector2 position, Color tint) {
|
|
DrawTextureV(texture, position, tint);
|
|
#ifdef DEBUG_MODE_ENABLED
|
|
if (global_debug_mode) {
|
|
Rectangle debug = {position.x,position.y,(f32)texture.width,(f32)texture.height};
|
|
DrawRectangleLinesEx(debug, 1.0f, RED);
|
|
}
|
|
#endif
|
|
}
|
|
|
|
// Vector2 operations
|
|
#define v2_add Vector2Add
|
|
#define v2_sub Vector2Subtract
|
|
#define v2_mul Vector2Scale
|
|
#define v2_div Vector2Divide
|
|
#define v2_dot Vector2DotProduct
|
|
#define v2_len Vector2Length
|
|
#define v2_norm Vector2Normalize
|
|
#define v2_dist Vector2Distance
|
|
#define v2_lerp Vector2Lerp
|
|
|
|
// Vector3 operations
|
|
#define v3_add Vector3Add
|
|
#define v3_sub Vector3Subtract
|
|
#define v3_mul Vector3Scale
|
|
#define v3_div Vector3Divide
|
|
#define v3_dot Vector3DotProduct
|
|
#define v3_cross Vector3CrossProduct
|
|
#define v3_len Vector3Length
|
|
#define v3_norm Vector3Normalize
|
|
#define v3_dist Vector3Distance
|
|
#define v3_lerp Vector3Lerp
|
|
|
|
// Constructor-style macros
|
|
#define v2(x, y) ((Vector2){x, y})
|
|
#define v3(x, y, z) ((Vector3){x, y, z})
|
|
|
|
|
|
inline void D_DrawTextureRec(Texture2D texture, Rectangle source, Vector2 position, Color tint) {
|
|
DrawTextureRec(texture, source, position, tint);
|
|
#ifdef DEBUG_MODE_ENABLED
|
|
if (global_debug_mode) {
|
|
Rectangle debug = {position.x,position.y,source.width,source.height};
|
|
DrawRectangleLinesEx(debug, 1.0f, RED);
|
|
}
|
|
#endif
|
|
}
|
|
|
|
inline void D_DrawTexturePro(Texture2D texture, Rectangle source, Rectangle dest, Vector2 origin, float rotation, Color tint) {
|
|
DrawTexturePro(texture, source, dest, origin, rotation, tint);
|
|
#ifdef DEBUG_MODE_ENABLED
|
|
if (global_debug_mode) {
|
|
Rectangle debug = {dest.x-origin.x,dest.y-origin.y,dest.width,dest.height};
|
|
DrawRectangleLinesEx(debug, 1.0f, RED);
|
|
}
|
|
#endif
|
|
}
|
|
|
|
#endif
|