2021-05-12 14:42:22 +00:00
|
|
|
#pragma once
|
|
|
|
#include "system.h"
|
|
|
|
#include "raylib.h"
|
2021-05-12 16:28:39 +00:00
|
|
|
#include "world/blocks.h"
|
2021-05-13 12:17:44 +00:00
|
|
|
#include "assets.h"
|
2021-05-12 14:42:22 +00:00
|
|
|
|
|
|
|
static inline
|
|
|
|
void DrawTextEco(const char *text, float posX, float posY, int fontSize, Color color, float spacing) {
|
|
|
|
#if 1
|
|
|
|
// Check if default font has been loaded
|
|
|
|
if (GetFontDefault().texture.id != 0) {
|
|
|
|
Vector2 position = { (float)posX , (float)posY };
|
|
|
|
|
|
|
|
int defaultFontSize = 10; // Default Font chars height in pixel
|
|
|
|
int new_spacing = spacing == 0.0f ? fontSize/defaultFontSize : spacing;
|
|
|
|
|
|
|
|
DrawTextEx(GetFontDefault(), text, position, (float)fontSize , (float)new_spacing , color);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline
|
|
|
|
int MeasureTextEco(const char *text, int fontSize, float spacing) {
|
|
|
|
#if 1
|
|
|
|
Vector2 vec = { 0.0f, 0.0f };
|
|
|
|
|
|
|
|
// Check if default font has been loaded
|
|
|
|
if (GetFontDefault().texture.id != 0) {
|
|
|
|
int defaultFontSize = 10; // Default Font chars height in pixel
|
|
|
|
int new_spacing = spacing == 0.0f ? fontSize/defaultFontSize : spacing;
|
|
|
|
|
|
|
|
vec = MeasureTextEx(GetFontDefault(), text, (float)fontSize, (float)new_spacing);
|
|
|
|
}
|
|
|
|
|
|
|
|
return (int)vec.x;
|
|
|
|
#else
|
|
|
|
return 0;
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline
|
|
|
|
void DrawCircleEco(float centerX, float centerY, float radius, Color color)
|
|
|
|
{
|
|
|
|
DrawCircleV((Vector2){ (float)centerX , (float)centerY }, radius , color);
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline
|
2021-05-15 11:43:29 +00:00
|
|
|
void DrawRectangleEco(float posX, float posY, float width, float height, Color color)
|
2021-05-12 14:42:22 +00:00
|
|
|
{
|
2021-05-15 11:43:29 +00:00
|
|
|
DrawRectangleV((Vector2){ (float)posX , (float)posY }, (Vector2){ width , height }, color);
|
2021-05-12 14:42:22 +00:00
|
|
|
}
|
2021-05-12 16:28:39 +00:00
|
|
|
|
|
|
|
static inline
|
2021-05-12 16:38:47 +00:00
|
|
|
Image GetBlockImage(uint8_t id) {
|
|
|
|
return *(Image*)blocks_get_img(id);
|
2021-05-12 17:26:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static inline
|
|
|
|
Image GetSpriteImage(uint16_t id) {
|
|
|
|
return *(Image*)assets_get_tex(id);
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline
|
|
|
|
Sound GetSound(uint16_t id) {
|
|
|
|
return *(Sound*)assets_get_snd(id);
|
2021-05-12 16:28:39 +00:00
|
|
|
}
|