Skip to content

Commit

Permalink
chore: update submodules
Browse files Browse the repository at this point in the history
  • Loading branch information
Anut-py committed Mar 9, 2024
1 parent 5e1e242 commit aad8b04
Show file tree
Hide file tree
Showing 10 changed files with 128 additions and 84 deletions.
6 changes: 3 additions & 3 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@
forAllSystems' = nixpkgs.lib.genAttrs;
forAllSystems = forAllSystems' supportedSystems;

raylibRev = "54e0af40c1c534b3f3958264c67270434183639e";
raylibHash = "sha256-VwqLD0TYOFShav1OSJnlbIVR8ixMm3sB5pNigJey/dQ=";
rayguiRev = "bc67f42209cc32965c7d1c00028e3ed0c4158659";
rayguiHash = "sha256-yevM/m6Mven/U2KrxVvm9yL9PQtffeU+Vxfdrvj5Vdk=";
raylibRev = "ba066656f7be07f8f3f5e9028f053068789755a4";
raylibHash = "sha256-WeT9lW4Qs3K5+dEscAKfyvKX6BHJCJNWspbABlrXPgs=";
rayguiRev = "b5693d0c418e4b2572de2992b795c6407e8106cf";
rayguiHash = "sha256-u7BIpMB3ofv4Fia8TJ0523FhfN8dkz/UvvGrKRjKEnY=";

pkgsForSystem =
system:
Expand Down
13 changes: 9 additions & 4 deletions lib/rl_bindings.c
Original file line number Diff line number Diff line change
Expand Up @@ -126,17 +126,17 @@ RLBIND void UnloadShader_(Shader *a)
UnloadShader(*a);
}

RLBIND Ray *GetMouseRay_(Vector2 *a, Camera3D *b)
RLBIND Ray *GetScreenToWorldRay_(Vector2 *a, Camera3D *b)
{
Ray *ptr = (Ray *)malloc(sizeof(Ray));
*ptr = GetMouseRay(*a, *b);
*ptr = GetScreenToWorldRay(*a, *b);
return ptr;
}

RLBIND Ray *GetViewRay_(Vector2 *a, Camera3D *b, float c, float d)
RLBIND Ray *GetScreenToWorldRayEx_(Vector2 *a, Camera3D *b, float c, float d)
{
Ray *ptr = (Ray *)malloc(sizeof(Ray));
*ptr = GetViewRay(*a, *b, c, d);
*ptr = GetScreenToWorldRayEx(*a, *b, c, d);
return ptr;
}

Expand Down Expand Up @@ -2580,6 +2580,11 @@ RLBIND int SetGamepadMappings_(const char *a)
return SetGamepadMappings(a);
}

RLBIND void SetGamepadVibration_(int a, float b, float c)
{
SetGamepadVibration(a, b, c);
}

RLBIND bool IsMouseButtonPressed_(int a)
{
return IsMouseButtonPressed(a);
Expand Down
6 changes: 4 additions & 2 deletions lib/rl_bindings.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,9 @@ void SetShaderValueTexture_(Shader *a, int b, Texture *c);

void UnloadShader_(Shader *a);

Ray *GetMouseRay_(Vector2 *a, Camera3D *b);
Ray *GetScreenToWorldRay_(Vector2 *a, Camera3D *b);

Ray *GetViewRay_(Vector2 *a, Camera3D *b, float c, float d);
Ray *GetScreenToWorldRayEx_(Vector2 *a, Camera3D *b, float c, float d);

Matrix *GetCameraMatrix_(Camera3D *a);

Expand Down Expand Up @@ -944,6 +944,8 @@ float GetGamepadAxisMovement_(int a, int b);

int SetGamepadMappings_(const char *a);

void SetGamepadVibration_(int a, float b, float c);

bool IsMouseButtonPressed_(int a);

bool IsMouseButtonDown_(int a);
Expand Down
2 changes: 1 addition & 1 deletion raylib
Submodule raylib updated 131 files
31 changes: 19 additions & 12 deletions src/Raylib/Core.hs
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,8 @@ module Raylib.Core
setShaderValueMatrix,
setShaderValueTexture,
unloadShader,
getMouseRay,
getViewRay,
getScreenToWorldRay,
getScreenToWorldRayEx,
getCameraMatrix,
getCameraMatrix2D,
getWorldToScreen,
Expand Down Expand Up @@ -171,6 +171,7 @@ module Raylib.Core
getGamepadAxisCount,
getGamepadAxisMovement,
setGamepadMappings,
setGamepadVibration,
isMouseButtonPressed,
isMouseButtonDown,
isMouseButtonReleased,
Expand Down Expand Up @@ -286,8 +287,8 @@ module Raylib.Core
c'setShaderValueMatrix,
c'setShaderValueTexture,
c'unloadShader,
c'getMouseRay,
c'getViewRay,
c'getScreenToWorldRay,
c'getScreenToWorldRayEx,
c'getCameraMatrix,
c'getCameraMatrix2D,
c'getWorldToScreen,
Expand Down Expand Up @@ -369,6 +370,7 @@ module Raylib.Core
c'getGamepadAxisCount,
c'getGamepadAxisMovement,
c'setGamepadMappings,
c'setGamepadVibration,
c'isMouseButtonPressed,
c'isMouseButtonDown,
c'isMouseButtonReleased,
Expand Down Expand Up @@ -414,12 +416,13 @@ import qualified Data.Map as Map
import Foreign
( Ptr,
Storable (peek, poke, sizeOf),
castFunPtr,
castPtr,
fromBool,
malloc,
newArray,
peekArray,
toBool, castFunPtr,
toBool,
)
import Foreign.C
( CBool (..),
Expand All @@ -435,7 +438,7 @@ import Foreign.C
withCString,
)
import Foreign.Ptr (nullPtr)
import Raylib.Internal (WindowResources, addAutomationEventList, addShaderId, defaultWindowResources, shaderLocations, unloadAutomationEventLists, unloadFrameBuffers, unloadShaders, unloadSingleAutomationEventList, unloadSingleShader, unloadTextures, unloadVaoIds, unloadVboIds, addFunPtr, unloadFunPtrs)
import Raylib.Internal (WindowResources, addAutomationEventList, addFunPtr, addShaderId, defaultWindowResources, shaderLocations, unloadAutomationEventLists, unloadFrameBuffers, unloadFunPtrs, unloadShaders, unloadSingleAutomationEventList, unloadSingleShader, unloadTextures, unloadVaoIds, unloadVboIds)
import Raylib.Internal.Foreign (c'free, configsToBitflag, pop, popCArray, popCString, withFreeable, withFreeableArray, withFreeableArrayLen, withMaybeCString)
import Raylib.Internal.TH (genNative)
import Raylib.Types
Expand Down Expand Up @@ -566,8 +569,8 @@ $( genNative
("c'setShaderValueMatrix", "SetShaderValueMatrix_", "rl_bindings.h", [t|Ptr Shader -> CInt -> Ptr Matrix -> IO ()|], False),
("c'setShaderValueTexture", "SetShaderValueTexture_", "rl_bindings.h", [t|Ptr Shader -> CInt -> Ptr Texture -> IO ()|], False),
("c'unloadShader", "UnloadShader_", "rl_bindings.h", [t|Ptr Shader -> IO ()|], False),
("c'getMouseRay", "GetMouseRay_", "rl_bindings.h", [t|Ptr Vector2 -> Ptr Camera3D -> IO (Ptr Ray)|], False),
("c'getViewRay", "GetViewRay_", "rl_bindings.h", [t|Ptr Vector2 -> Ptr Camera3D -> CFloat -> CFloat -> IO (Ptr Ray)|], False),
("c'getScreenToWorldRay", "GetScreenToWorldRay_", "rl_bindings.h", [t|Ptr Vector2 -> Ptr Camera3D -> IO (Ptr Ray)|], False),
("c'getScreenToWorldRayEx", "GetScreenToWorldRayEx_", "rl_bindings.h", [t|Ptr Vector2 -> Ptr Camera3D -> CFloat -> CFloat -> IO (Ptr Ray)|], False),
("c'getCameraMatrix", "GetCameraMatrix_", "rl_bindings.h", [t|Ptr Camera3D -> IO (Ptr Matrix)|], False),
("c'getCameraMatrix2D", "GetCameraMatrix2D_", "rl_bindings.h", [t|Ptr Camera2D -> IO (Ptr Matrix)|], False),
("c'getWorldToScreen", "GetWorldToScreen_", "rl_bindings.h", [t|Ptr Vector3 -> Ptr Camera3D -> IO (Ptr Vector2)|], False),
Expand Down Expand Up @@ -649,6 +652,7 @@ $( genNative
("c'getGamepadAxisCount", "GetGamepadAxisCount_", "rl_bindings.h", [t|CInt -> IO CInt|], False),
("c'getGamepadAxisMovement", "GetGamepadAxisMovement_", "rl_bindings.h", [t|CInt -> CInt -> IO CFloat|], False),
("c'setGamepadMappings", "SetGamepadMappings_", "rl_bindings.h", [t|CString -> IO CInt|], False),
("c'setGamepadVibration", "SetGamepadVibration_", "rl_bindings.h", [t|CInt -> CFloat -> CFloat -> IO ()|], False),
("c'isMouseButtonPressed", "IsMouseButtonPressed_", "rl_bindings.h", [t|CInt -> IO CBool|], False),
("c'isMouseButtonDown", "IsMouseButtonDown_", "rl_bindings.h", [t|CInt -> IO CBool|], False),
("c'isMouseButtonReleased", "IsMouseButtonReleased_", "rl_bindings.h", [t|CInt -> IO CBool|], False),
Expand Down Expand Up @@ -992,11 +996,11 @@ setShaderValueTexture shader locIndex tex = withFreeable shader (\s -> withFreea
unloadShader :: Shader -> WindowResources -> IO ()
unloadShader shader = unloadSingleShader (shader'id shader)

getMouseRay :: Vector2 -> Camera3D -> IO Ray
getMouseRay mousePosition camera = withFreeable mousePosition (withFreeable camera . c'getMouseRay) >>= pop
getScreenToWorldRay :: Vector2 -> Camera3D -> IO Ray
getScreenToWorldRay position camera = withFreeable position (withFreeable camera . c'getScreenToWorldRay) >>= pop

getViewRay :: Vector2 -> Camera3D -> Float -> Float -> IO Ray
getViewRay mousePosition camera width height = withFreeable mousePosition (\p -> withFreeable camera (\c -> c'getViewRay p c (realToFrac width) (realToFrac height))) >>= pop
getScreenToWorldRayEx :: Vector2 -> Camera3D -> Float -> Float -> IO Ray
getScreenToWorldRayEx position camera width height = withFreeable position (\p -> withFreeable camera (\c -> c'getScreenToWorldRayEx p c (realToFrac width) (realToFrac height))) >>= pop

getCameraMatrix :: Camera3D -> IO Matrix
getCameraMatrix camera = withFreeable camera c'getCameraMatrix >>= pop
Expand Down Expand Up @@ -1312,6 +1316,9 @@ 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)

isMouseButtonPressed :: MouseButton -> IO Bool
isMouseButtonPressed button = toBool <$> c'isMouseButtonPressed (fromIntegral $ fromEnum button)

Expand Down
8 changes: 4 additions & 4 deletions src/Raylib/Core/Textures.hs
Original file line number Diff line number Diff line change
Expand Up @@ -698,11 +698,11 @@ unloadRenderTexture renderTexture wr = do
unloadSingleTexture (texture'id $ renderTexture'texture renderTexture) wr
unloadSingleFrameBuffer (renderTexture'id renderTexture) wr

updateTexture :: Texture -> Ptr () -> IO Texture
updateTexture texture pixels = withFreeable texture (\t -> c'updateTexture t pixels >> peek t)
updateTexture :: Texture -> Ptr () -> IO ()
updateTexture texture pixels = withFreeable texture (\t -> c'updateTexture t pixels)

updateTextureRec :: Texture -> Rectangle -> Ptr () -> IO Texture
updateTextureRec texture rect pixels = withFreeable texture (\t -> withFreeable rect (\r -> c'updateTextureRec t r pixels) >> peek t)
updateTextureRec :: Texture -> Rectangle -> Ptr () -> IO ()
updateTextureRec texture rect pixels = withFreeable texture (\t -> withFreeable rect (\r -> c'updateTextureRec t r pixels))

genTextureMipmaps :: Texture -> IO Texture
genTextureMipmaps texture = withFreeable texture (\t -> c'genTextureMipmaps t >> peek t)
Expand Down
18 changes: 9 additions & 9 deletions src/Raylib/Types/Util/GUI.hs
Original file line number Diff line number Diff line change
Expand Up @@ -865,9 +865,9 @@ data GuiIconName
| IconFolder
| IconFile
| IconSandTimer
| Icon220
| Icon221
| Icon222
| IconWarning
| IconHelpBox
| IconInfoBox
| Icon223
| Icon224
| Icon225
Expand Down Expand Up @@ -1125,9 +1125,9 @@ instance Enum GuiIconName where
IconFolder -> 217
IconFile -> 218
IconSandTimer -> 219
Icon220 -> 220
Icon221 -> 221
Icon222 -> 222
IconWarning -> 220
IconHelpBox -> 221
IconInfoBox -> 222
Icon223 -> 223
Icon224 -> 224
Icon225 -> 225
Expand Down Expand Up @@ -1382,9 +1382,9 @@ instance Enum GuiIconName where
217 -> IconFolder
218 -> IconFile
219 -> IconSandTimer
220 -> Icon220
221 -> Icon221
222 -> Icon222
220 -> IconWarning
221 -> IconHelpBox
222 -> IconInfoBox
223 -> Icon223
224 -> Icon224
225 -> Icon225
Expand Down
Loading

0 comments on commit aad8b04

Please sign in to comment.