Added C language demo to the 'reading-and-writing-graphics' example #171
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Firstly, I would like to tell you that this wasm-by-example project really helped me in solidifying my knowledge of WebAssembly.
In an effort to contribute back to this project, I’ve added a example for the C language in the ‘reading-and-writing-graphics’ section.
In this example, I’ve tried to keep the index.js file consistent with the one in the AssemblyScript example. While there might be room for simplification and improvement, I believe maintaining consistency across examples would be better.
Also the booleans to check if the current square is dark or light can be brought down this single condition
(x % 2 == y % 2)
. I didn't do that in order to stay consistent.Please note that this example does not use Emscripten.
I hope this contribution is useful. If it is, I’d be more than happy to continue doing more contributions.