Skip to content
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

SetMatrix(matrix) + Draw(target) vs Draw(target, matrix) #306

Open
Seb-C opened this issue May 7, 2022 · 0 comments
Open

SetMatrix(matrix) + Draw(target) vs Draw(target, matrix) #306

Seb-C opened this issue May 7, 2022 · 0 comments

Comments

@Seb-C
Copy link

Seb-C commented May 7, 2022

First, I'd like to just say thank you for this package. I've been using Pixel for a few months now, and I'm very happy with it.
It has the perfect balance between simplicity and not trying too hard to isolate me away the underlying logic.

As my game is growing in size and complexity, I often find it challenging to deal with the fact that SetMatrix (in many components) actually makes the component stateful, which in some situations makes it harder to have clean separate of concerns.

At the same time, I've met other challenges due to the fact that not all components have the same definition: Sometimes it's Draw(target) and sometimes it's Draw(target, matrix). As go is very strictly typed, there is no convenient solution to make all components compatible with a single Drawer interface.

Is there a fundamental and purposeful design difference between those two patterns?

target.SetMatrix(matrix)
foo.Draw(target)
foo.Draw(target, matrix)

If no, do you think that making everything use the second pattern would be a welcome change to this package?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant