diff --git a/CHANGELOG.md b/CHANGELOG.md index 83725ec..4b80bb4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,13 @@ Changes ported from the upstream raylib code are not mentioned unless they are b h-raylib's version numbers do not follow the usual format. The first two numbers in the version track the underlying C raylib version. For example, `5.1.x.x` versions use raylib 5.1 under the hood. The third number represents breaking changes (renamed/deleted functions or modules). The last number represents non-breaking changes (new functions or modules, bug fixes, etc). The safest version bound format to use is `h-raylib >=x.y.z.w && =` bound). +## Version 5.5.2.0 +_21 October 2024_ + +- **BREAKING CHANGE**: `is*Ready` functions renamed to `is*Valid` (upstream change in raylib) +- **BREAKING CHANGE**: `setGamepadVibration` takes a fourth argument, `duration` (upstream change in raylib) +- Loosened the version bound on `base` + ## Version 5.5.1.0 _11 October 2024_ diff --git a/default.nix b/default.nix index 9cf7ad9..fb78969 100644 --- a/default.nix +++ b/default.nix @@ -3,7 +3,7 @@ }: mkDerivation { pname = "h-raylib"; - version = "5.5.1.0"; + version = "5.5.2.0"; src = ./.; isLibrary = true; isExecutable = buildExamples; diff --git a/flake.lock b/flake.lock index 30daa36..734973a 100644 --- a/flake.lock +++ b/flake.lock @@ -2,11 +2,11 @@ "nodes": { "nixpkgs": { "locked": { - "lastModified": 1728538411, - "narHash": "sha256-f0SBJz1eZ2yOuKUr5CA9BHULGXVSn6miBuUWdTyhUhU=", + "lastModified": 1729265718, + "narHash": "sha256-4HQI+6LsO3kpWTYuVGIzhJs1cetFcwT7quWCk/6rqeo=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "b69de56fac8c2b6f8fd27f2eca01dcda8e0a4221", + "rev": "ccc0c2126893dd20963580b6478d1a10a4512185", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix index c231eaa..e9741bd 100644 --- a/flake.nix +++ b/flake.nix @@ -9,8 +9,8 @@ forAllSystems' = nixpkgs.lib.genAttrs; forAllSystems = forAllSystems' supportedSystems; - raylibRev = "f5328a9bb63a0e0eca7dead15cfa01a3ec1417c2"; - raylibHash = "sha256-gAv1jfMdbKWnlIqqBddVn+WE0BOIARMmagpK61bxVnU="; + raylibRev = "2a0963ce0936abe0cd3ec32882638d860e435d16"; + raylibHash = "sha256-4p3nq04irS8AFojH88Bh1r8KiOjQhZf7nFmQhf1EDU8="; rayguiRev = "1e03efca48c50c5ea4b4a053d5bf04bad58d3e43"; rayguiHash = "sha256-PzQZxCz63EPd7sVFBYY0T1s9jA5kOAxF9K4ojRoIMz4="; diff --git a/h-raylib.cabal b/h-raylib.cabal index 4a82a07..564a0b5 100644 --- a/h-raylib.cabal +++ b/h-raylib.cabal @@ -1,6 +1,6 @@ cabal-version: 2.4 name: h-raylib -version: 5.5.1.0 +version: 5.5.2.0 synopsis: Raylib bindings for Haskell category: graphics description: @@ -239,7 +239,7 @@ library Raylib.Internal.Web.Processable build-depends: - , base >=4.0 && <4.20 + , base >=4.0 && <4.21 , bytestring >=0.11.0 && <0.13 , containers >=0.6.0 && <0.7.0 , exceptions >=0.10.4 && <0.10.8 diff --git a/lib/rl_bindings.c b/lib/rl_bindings.c index 6b3bd03..13f08dd 100644 --- a/lib/rl_bindings.c +++ b/lib/rl_bindings.c @@ -87,9 +87,9 @@ RLBIND Shader *LoadShaderFromMemory_(char *a, char *b) return ptr; } -RLBIND bool IsShaderReady_(Shader *a) +RLBIND bool IsShaderValid_(Shader *a) { - return IsShaderReady(*a); + return IsShaderValid(*a); } RLBIND int GetShaderLocation_(Shader *a, char *b) @@ -678,9 +678,9 @@ RLBIND Image *LoadImageFromScreen_() return ptr; } -RLBIND bool IsImageReady_(Image *a) +RLBIND bool IsImageValid_(Image *a) { - return IsImageReady(*a); + return IsImageValid(*a); } RLBIND void UnloadImage_(Image *a) @@ -993,9 +993,9 @@ RLBIND RenderTexture *LoadRenderTexture_(int a, int b) return ptr; } -RLBIND bool IsTextureReady_(Texture *a) +RLBIND bool IsTextureValid_(Texture *a) { - return IsTextureReady(*a); + return IsTextureValid(*a); } RLBIND void UnloadTexture_(Texture *a) @@ -1003,9 +1003,9 @@ RLBIND void UnloadTexture_(Texture *a) UnloadTexture(*a); } -RLBIND bool IsRenderTextureReady_(RenderTexture *a) +RLBIND bool IsRenderTextureValid_(RenderTexture *a) { - return IsRenderTextureReady(*a); + return IsRenderTextureValid(*a); } RLBIND void UnloadRenderTexture_(RenderTexture *a) @@ -1227,9 +1227,9 @@ RLBIND Image *GenImageFontAtlas_(GlyphInfo *a, Rectangle **b, int c, int d, int return ptr; } -RLBIND bool IsFontReady_(Font *a) +RLBIND bool IsFontValid_(Font *a) { - return IsFontReady(*a); + return IsFontValid(*a); } RLBIND void UnloadFont_(Font *a) @@ -1407,9 +1407,9 @@ RLBIND Model *LoadModelFromMesh_(Mesh *a) return ptr; } -RLBIND bool IsModelReady_(Model *a) +RLBIND bool IsModelValid_(Model *a) { - return IsModelReady(*a); + return IsModelValid(*a); } RLBIND void UnloadModel_(Model *a) @@ -1595,9 +1595,9 @@ RLBIND Material *LoadMaterialDefault_() return ptr; } -RLBIND bool IsMaterialReady_(Material *a) +RLBIND bool IsMaterialValid_(Material *a) { - return IsMaterialReady(*a); + return IsMaterialValid(*a); } RLBIND void UnloadMaterial_(Material *a) @@ -1720,9 +1720,9 @@ RLBIND void UpdateSound_(Sound *a, const void *b, int c) UpdateSound(*a, b, c); } -RLBIND bool IsWaveReady_(Wave *a) +RLBIND bool IsWaveValid_(Wave *a) { - return IsWaveReady(*a); + return IsWaveValid(*a); } RLBIND void UnloadWave_(Wave *a) @@ -1730,9 +1730,9 @@ RLBIND void UnloadWave_(Wave *a) UnloadWave(*a); } -RLBIND bool IsSoundReady_(Sound *a) +RLBIND bool IsSoundValid_(Sound *a) { - return IsSoundReady(*a); + return IsSoundValid(*a); } RLBIND void UnloadSound_(Sound *a) @@ -1821,9 +1821,9 @@ RLBIND Music *LoadMusicStreamFromMemory_(char *a, unsigned char *b, int c) return ptr; } -RLBIND bool IsMusicReady_(Music *a) +RLBIND bool IsMusicValid_(Music *a) { - return IsMusicReady(*a); + return IsMusicValid(*a); } RLBIND void UnloadMusicStream_(Music *a) @@ -1898,9 +1898,9 @@ RLBIND AudioStream *LoadAudioStream_(unsigned int a, unsigned int b, unsigned in return ptr; } -RLBIND bool IsAudioStreamReady_(AudioStream *a) +RLBIND bool IsAudioStreamValid_(AudioStream *a) { - return IsAudioStreamReady(*a); + return IsAudioStreamValid(*a); } RLBIND void UnloadAudioStream_(AudioStream *a) @@ -2554,6 +2554,21 @@ RLBIND unsigned char *DecodeDataBase64_(const unsigned char *a, int *b) return DecodeDataBase64(a, b); } +RLBIND unsigned int ComputeCRC32_(unsigned char *a, int b) +{ + return ComputeCRC32(a, b); +} + +RLBIND unsigned int *ComputeMD5_(unsigned char *a, int b) +{ + return ComputeMD5(a, b); +} + +RLBIND unsigned int *ComputeSHA1_(unsigned char *a, int b) +{ + return ComputeSHA1(a, b); +} + RLBIND void SetAutomationEventList_(AutomationEventList *a) { SetAutomationEventList(a); @@ -2664,9 +2679,9 @@ RLBIND int SetGamepadMappings_(const char *a) return SetGamepadMappings(a); } -RLBIND void SetGamepadVibration_(int a, float b, float c) +RLBIND void SetGamepadVibration_(int a, float b, float c, float d) { - SetGamepadVibration(a, b, c); + SetGamepadVibration(a, b, c, d); } RLBIND bool IsMouseButtonPressed_(int a) diff --git a/lib/rl_bindings.h b/lib/rl_bindings.h index da7bec1..0e29b34 100644 --- a/lib/rl_bindings.h +++ b/lib/rl_bindings.h @@ -40,7 +40,7 @@ Shader *LoadShader_(char *a, char *b); Shader *LoadShaderFromMemory_(char *a, char *b); -bool IsShaderReady_(Shader *a); +bool IsShaderValid_(Shader *a); int GetShaderLocation_(Shader *a, char *b); @@ -250,7 +250,7 @@ Image *LoadImageFromTexture_(Texture *a); Image *LoadImageFromScreen_(); -bool IsImageReady_(Image *a); +bool IsImageValid_(Image *a); void UnloadImage_(Image *a); @@ -360,11 +360,11 @@ Texture *LoadTextureCubemap_(Image *a, int b); RenderTexture *LoadRenderTexture_(int a, int b); -bool IsTextureReady_(Texture *a); +bool IsTextureValid_(Texture *a); void UnloadTexture_(Texture *a); -bool IsRenderTextureReady_(RenderTexture *a); +bool IsRenderTextureValid_(RenderTexture *a); void UnloadRenderTexture_(RenderTexture *a); @@ -426,7 +426,7 @@ Font *LoadFontFromMemory_(char *a, unsigned char *b, int c, int d, int *e, int f Image *GenImageFontAtlas_(GlyphInfo *a, Rectangle **b, int c, int d, int e, int f); -bool IsFontReady_(Font *a); +bool IsFontValid_(Font *a); void UnloadFont_(Font *a); @@ -498,7 +498,7 @@ Model *LoadModel_(char *a); Model *LoadModelFromMesh_(Mesh *a); -bool IsModelReady_(Model *a); +bool IsModelValid_(Model *a); void UnloadModel_(Model *a); @@ -562,7 +562,7 @@ Mesh *GenMeshCubicmap_(Image *a, Vector3 *b); Material *LoadMaterialDefault_(); -bool IsMaterialReady_(Material *a); +bool IsMaterialValid_(Material *a); void UnloadMaterial_(Material *a); @@ -604,11 +604,11 @@ Sound *LoadSoundAlias_(Sound *a); void UpdateSound_(Sound *a, const void *b, int c); -bool IsWaveReady_(Wave *a); +bool IsWaveValid_(Wave *a); void UnloadWave_(Wave *a); -bool IsSoundReady_(Sound *a); +bool IsSoundValid_(Sound *a); void UnloadSound_(Sound *a); @@ -642,7 +642,7 @@ Music *LoadMusicStream_(char *a); Music *LoadMusicStreamFromMemory_(char *a, unsigned char *b, int c); -bool IsMusicReady_(Music *a); +bool IsMusicValid_(Music *a); void UnloadMusicStream_(Music *a); @@ -672,7 +672,7 @@ float GetMusicTimePlayed_(Music *a); AudioStream *LoadAudioStream_(unsigned int a, unsigned int b, unsigned int c); -bool IsAudioStreamReady_(AudioStream *a); +bool IsAudioStreamValid_(AudioStream *a); void UnloadAudioStream_(AudioStream *a); @@ -930,6 +930,12 @@ char *EncodeDataBase64_(const unsigned char *a, int b, int *c); unsigned char *DecodeDataBase64_(const unsigned char *a, int *b); +unsigned int ComputeCRC32_(unsigned char *a, int b); + +unsigned int *ComputeMD5_(unsigned char *a, int b); + +unsigned int *ComputeSHA1_(unsigned char *a, int b); + void SetAutomationEventList_(AutomationEventList *a); void SetAutomationEventBaseFrame_(int a); @@ -974,7 +980,7 @@ float GetGamepadAxisMovement_(int a, int b); int SetGamepadMappings_(const char *a); -void SetGamepadVibration_(int a, float b, float c); +void SetGamepadVibration_(int a, float b, float c, float d); bool IsMouseButtonPressed_(int a); diff --git a/raylib b/raylib index f5328a9..2a0963c 160000 --- a/raylib +++ b/raylib @@ -1 +1 @@ -Subproject commit f5328a9bb63a0e0eca7dead15cfa01a3ec1417c2 +Subproject commit 2a0963ce0936abe0cd3ec32882638d860e435d16 diff --git a/src/Raylib/Core.hs b/src/Raylib/Core.hs index 4186392..98bb297 100644 --- a/src/Raylib/Core.hs +++ b/src/Raylib/Core.hs @@ -82,7 +82,7 @@ module Raylib.Core loadVrStereoConfig, loadShader, loadShaderFromMemory, - isShaderReady, + isShaderValid, getShaderLocation, getShaderLocationAttrib, setShaderValue, @@ -146,6 +146,9 @@ module Raylib.Core decompressData, encodeDataBase64, decodeDataBase64, + computeCRC32, + computeMD5, + computeSHA1, loadAutomationEventList, newAutomationEventList, exportAutomationEventList, @@ -282,7 +285,7 @@ module Raylib.Core c'unloadVrStereoConfig, c'loadShader, c'loadShaderFromMemory, - c'isShaderReady, + c'isShaderValid, c'getShaderLocation, c'getShaderLocationAttrib, c'setShaderValue, @@ -350,6 +353,9 @@ module Raylib.Core c'decompressData, c'encodeDataBase64, c'decodeDataBase64, + c'computeCRC32, + c'computeMD5, + c'computeSHA1, c'loadAutomationEventList, c'exportAutomationEventList, c'setAutomationEventList, @@ -568,7 +574,7 @@ $( genNative ("c'unloadVrStereoConfig", "UnloadVrStereoConfig_", "rl_bindings.h", [t|Ptr VrStereoConfig -> IO ()|]), ("c'loadShader", "LoadShader_", "rl_bindings.h", [t|CString -> CString -> IO (Ptr Shader)|]), ("c'loadShaderFromMemory", "LoadShaderFromMemory_", "rl_bindings.h", [t|CString -> CString -> IO (Ptr Shader)|]), - ("c'isShaderReady", "IsShaderReady_", "rl_bindings.h", [t|Ptr Shader -> IO CBool|]), + ("c'isShaderValid", "IsShaderValid_", "rl_bindings.h", [t|Ptr Shader -> IO CBool|]), ("c'getShaderLocation", "GetShaderLocation_", "rl_bindings.h", [t|Ptr Shader -> CString -> IO CInt|]), ("c'getShaderLocationAttrib", "GetShaderLocationAttrib_", "rl_bindings.h", [t|Ptr Shader -> CString -> IO CInt|]), ("c'setShaderValue", "SetShaderValue_", "rl_bindings.h", [t|Ptr Shader -> CInt -> Ptr () -> CInt -> IO ()|]), @@ -637,6 +643,9 @@ $( genNative ("c'decompressData", "DecompressData_", "rl_bindings.h", [t|Ptr CUChar -> CInt -> Ptr CInt -> IO (Ptr CUChar)|]), ("c'encodeDataBase64", "EncodeDataBase64_", "rl_bindings.h", [t|Ptr CUChar -> CInt -> Ptr CInt -> IO CString|]), ("c'decodeDataBase64", "DecodeDataBase64_", "rl_bindings.h", [t|Ptr CUChar -> Ptr CInt -> IO (Ptr CUChar)|]), + ("c'computeCRC32", "ComputeCRC32_", "rl_bindings.h", [t|Ptr CUChar -> CInt -> IO CUInt|]), + ("c'computeMD5", "ComputeMD5_", "rl_bindings.h", [t|Ptr CUChar -> CInt -> IO (Ptr CUInt)|]), + ("c'computeSHA1", "ComputeSHA1_", "rl_bindings.h", [t|Ptr CUChar -> CInt -> IO (Ptr CUInt)|]), ("c'loadAutomationEventList", "LoadAutomationEventList_", "rl_bindings.h", [t|CString -> IO (Ptr AutomationEventList)|]), ("c'exportAutomationEventList", "ExportAutomationEventList_", "rl_bindings.h", [t|Ptr AutomationEventList -> CString -> IO CBool|]), ("c'setAutomationEventList", "SetAutomationEventList_", "rl_bindings.h", [t|Ptr AutomationEventList -> IO ()|]), @@ -662,7 +671,7 @@ $( genNative ("c'getGamepadAxisCount", "GetGamepadAxisCount_", "rl_bindings.h", [t|CInt -> IO CInt|]), ("c'getGamepadAxisMovement", "GetGamepadAxisMovement_", "rl_bindings.h", [t|CInt -> CInt -> IO CFloat|]), ("c'setGamepadMappings", "SetGamepadMappings_", "rl_bindings.h", [t|CString -> IO CInt|]), - ("c'setGamepadVibration", "SetGamepadVibration_", "rl_bindings.h", [t|CInt -> CFloat -> CFloat -> IO ()|]), + ("c'setGamepadVibration", "SetGamepadVibration_", "rl_bindings.h", [t|CInt -> CFloat -> CFloat -> CFloat -> IO ()|]), ("c'isMouseButtonPressed", "IsMouseButtonPressed_", "rl_bindings.h", [t|CInt -> IO CBool|]), ("c'isMouseButtonDown", "IsMouseButtonDown_", "rl_bindings.h", [t|CInt -> IO CBool|]), ("c'isMouseButtonReleased", "IsMouseButtonReleased_", "rl_bindings.h", [t|CInt -> IO CBool|]), @@ -939,8 +948,8 @@ loadShader vsFileName fsFileName = withMaybeCString vsFileName (withMaybeCString loadShaderFromMemory :: Maybe String -> Maybe String -> IO Shader loadShaderFromMemory vsCode fsCode = withMaybeCString vsCode (withMaybeCString fsCode . c'loadShaderFromMemory) >>= pop -isShaderReady :: Shader -> IO Bool -isShaderReady shader = toBool <$> withFreeable shader c'isShaderReady +isShaderValid :: Shader -> IO Bool +isShaderValid shader = toBool <$> withFreeable shader c'isShaderValid getShaderLocation :: Shader -> String -> WindowResources -> IO Int getShaderLocation shader uniformName wr = do @@ -1236,6 +1245,42 @@ decodeDataBase64 encodedData = do ) ) +computeCRC32 :: [Integer] -> IO Integer +computeCRC32 contents = do + withFreeableArrayLen + (map fromIntegral contents) + (\size c -> fromIntegral <$> c'computeCRC32 c (fromIntegral $ size * sizeOf (0 :: CUChar)) ptr) + +computeMD5 :: [Integer] -> IO [Integer] +computeMD5 contents = do + withFreeableArrayLen + (map fromIntegral contents) + ( \size c -> do + withFreeable + 0 + ( \ptr -> do + encoded <- c'computeMD5 c (fromIntegral $ size * sizeOf (0 :: CUChar)) ptr + encodedSize <- fromIntegral <$> peek ptr + arr <- peekArray encodedSize encoded + return $ map fromIntegral arr + ) + ) + +computeSHA1 :: [Integer] -> IO [Integer] +computeSHA1 contents = do + withFreeableArrayLen + (map fromIntegral contents) + ( \size c -> do + withFreeable + 0 + ( \ptr -> do + encoded <- c'computeSHA1 c (fromIntegral $ size * sizeOf (0 :: CUChar)) ptr + encodedSize <- fromIntegral <$> peek ptr + arr <- peekArray encodedSize encoded + return $ map fromIntegral arr + ) + ) + loadAutomationEventList :: String -> IO AutomationEventList loadAutomationEventList fileName = withCString fileName c'loadAutomationEventList >>= pop @@ -1325,8 +1370,8 @@ getGamepadAxisMovement gamepad axis = realToFrac <$> c'getGamepadAxisMovement (f setGamepadMappings :: String -> IO Int setGamepadMappings mappings = fromIntegral <$> withCString mappings c'setGamepadMappings -setGamepadVibration :: Int -> Float -> Float -> IO () -setGamepadVibration gamepad leftMotor rightMotor = c'setGamepadVibration (fromIntegral gamepad) (realToFrac leftMotor) (realToFrac rightMotor) +setGamepadVibration :: Int -> Float -> Float -> Float -> IO () +setGamepadVibration gamepad leftMotor rightMotor duration = c'setGamepadVibration (fromIntegral gamepad) (realToFrac leftMotor) (realToFrac rightMotor) (realToFrac duration) isMouseButtonPressed :: MouseButton -> IO Bool isMouseButtonPressed button = toBool <$> c'isMouseButtonPressed (fromIntegral $ fromEnum button) diff --git a/src/Raylib/Core/Audio.hs b/src/Raylib/Core/Audio.hs index 3de785f..1f6e043 100644 --- a/src/Raylib/Core/Audio.hs +++ b/src/Raylib/Core/Audio.hs @@ -17,8 +17,8 @@ module Raylib.Core.Audio unloadSoundAlias, updateSound, unloadSound, - isWaveReady, - isSoundReady, + isWaveValid, + isSoundValid, exportWave, exportWaveAsCode, playSound, @@ -36,7 +36,7 @@ module Raylib.Core.Audio loadMusicStream, loadMusicStreamFromMemory, unloadMusicStream, - isMusicReady, + isMusicValid, playMusicStream, isMusicStreamPlaying, updateMusicStream, @@ -51,7 +51,7 @@ module Raylib.Core.Audio getMusicTimePlayed, loadAudioStream, unloadAudioStream, - isAudioStreamReady, + isAudioStreamValid, updateAudioStream, isAudioStreamProcessed, playAudioStream, @@ -81,9 +81,9 @@ module Raylib.Core.Audio c'loadSoundFromWave, c'loadSoundAlias, c'updateSound, - c'isWaveReady, + c'isWaveValid, c'unloadWave, - c'isSoundReady, + c'isSoundValid, c'unloadSound, c'unloadSoundAlias, c'exportWave, @@ -103,7 +103,7 @@ module Raylib.Core.Audio c'unloadWaveSamples, c'loadMusicStream, c'loadMusicStreamFromMemory, - c'isMusicReady, + c'isMusicValid, c'unloadMusicStream, c'playMusicStream, c'isMusicStreamPlaying, @@ -118,7 +118,7 @@ module Raylib.Core.Audio c'getMusicTimeLength, c'getMusicTimePlayed, c'loadAudioStream, - c'isAudioStreamReady, + c'isAudioStreamValid, c'unloadAudioStream, c'updateAudioStream, c'isAudioStreamProcessed, @@ -182,9 +182,9 @@ $( genNative ("c'loadSoundFromWave", "LoadSoundFromWave_", "rl_bindings.h", [t|Ptr Wave -> IO (Ptr Sound)|]), ("c'loadSoundAlias", "LoadSoundAlias_", "rl_bindings.h", [t|Ptr Sound -> IO (Ptr Sound)|]), ("c'updateSound", "UpdateSound_", "rl_bindings.h", [t|Ptr Sound -> Ptr () -> CInt -> IO ()|]), - ("c'isWaveReady", "IsWaveReady_", "rl_bindings.h", [t|Ptr Wave -> IO CBool|]), + ("c'isWaveValid", "IsWaveValid_", "rl_bindings.h", [t|Ptr Wave -> IO CBool|]), ("c'unloadWave", "UnloadWave_", "rl_bindings.h", [t|Ptr Wave -> IO ()|]), - ("c'isSoundReady", "IsSoundReady_", "rl_bindings.h", [t|Ptr Sound -> IO CBool|]), + ("c'isSoundValid", "IsSoundValid_", "rl_bindings.h", [t|Ptr Sound -> IO CBool|]), ("c'unloadSound", "UnloadSound_", "rl_bindings.h", [t|Ptr Sound -> IO ()|]), ("c'unloadSoundAlias", "UnloadSoundAlias_", "rl_bindings.h", [t|Ptr Sound -> IO ()|]), ("c'exportWave", "ExportWave_", "rl_bindings.h", [t|Ptr Wave -> CString -> IO CBool|]), @@ -204,7 +204,7 @@ $( genNative ("c'unloadWaveSamples", "UnloadWaveSamples_", "rl_bindings.h", [t|Ptr CFloat -> IO ()|]), ("c'loadMusicStream", "LoadMusicStream_", "rl_bindings.h", [t|CString -> IO (Ptr Music)|]), ("c'loadMusicStreamFromMemory", "LoadMusicStreamFromMemory_", "rl_bindings.h", [t|CString -> Ptr CUChar -> CInt -> IO (Ptr Music)|]), - ("c'isMusicReady", "IsMusicReady_", "rl_bindings.h", [t|Ptr Music -> IO CBool|]), + ("c'isMusicValid", "IsMusicValid_", "rl_bindings.h", [t|Ptr Music -> IO CBool|]), ("c'unloadMusicStream", "UnloadMusicStream_", "rl_bindings.h", [t|Ptr Music -> IO ()|]), ("c'playMusicStream", "PlayMusicStream_", "rl_bindings.h", [t|Ptr Music -> IO ()|]), ("c'isMusicStreamPlaying", "IsMusicStreamPlaying_", "rl_bindings.h", [t|Ptr Music -> IO CBool|]), @@ -219,7 +219,7 @@ $( genNative ("c'getMusicTimeLength", "GetMusicTimeLength_", "rl_bindings.h", [t|Ptr Music -> IO CFloat|]), ("c'getMusicTimePlayed", "GetMusicTimePlayed_", "rl_bindings.h", [t|Ptr Music -> IO CFloat|]), ("c'loadAudioStream", "LoadAudioStream_", "rl_bindings.h", [t|CUInt -> CUInt -> CUInt -> IO (Ptr AudioStream)|]), - ("c'isAudioStreamReady", "IsAudioStreamReady_", "rl_bindings.h", [t|Ptr AudioStream -> IO CBool|]), + ("c'isAudioStreamValid", "IsAudioStreamValid_", "rl_bindings.h", [t|Ptr AudioStream -> IO CBool|]), ("c'unloadAudioStream", "UnloadAudioStream_", "rl_bindings.h", [t|Ptr AudioStream -> IO ()|]), ("c'updateAudioStream", "UpdateAudioStream_", "rl_bindings.h", [t|Ptr AudioStream -> Ptr () -> CInt -> IO ()|]), ("c'isAudioStreamProcessed", "IsAudioStreamProcessed_", "rl_bindings.h", [t|Ptr AudioStream -> IO CBool|]), @@ -283,11 +283,11 @@ updateSound sound dataValue sampleCount = withFreeable sound (\s -> c'updateSoun unloadSound :: Sound -> WindowResources -> IO () unloadSound sound = unloadAudioStream (sound'stream sound) -isWaveReady :: Wave -> IO Bool -isWaveReady wave = toBool <$> withFreeable wave c'isWaveReady +isWaveValid :: Wave -> IO Bool +isWaveValid wave = toBool <$> withFreeable wave c'isWaveValid -isSoundReady :: Sound -> IO Bool -isSoundReady sound = toBool <$> withFreeable sound c'isSoundReady +isSoundValid :: Sound -> IO Bool +isSoundValid sound = toBool <$> withFreeable sound c'isSoundValid exportWave :: Wave -> String -> IO Bool exportWave wave fileName = toBool <$> withFreeable wave (withCString fileName . c'exportWave) @@ -349,8 +349,8 @@ loadMusicStreamFromMemory fileType streamData = unloadMusicStream :: Music -> WindowResources -> IO () unloadMusicStream music = unloadSingleCtxDataPtr (fromEnum (music'ctxType music)) (music'ctxData music) -isMusicReady :: Music -> IO Bool -isMusicReady music = toBool <$> withFreeable music c'isMusicReady +isMusicValid :: Music -> IO Bool +isMusicValid music = toBool <$> withFreeable music c'isMusicValid playMusicStream :: Music -> IO () playMusicStream music = withFreeable music c'playMusicStream @@ -395,8 +395,8 @@ loadAudioStream sampleRate sampleSize channels = c'loadAudioStream (fromIntegral unloadAudioStream :: AudioStream -> WindowResources -> IO () unloadAudioStream stream = unloadSingleAudioBuffer (castPtr $ audioStream'buffer stream) -isAudioStreamReady :: AudioStream -> IO Bool -isAudioStreamReady stream = toBool <$> withFreeable stream c'isAudioStreamReady +isAudioStreamValid :: AudioStream -> IO Bool +isAudioStreamValid stream = toBool <$> withFreeable stream c'isAudioStreamValid updateAudioStream :: AudioStream -> Ptr () -> Int -> IO () updateAudioStream stream value frameCount = withFreeable stream (\s -> c'updateAudioStream s value (fromIntegral frameCount)) diff --git a/src/Raylib/Core/Models.hs b/src/Raylib/Core/Models.hs index 44a55ec..2f5cb8d 100644 --- a/src/Raylib/Core/Models.hs +++ b/src/Raylib/Core/Models.hs @@ -28,7 +28,7 @@ module Raylib.Core.Models loadModelFromMesh, loadModelFromMeshManaged, unloadModel, - isModelReady, + isModelValid, getModelBoundingBox, drawModel, drawModelEx, @@ -63,7 +63,7 @@ module Raylib.Core.Models loadMaterials, unloadMaterial, loadMaterialDefault, - isMaterialReady, + isMaterialValid, setMaterialTexture, setModelMeshMaterial, loadModelAnimations, @@ -103,7 +103,7 @@ module Raylib.Core.Models c'drawGrid, c'loadModel, c'loadModelFromMesh, - c'isModelReady, + c'isModelValid, c'unloadModel, c'getModelBoundingBox, c'drawModel, @@ -138,7 +138,7 @@ module Raylib.Core.Models c'genMeshCubicmap, c'loadMaterials, c'loadMaterialDefault, - c'isMaterialReady, + c'isMaterialValid, c'unloadMaterial, c'setMaterialTexture, c'setModelMeshMaterial, @@ -222,7 +222,7 @@ $( genNative ("c'drawGrid", "DrawGrid_", "rl_bindings.h", [t|CInt -> CFloat -> IO ()|]), ("c'loadModel", "LoadModel_", "rl_bindings.h", [t|CString -> IO (Ptr Model)|]), ("c'loadModelFromMesh", "LoadModelFromMesh_", "rl_bindings.h", [t|Ptr Mesh -> IO (Ptr Model)|]), - ("c'isModelReady", "IsModelReady_", "rl_bindings.h", [t|Ptr Model -> IO CBool|]), + ("c'isModelValid", "IsModelValid_", "rl_bindings.h", [t|Ptr Model -> IO CBool|]), ("c'unloadModel", "UnloadModel_", "rl_bindings.h", [t|Ptr Model -> IO ()|]), ("c'getModelBoundingBox", "GetModelBoundingBox_", "rl_bindings.h", [t|Ptr Model -> IO (Ptr BoundingBox)|]), ("c'drawModel", "DrawModel_", "rl_bindings.h", [t|Ptr Model -> Ptr Vector3 -> CFloat -> Ptr Color -> IO ()|]), @@ -257,7 +257,7 @@ $( genNative ("c'genMeshCubicmap", "GenMeshCubicmap_", "rl_bindings.h", [t|Ptr Image -> Ptr Vector3 -> IO (Ptr Mesh)|]), ("c'loadMaterials", "LoadMaterials_", "rl_bindings.h", [t|CString -> Ptr CInt -> IO (Ptr Material)|]), ("c'loadMaterialDefault", "LoadMaterialDefault_", "rl_bindings.h", [t|IO (Ptr Material)|]), - ("c'isMaterialReady", "IsMaterialReady_", "rl_bindings.h", [t|Ptr Material -> IO CBool|]), + ("c'isMaterialValid", "IsMaterialValid_", "rl_bindings.h", [t|Ptr Material -> IO CBool|]), ("c'unloadMaterial", "UnloadMaterial_", "rl_bindings.h", [t|Ptr Material -> IO ()|]), ("c'setMaterialTexture", "SetMaterialTexture_", "rl_bindings.h", [t|Ptr Material -> CInt -> Ptr Texture -> IO ()|]), ("c'setModelMeshMaterial", "SetModelMeshMaterial_", "rl_bindings.h", [t|Ptr Model -> CInt -> CInt -> IO ()|]), @@ -360,8 +360,8 @@ unloadModel model wr = do forM_ (model'meshes model) (`unloadMesh` wr) forM_ (model'materials model) (`unloadMaterial` wr) -isModelReady :: Model -> IO Bool -isModelReady model = toBool <$> withFreeable model c'isModelReady +isModelValid :: Model -> IO Bool +isModelValid model = toBool <$> withFreeable model c'isModelValid getModelBoundingBox :: Model -> IO BoundingBox getModelBoundingBox model = withFreeable model c'getModelBoundingBox >>= pop @@ -485,8 +485,8 @@ unloadMaterial material wr = do loadMaterialDefault :: IO Material loadMaterialDefault = c'loadMaterialDefault >>= pop -isMaterialReady :: Material -> IO Bool -isMaterialReady material = toBool <$> withFreeable material c'isMaterialReady +isMaterialValid :: Material -> IO Bool +isMaterialValid material = toBool <$> withFreeable material c'isMaterialValid setMaterialTexture :: Material -> MaterialMapIndex -> Texture -> IO Material setMaterialTexture material mapType texture = withFreeable material (\m -> withFreeable texture (c'setMaterialTexture m (fromIntegral (fromEnum mapType))) >> peek m) diff --git a/src/Raylib/Core/Text.hs b/src/Raylib/Core/Text.hs index 0e78bad..d56b144 100644 --- a/src/Raylib/Core/Text.hs +++ b/src/Raylib/Core/Text.hs @@ -11,7 +11,7 @@ module Raylib.Core.Text loadFontData, genImageFontAtlas, unloadFont, - isFontReady, + isFontValid, exportFontAsCode, drawFPS, drawText, @@ -41,7 +41,7 @@ module Raylib.Core.Text c'loadFontData, c'genImageFontAtlas, c'unloadFontData, - c'isFontReady, + c'isFontValid, c'unloadFont, c'exportFontAsCode, c'drawFPS, @@ -106,7 +106,7 @@ $( genNative ("c'loadFontData", "LoadFontData_", "rl_bindings.h", [t|Ptr CUChar -> CInt -> CInt -> Ptr CInt -> CInt -> CInt -> IO (Ptr GlyphInfo)|]), ("c'genImageFontAtlas", "GenImageFontAtlas_", "rl_bindings.h", [t|Ptr GlyphInfo -> Ptr (Ptr Rectangle) -> CInt -> CInt -> CInt -> CInt -> IO (Ptr Image)|]), ("c'unloadFontData", "UnloadFontData_", "rl_bindings.h", [t|Ptr GlyphInfo -> CInt -> IO ()|]), - ("c'isFontReady", "IsFontReady_", "rl_bindings.h", [t|Ptr Font -> IO CBool|]), + ("c'isFontValid", "IsFontValid_", "rl_bindings.h", [t|Ptr Font -> IO CBool|]), ("c'unloadFont", "UnloadFont_", "rl_bindings.h", [t|Ptr Font -> IO ()|]), ("c'exportFontAsCode", "ExportFontAsCode_", "rl_bindings.h", [t|Ptr Font -> CString -> IO CBool|]), ("c'drawFPS", "DrawFPS_", "rl_bindings.h", [t|CInt -> CInt -> IO ()|]), @@ -187,8 +187,8 @@ genImageFontAtlas chars recs glyphCount fontSize padding packMethod = withFreeab unloadFont :: Font -> WindowResources -> IO () unloadFont font = unloadSingleTexture (texture'id $ font'texture font) -isFontReady :: Font -> IO Bool -isFontReady font = toBool <$> withFreeable font c'isFontReady +isFontValid :: Font -> IO Bool +isFontValid font = toBool <$> withFreeable font c'isFontValid exportFontAsCode :: Font -> String -> IO Bool exportFontAsCode font fileName = toBool <$> withFreeable font (withCString fileName . c'exportFontAsCode) diff --git a/src/Raylib/Core/Textures.hs b/src/Raylib/Core/Textures.hs index 9e081f0..903138f 100644 --- a/src/Raylib/Core/Textures.hs +++ b/src/Raylib/Core/Textures.hs @@ -10,7 +10,7 @@ module Raylib.Core.Textures loadImageFromMemory, loadImageFromTexture, loadImageFromScreen, - isImageReady, + isImageValid, exportImage, exportImageToMemory, exportImageAsCode, @@ -81,8 +81,8 @@ module Raylib.Core.Textures loadTextureFromImage, loadTextureCubemap, loadRenderTexture, - isTextureReady, - isRenderTextureReady, + isTextureValid, + isRenderTextureValid, unloadTexture, unloadRenderTexture, updateTexture, @@ -121,7 +121,7 @@ module Raylib.Core.Textures c'loadImageFromMemory, c'loadImageFromTexture, c'loadImageFromScreen, - c'isImageReady, + c'isImageValid, c'unloadImage, c'exportImage, c'exportImageToMemory, @@ -194,9 +194,9 @@ module Raylib.Core.Textures c'loadTextureFromImage, c'loadTextureCubemap, c'loadRenderTexture, - c'isTextureReady, + c'isTextureValid, c'unloadTexture, - c'isRenderTextureReady, + c'isRenderTextureValid, c'unloadRenderTexture, c'updateTexture, c'updateTextureRec, @@ -279,7 +279,7 @@ $( genNative ("c'loadImageFromMemory", "LoadImageFromMemory_", "rl_bindings.h", [t|CString -> Ptr CUChar -> CInt -> IO (Ptr Image)|]), ("c'loadImageFromTexture", "LoadImageFromTexture_", "rl_bindings.h", [t|Ptr Texture -> IO (Ptr Image)|]), ("c'loadImageFromScreen", "LoadImageFromScreen_", "rl_bindings.h", [t|IO (Ptr Image)|]), - ("c'isImageReady", "IsImageReady_", "rl_bindings.h", [t|Ptr Image -> IO CBool|]), + ("c'isImageValid", "IsImageValid_", "rl_bindings.h", [t|Ptr Image -> IO CBool|]), ("c'unloadImage", "UnloadImage_", "rl_bindings.h", [t|Ptr Image -> IO ()|]), ("c'exportImage", "ExportImage_", "rl_bindings.h", [t|Ptr Image -> CString -> IO CBool|]), ("c'exportImageToMemory", "ExportImageToMemory_", "rl_bindings.h", [t|Ptr Image -> CString -> Ptr CInt -> IO (Ptr CUChar)|]), @@ -352,9 +352,9 @@ $( genNative ("c'loadTextureFromImage", "LoadTextureFromImage_", "rl_bindings.h", [t|Ptr Image -> IO (Ptr Texture)|]), ("c'loadTextureCubemap", "LoadTextureCubemap_", "rl_bindings.h", [t|Ptr Image -> CInt -> IO (Ptr Texture)|]), ("c'loadRenderTexture", "LoadRenderTexture_", "rl_bindings.h", [t|CInt -> CInt -> IO (Ptr RenderTexture)|]), - ("c'isTextureReady", "IsTextureReady_", "rl_bindings.h", [t|Ptr Texture -> IO CBool|]), + ("c'isTextureValid", "IsTextureValid_", "rl_bindings.h", [t|Ptr Texture -> IO CBool|]), ("c'unloadTexture", "UnloadTexture_", "rl_bindings.h", [t|Ptr Texture -> IO ()|]), - ("c'isRenderTextureReady", "IsRenderTextureReady_", "rl_bindings.h", [t|Ptr RenderTexture -> IO CBool|]), + ("c'isRenderTextureValid", "IsRenderTextureValid_", "rl_bindings.h", [t|Ptr RenderTexture -> IO CBool|]), ("c'unloadRenderTexture", "UnloadRenderTexture_", "rl_bindings.h", [t|Ptr RenderTexture -> IO ()|]), ("c'updateTexture", "UpdateTexture_", "rl_bindings.h", [t|Ptr Texture -> Ptr () -> IO ()|]), ("c'updateTextureRec", "UpdateTextureRec_", "rl_bindings.h", [t|Ptr Texture -> Ptr Rectangle -> Ptr () -> IO ()|]), @@ -435,8 +435,8 @@ loadImageFromTexture tex = withFreeable tex c'loadImageFromTexture >>= pop loadImageFromScreen :: IO Image loadImageFromScreen = c'loadImageFromScreen >>= pop -isImageReady :: Image -> IO Bool -isImageReady image = toBool <$> withFreeable image c'isImageReady +isImageValid :: Image -> IO Bool +isImageValid image = toBool <$> withFreeable image c'isImageValid exportImage :: Image -> String -> IO Bool exportImage image fileName = toBool <$> withFreeable image (withCString fileName . c'exportImage) @@ -691,11 +691,11 @@ loadTextureCubemap image layout = withFreeable image (\i -> c'loadTextureCubemap loadRenderTexture :: Int -> Int -> IO RenderTexture loadRenderTexture width height = c'loadRenderTexture (fromIntegral width) (fromIntegral height) >>= pop -isTextureReady :: Texture -> IO Bool -isTextureReady texture = toBool <$> withFreeable texture c'isTextureReady +isTextureValid :: Texture -> IO Bool +isTextureValid texture = toBool <$> withFreeable texture c'isTextureValid -isRenderTextureReady :: RenderTexture -> IO Bool -isRenderTextureReady renderTexture = toBool <$> withFreeable renderTexture c'isRenderTextureReady +isRenderTextureValid :: RenderTexture -> IO Bool +isRenderTextureValid renderTexture = toBool <$> withFreeable renderTexture c'isRenderTextureValid -- | Unloads a `managed` texture from GPU memory (VRAM) unloadTexture :: Texture -> WindowResources -> IO ()