|
| 1 | +/********************************************************************************************** |
| 2 | +* |
| 3 | +* fix_win32_compatibility.h Utility to help include windows.h with raylib projects |
| 4 | +* |
| 5 | +* Useage: #include "fix_win32_compatibility.h" any library that uses windows.h |
| 6 | +* order is critical, this must be done before raylib |
| 7 | +* |
| 8 | +* LICENSE: MIT |
| 9 | +* |
| 10 | +* Copyright (c) 2025 Jeffery Myers |
| 11 | +* |
| 12 | +* Permission is hereby granted, free of charge, to any person obtaining a copy |
| 13 | +* of this software and associated documentation files (the "Software"), to deal |
| 14 | +* in the Software without restriction, including without limitation the rights |
| 15 | +* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
| 16 | +* copies of the Software, and to permit persons to whom the Software is |
| 17 | +* furnished to do so, subject to the following conditions: |
| 18 | +* |
| 19 | +* The above copyright notice and this permission notice shall be included in all |
| 20 | +* copies or substantial portions of the Software. |
| 21 | +* |
| 22 | +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| 23 | +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 24 | +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
| 25 | +* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
| 26 | +* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
| 27 | +* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
| 28 | +* SOFTWARE. |
| 29 | +* |
| 30 | +**********************************************************************************************/ |
| 31 | + |
| 32 | +#pragma once |
| 33 | + |
| 34 | +// move the windows functions to new names |
| 35 | +// note that you can't call these functions or structures from your code, but you should not neeed to |
| 36 | +#define CloseWindow CloseWindowWin32 |
| 37 | +#define Rectangle RectangleWin32 |
| 38 | +#define ShowCursor ShowCursorWin32 |
| 39 | +#define LoadImageA LoadImageAWin32 |
| 40 | +#define LoadImageW LoadImageWin32 |
| 41 | +#define DrawTextA DrawTextAWin32 |
| 42 | +#define DrawTextW DrawTextWin32 |
| 43 | +#define DrawTextExA DrawTextExAWin32 |
| 44 | +#define DrawTextExW DrawTextExWin32 |
| 45 | +#define PlaySoundA PlaySoundAWin32\ |
| 46 | +// include windows |
| 47 | +#define WIN32_LEAN_AND_MEAN |
| 48 | +#include <windows.h> |
| 49 | + |
| 50 | +// remove all our redfintions so that raylib can define them properly |
| 51 | +#undef CloseWindow |
| 52 | +#undef Rectangle |
| 53 | +#undef ShowCursor |
| 54 | +#undef LoadImage |
| 55 | +#undef LoadImageA |
| 56 | +#undef LoadImageW |
| 57 | +#undef DrawText |
| 58 | +#undef DrawTextA |
| 59 | +#undef DrawTextW |
| 60 | +#undef DrawTextEx |
| 61 | +#undef DrawTextExA |
| 62 | +#undef DrawTextExW |
| 63 | +#undef PlaySoundA |
0 commit comments