-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add 2D Graphics library #39
Conversation
88d344c
to
f19f216
Compare
instance : Inhabited Picture where | ||
default := .blank | ||
|
||
instance : Append Picture where |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@paulcadman Picture is probably also a Monoid
Given how Image is described by Conal in
Denotational Design: From Meanings To Programs • Conal Elliott • YOW! 2015
https://www.youtube.com/watch?v=rlyqoYoUumc
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@awalterschulze you're right, but I couldn't find a separate Monoid
class in Lean4 prelude.
The Append
class is equivalent to Haskell Semigroup
. And Inhabited
+ Append
is equivalent to Haskell Monoid
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And thanks for the YouTube link - I had forgotten that Image was the example in Conal's talk. Perhaps we should use his encoding instead.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah ok, I didn't know Lean was missing a Monoid class, TIL about Append + Inhabited = Monoid. I think this clears some things up about Inhabited for me, hmmm :O
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll have to rewatch the Conal talk again to remember anything tangible besides the monoid part. The rest was more a way a thinking about code, which has been really useful.
We don't have to fully go down this path though. I think what you have setup is already really cool.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think he did something else where he didn't evaluate the transformations until he new the size of the picture he needed to draw, so that way he never loses any picture quality from scaling up and down
The goal of this PR is to provide a 2D Graphics library layer on top of raylib's API that's more uniform with respect to coordinates in a window and provides scaling and translation transformations on rectangles and circles and aggregations thereof.
The coordinate system for objects in the 2D Graphics library has its origin in the centre of the window instead of the top-left of the screen. And the y-axis values increase with increasing height.
See the Window and Orbital demos for examples of usage.
This PR also adds the
cfold
andcollect
ECS system functions that can be used to fold over / collect matching components respectively. Thecollect
function is used in the Orbital demo.