diff options
| author | veradec <glitchmill.dyj3d@simplelogin.co> | 2026-10-24 23:03:05 +0530 |
|---|---|---|
| committer | veradec <glitchmill.dyj3d@simplelogin.co> | 2026-10-24 23:03:05 +0530 |
| commit | 92bb8bf35e81911d5ae52eba886dbd846a95d1ca (patch) | |
| tree | d82b3c38b8ae1bab692d6cea423ba0474ffc742b /helpers.h | |
| parent | 47f914f462c8deb712f0fcb1260e7634c89425f9 (diff) | |
write to config without changing directories, set text to a position in a rectangle
Diffstat (limited to 'helpers.h')
| -rw-r--r-- | helpers.h | 43 |
1 files changed, 38 insertions, 5 deletions
@@ -1,31 +1,64 @@ #include <string.h> +#include <math.h> #define TEXT_FONT text_font + +// TEXT Helpers #define WriteDrawText(text, posX, posY, fontSize, color) \ DrawText(text, posX - (MeasureText(text, fontSize) / 2), posY, fontSize, \ color); -#define WriteDrawTextFont(font, text, posX, posY, fontSize, spacing, color) DrawTextEx(font, text, (Vector2){(posX - MeasureTextEx(font, text, fontSize, spacing).x/2), posY}, fontSize, spacing, color); +#define WriteDrawTextFont(font, text, posX, posY, fontSize, spacing, color) \ +DrawTextEx(font, text, (Vector2){(posX - MeasureTextEx(font, text, fontSize, spacing).x/2), posY}, fontSize, spacing, color); -#define WriteText(text, posX, posY, fontSize, color) DrawTextEx(TEXT_FONT, text, (Vector2){(posX - MeasureTextEx(TEXT_FONT, text, fontSize, 0).x/2), posY}, fontSize, 0, color); +#define WriteText(text, posX, posY, fontSize, color) \ + DrawTextEx(TEXT_FONT, text, (Vector2){(posX - MeasureTextEx(TEXT_FONT, text, fontSize, 0).x/2), posY}, fontSize, 0, color); +/////////////// -#define DrawRect(posX,posY,width,height,color) DrawRectangle(posX - width/2, posY, width, height, color); +// Rectangle Helpers #define MakeRect(posX, posY, width, height) {posX - width/2, posY, width, height}; +#define MakeBtn(posX, posY, txt, fontSize, padding) \ + { \ + posX - MeasureText(txt, fontSize) / 2 - padding, \ + posY - padding, MeasureText(txt, fontSize) + padding * 2, fontSize + padding * 2} -#define MakeBtn(posX, posY, txt, fontSize, padding) {posX - MeasureText(txt, fontSize) / 2 - padding, posY - padding, MeasureText(txt, fontSize) + padding * 2, fontSize + padding * 2} +#define DrawRect(posX, posY, width, height, color) \ + DrawRectangle(posX - width/2, posY, width, height, color); +#define DrawRectangleDropShadow(posX,posY,width,height,color) +#define DrawRectangleRecDropShadow(rec, color, angle, shadow_distance) \ + DrawRectangle(rec.x - rec.width/2 + shadow_distance, rec.y + (sin(angle)*shadow_distance), rec.width, rec.height, (Color){0,0,0,225}); \ + DrawRectangleRec(rec, color); #define IsMouseInside(rec) CheckCollisionPointRec(mouse_position, rec) +//////////////////// + typedef enum ScreenType { TitleScreen, SettingsScreen, GameStartScreen } ScreenType; + +typedef enum Position { + LEFT_TOP, + MIDDLE_TOP, + RIGHT_TOP, + LEFT_CENTER, + MIDDLE_CENTER, + RIGHT_CENTER, + LEFT_BOTTOM, + MIDDLE_BOTTOM, + RIGHT_BOTTOM, + FILL, +} Position; + +// Function Defenitions void MainMenu(); void SettingsMenu(); void LoadConfiguration(); void WriteConfiguration(); void SetVariables(char* line); - +void GameStart(); +void WriteTextInsideRectangle(struct Rectangle rec, Position pos, char* text, int font_size, int padding, struct Color color); |
