gotranspile / cxgo

Tool for transpiling C to Go.
https://gotranspile.dev
MIT License
337 stars 22 forks source link

Example of using cxgo to transpile physac 2d physics engine #43

Closed koteyur closed 2 years ago

koteyur commented 2 years ago

Hi. I've found cxgo today and I think it's really exciting!

I decided to try to find some small project in C which might be interesting to be transpiled to go and this experiment was really successful. The project I found was Physac. It's a small 2d physics engine written in pure C with just a few deps.

I created a repo with end results of my try: https://github.com/koteyur/physac-go In the first commit output is almost what I get after running cxgo. To make it usable I've just replaced time functions from libc package, because some of them wasn't implemented. After that it started working just fine.

TLDR; I think, this example of completely working program after using cxgo might be interesting.

Thanks!

dennwc commented 2 years ago

Glad to hear that it was useful! :) I'll add your project to the list in the readme, if you don't mind.

Indeed, some functions are still stubs, so contributions are welcome!

koteyur commented 2 years ago

I'll add your project to the list in the readme, if you don't mind.

Sure, thank you!

Indeed, some functions are still stubs, so contributions are welcome!

I'll probably make a PR with my changes to libc/time.go with partial support of CLOCK_MONOTINIC