Skip to content

Commit

Permalink
Add method overloads to convert Julia enums to Ints for input events (#…
Browse files Browse the repository at this point in the history
…30)

* Add method overloads to convert Julia enums to Ints for input events

* Fix missing comma

Co-authored-by: Peter <adgjl5645@hotmail.com>

---------

Co-authored-by: Peter <adgjl5645@hotmail.com>
  • Loading branch information
jordancluts and chengchingwen authored Aug 17, 2023
1 parent 3ef2133 commit 576745a
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion src/core.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 576745a

Please # to comment.