-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
219a026
commit 81c92af
Showing
2 changed files
with
57 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,64 +1,77 @@ | ||
// Only redefine if the Windows names aren't already defined | ||
#ifndef RECTANGLE_DEFINED | ||
#define Rectangle rlRectangle | ||
#define RECTANGLE_DEFINED | ||
// raylib_wrapper.h | ||
#pragma once // Prevent multiple inclusions | ||
|
||
// First, save any existing Windows macros/definitions if they exist | ||
#ifdef CloseWindow | ||
#define PREV_CloseWindow CloseWindow | ||
#undef CloseWindow | ||
#endif | ||
|
||
#ifndef CLOSEWINDOW_DEFINED | ||
#define CloseWindow rlCloseWindow | ||
#define CLOSEWINDOW_DEFINED | ||
#ifdef Rectangle | ||
#define PREV_Rectangle Rectangle | ||
#undef Rectangle | ||
#endif | ||
|
||
#ifndef SHOWCURSOR_DEFINED | ||
#define ShowCursor rlShowCursor | ||
#define SHOWCURSOR_DEFINED | ||
#ifdef ShowCursor | ||
#define PREV_ShowCursor ShowCursor | ||
#undef ShowCursor | ||
#endif | ||
|
||
#ifndef LOADIMAGE_DEFINED | ||
#define LoadImage rlLoadImage | ||
#define LOADIMAGE_DEFINED | ||
#ifdef LoadImage | ||
#define PREV_LoadImage LoadImage | ||
#undef LoadImage | ||
#endif | ||
|
||
#ifndef DRAWTEXT_DEFINED | ||
#define DrawText rlDrawText | ||
#define DRAWTEXT_DEFINED | ||
#ifdef DrawText | ||
#define PREV_DrawText DrawText | ||
#undef DrawText | ||
#endif | ||
|
||
#ifndef DRAWTEXTEX_DEFINED | ||
#define DrawTextEx rlDrawTextEx | ||
#define DRAWTEXTEX_DEFINED | ||
#ifdef DrawTextEx | ||
#define PREV_DrawTextEx DrawTextEx | ||
#undef DrawTextEx | ||
#endif | ||
|
||
// Include raylib after setting up the defines | ||
// Include raylib with our names | ||
#include "raylib.h" | ||
|
||
// Undefine to restore original Windows API names if necessary | ||
#ifdef RECTANGLE_DEFINED | ||
#undef Rectangle | ||
#undef RECTANGLE_DEFINED | ||
#define rlRectangle Rectangle | ||
// Create our wrapped versions with unique names | ||
static inline void rlCloseWindow(void) { CloseWindow(); } | ||
static inline void rlShowCursor(void) { ShowCursor(); } | ||
static inline Image rlLoadImage(const char* fileName) { return LoadImage(fileName); } | ||
static inline void rlDrawText(const char* text, int x, int y, int fontSize, Color color) { DrawText(text, x, y, fontSize, color); } | ||
static inline void rlDrawTextEx(Font font, const char* text, Vector2 position, float fontSize, float spacing, Color tint) { | ||
DrawTextEx(font, text, position, fontSize, spacing, tint); | ||
} | ||
|
||
// Restore previous Windows definitions if they existed | ||
#ifdef PREV_CloseWindow | ||
#define CloseWindow PREV_CloseWindow | ||
#undef PREV_CloseWindow | ||
#endif | ||
|
||
#ifdef CLOSEWINDOW_DEFINED | ||
#undef CloseWindow | ||
#undef CLOSEWINDOW_DEFINED | ||
#ifdef PREV_Rectangle | ||
#define Rectangle PREV_Rectangle | ||
#undef PREV_Rectangle | ||
#endif | ||
|
||
#ifdef SHOWCURSOR_DEFINED | ||
#undef ShowCursor | ||
#undef SHOWCURSOR_DEFINED | ||
#ifdef PREV_ShowCursor | ||
#define ShowCursor PREV_ShowCursor | ||
#undef PREV_ShowCursor | ||
#endif | ||
|
||
#ifdef LOADIMAGE_DEFINED | ||
#undef LoadImage | ||
#undef LOADIMAGE_DEFINED | ||
#ifdef PREV_LoadImage | ||
#define LoadImage PREV_LoadImage | ||
#undef PREV_LoadImage | ||
#endif | ||
|
||
#ifdef DRAWTEXT_DEFINED | ||
#undef DrawText | ||
#undef DRAWTEXT_DEFINED | ||
#ifdef PREV_DrawText | ||
#define DrawText PREV_DrawText | ||
#undef PREV_DrawText | ||
#endif | ||
|
||
#ifdef DRAWTEXTEX_DEFINED | ||
#undef DrawTextEx | ||
#undef DRAWTEXTEX_DEFINED | ||
#ifdef PREV_DrawTextEx | ||
#define DrawTextEx PREV_DrawTextEx | ||
#undef PREV_DrawTextEx | ||
#endif |