From 576745accb1583099e024aa4be5e609ec56148c4 Mon Sep 17 00:00:00 2001 From: jordancluts <40438956+jordancluts@users.noreply.github.com> Date: Thu, 17 Aug 2023 08:10:07 -0400 Subject: [PATCH] Add method overloads to convert Julia enums to Ints for input events (#30) * Add method overloads to convert Julia enums to Ints for input events * Fix missing comma Co-authored-by: Peter --------- Co-authored-by: Peter --- src/core.jl | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/core.jl b/src/core.jl index 809376c..eac999a 100644 --- a/src/core.jl +++ b/src/core.jl @@ -57,9 +57,23 @@ end Base.length(fdata::RayFileData) = length(fdata.data) Base.pointer(fdata::RayFileData) = pointer(fdata.data) - +#Convert KeyPressed Enums to Int for func in :( IsKeyDown, IsKeyPressed, IsKeyReleased, IsKeyUp ).args @eval Binding.$func(k::KeyboardKey) = $func(convert(Integer, k)) end + +#Convert MouseButton Enums to Int +for func in :( + IsMouseButtonDown, IsMouseButtonPressed, IsMouseButtonReleased, IsMouseButtonUp +).args + @eval Binding.$func(m::MouseButton) = $func(convert(Integer, m)) +end + +#Convert MouseCursor Enums to Int +for func in :( + SetMouseCursor, +).args + @eval Binding.$func(c::MouseCursor) = $func(convert(Integer, c)) +end