diff --git a/BINDINGS.md b/BINDINGS.md index d6fd107bd..7d1c43ca8 100644 --- a/BINDINGS.md +++ b/BINDINGS.md @@ -105,7 +105,8 @@ Some people ported raylib to other languages in the form of bindings or wrappers | [raylib-jai](https://github.com/ahmedqarmout2/raylib-jai) | **5.5** | [Jai](https://github.com/BSVino/JaiPrimer/blob/master/JaiPrimer.md) | MIT | | [fnl-raylib](https://github.com/0riginaln0/fnl-raylib) | **5.5** | [Fennel](https://fennel-lang.org/) | MIT | | [Rayua](https://github.com/uiua-lang/rayua) | **5.5** | [Uiua](https://www.uiua.org/) | **???** | -| [Target](https://github.com/FinnDemonCat/Target/tree/main/libs/raylib) | **5.5** | [Dart](https://dart.dev/) | Apache-2.0 license | +| [Target](https://github.com/FinnDemonCat/Target/tree/main/libs/raylib) | **5.5** | [Dart](https://dart.dev/) | Apache-2.0 license | +| [gclang-raylib](https://github.com/gnuchanos/gcLang_Compiler/tree/main/windows_version/raylib_version)| **6.0** | [gclang](https://github.com/gnuchanos/gcLang_Compiler) | AGPL-3.0 | ### Utility Wrapers diff --git a/CMakeOptions.txt b/CMakeOptions.txt index 5eff4c311..9e253dc55 100644 --- a/CMakeOptions.txt +++ b/CMakeOptions.txt @@ -6,7 +6,7 @@ if(EMSCRIPTEN) # When configuring web builds with "emcmake cmake -B build -S .", set PLATFORM to Web by default SET(PLATFORM Web CACHE STRING "Platform to build for.") endif() -enum_option(PLATFORM "Desktop;Web;WebRGFW;Android;Raspberry Pi;DRM;SDL;RGFW;Memory" "Platform to build for.") +enum_option(PLATFORM "Desktop;Win32;Web;WebRGFW;Android;Raspberry Pi;DRM;SDL;RGFW;Memory" "Platform to build for.") enum_option(OPENGL_VERSION "OFF;4.3;3.3;2.1;1.1;ES 2.0;ES 3.0;Software" "Force a specific OpenGL Version?") diff --git a/cmake/LibraryConfigurations.cmake b/cmake/LibraryConfigurations.cmake index ad026474f..262150be0 100644 --- a/cmake/LibraryConfigurations.cmake +++ b/cmake/LibraryConfigurations.cmake @@ -91,6 +91,21 @@ if (${PLATFORM} STREQUAL "Desktop") endif () endif () +elseif (${PLATFORM} STREQUAL "Win32") + if ((NOT WIN32) AND (NOT CMAKE_C_COMPILER MATCHES "mingw|mingw32|mingw64")) + message(FATAL_ERROR "Win32 platform requires Windows or a cross compiler.") + endif () + + set(PLATFORM_CPP "PLATFORM_DESKTOP_WIN32") + add_definitions(-D_CRT_SECURE_NO_WARNINGS) + + if (${OPENGL_VERSION} MATCHES "Software") + set(GRAPHICS "GRAPHICS_API_OPENGL_SOFTWARE") + endif () + + find_package(OpenGL QUIET) + set(LIBS_PRIVATE ${OPENGL_LIBRARIES} winmm) + elseif (${PLATFORM} STREQUAL "Web") set(PLATFORM_CPP "PLATFORM_WEB") if(NOT GRAPHICS) diff --git a/examples/Makefile b/examples/Makefile index 334f59694..3e1844fc3 100644 --- a/examples/Makefile +++ b/examples/Makefile @@ -20,6 +20,8 @@ # - Linux (X11 desktop mode) # - macOS/OSX (x64, arm64 (not tested)) # - Others (not tested) +# > PLATFORM_DESKTOP_WIN32 (native Win32): +# - Windows (Win32, Win64) # > PLATFORM_WEB_RGFW: # - HTML5 (WebAssembly) # > PLATFORM_WEB: @@ -794,6 +796,23 @@ ifeq ($(TARGET_PLATFORM),PLATFORM_DESKTOP_GLFW) rm -f *.o endif endif +ifeq ($(TARGET_PLATFORM),PLATFORM_DESKTOP_WIN32) + ifeq ($(PLATFORM_OS),WINDOWS) + del *.o *.exe /s + endif + ifeq ($(PLATFORM_OS),BSD) + find . -type f -perm -ugo+x -delete + rm -fv *.o + endif + ifeq ($(PLATFORM_OS),LINUX) + find . -type f -executable -delete + rm -fv *.o + endif + ifeq ($(PLATFORM_OS),OSX) + find . -type f -perm +ugo+x -delete + rm -f *.o + endif +endif ifeq ($(TARGET_PLATFORM),PLATFORM_DRM) find . -type f -executable -delete rm -fv *.o diff --git a/src/external/jar_mod.h b/src/external/jar_mod.h index 7ecf9f437..12b8101c4 100644 --- a/src/external/jar_mod.h +++ b/src/external/jar_mod.h @@ -1538,10 +1538,10 @@ mulong jar_mod_load_file(jar_mod_context_t * modctx, const char* filename) modctx->modfile = (muchar *) JARMOD_MALLOC(fsize); modctx->modfilesize = fsize; memset(modctx->modfile, 0, fsize); - fread(modctx->modfile, fsize, 1, f); + if(fread(modctx->modfile, fsize, 1, f) != 1) fsize = 0; fclose(f); - if(!jar_mod_load(modctx, (void *)modctx->modfile, fsize)) fsize = 0; + if(fsize && !jar_mod_load(modctx, (void *)modctx->modfile, fsize)) fsize = 0; } else fsize = 0; } return fsize; diff --git a/src/platforms/rcore_android.c b/src/platforms/rcore_android.c index ca0de7239..990b2fe6a 100644 --- a/src/platforms/rcore_android.c +++ b/src/platforms/rcore_android.c @@ -1273,27 +1273,28 @@ static int32_t AndroidInputCallback(struct android_app *app, AInputEvent *event) int32_t keycode = AKeyEvent_getKeyCode(event); //int32_t AKeyEvent_getMetaState(event); - // Handle gamepad button presses and releases - // NOTE: Skip gamepad handling if this is a keyboard event, as some devices - // report both AINPUT_SOURCE_KEYBOARD and AINPUT_SOURCE_GAMEPAD flags - if ((FLAG_IS_SET(source, AINPUT_SOURCE_JOYSTICK) || - FLAG_IS_SET(source, AINPUT_SOURCE_GAMEPAD)) && - !FLAG_IS_SET(source, AINPUT_SOURCE_KEYBOARD)) + // Handle gamepad button presses and releases. AOSP stamps the + // KEYBOARD source bit on every key event from a gamepad, so + // discriminate on the keycode rather than gating on source bits. + if (FLAG_IS_SET(source, AINPUT_SOURCE_JOYSTICK) || + FLAG_IS_SET(source, AINPUT_SOURCE_GAMEPAD)) { - // Assuming a single gamepad, "detected" on its input event - CORE.Input.Gamepad.ready[0] = true; - GamepadButton button = AndroidTranslateGamepadButton(keycode); - if (button == GAMEPAD_BUTTON_UNKNOWN) return 1; - - if (AKeyEvent_getAction(event) == AKEY_EVENT_ACTION_DOWN) + if (button != GAMEPAD_BUTTON_UNKNOWN) { - CORE.Input.Gamepad.currentButtonState[0][button] = 1; - } - else CORE.Input.Gamepad.currentButtonState[0][button] = 0; // Key up + // Assuming a single gamepad, "detected" on its input event + CORE.Input.Gamepad.ready[0] = true; - return 1; // Handled gamepad button + if (AKeyEvent_getAction(event) == AKEY_EVENT_ACTION_DOWN) + { + CORE.Input.Gamepad.currentButtonState[0][button] = 1; + } + else CORE.Input.Gamepad.currentButtonState[0][button] = 0; // Key up + + return 1; // Handled gamepad button + } + // Unknown keycode: fall through to the keyboard handler below. } KeyboardKey key = ((keycode > 0) && (keycode < KEYCODE_MAP_SIZE))? mapKeycode[keycode] : KEY_NULL; diff --git a/src/raudio.c b/src/raudio.c index e4d36611c..ff90d8e43 100644 --- a/src/raudio.c +++ b/src/raudio.c @@ -1048,6 +1048,7 @@ void UnloadSoundAlias(Sound alias) { UntrackAudioBuffer(alias.stream.buffer); ma_data_converter_uninit(&alias.stream.buffer->converter, NULL); + RL_FREE(alias.stream.buffer->converterResidual); RL_FREE(alias.stream.buffer); } }