17cupsofcoffee / tetra

🎮 A simple 2D game framework written in Rust
MIT License
917 stars 63 forks source link

Added bunch of SDL_Window* functions #278

Closed Tairesh closed 3 years ago

Tairesh commented 3 years ago

I don't know if it is necessary for anyone else, but I needed some SDL functions like SDL_SetWindowPosition that Tetra currently doesn't provide, so I added some of them. I'm a very inexperienced Rust programmer so I may have just made some mess and nonsense, but if it would be useful I'd be glad to share this. Also sorry for my English.

17cupsofcoffee commented 3 years ago

I'm definitely in favour of adding these! I just need to give some thought to the naming/API consistency - will try to give a proper review in the next day or two.

17cupsofcoffee commented 3 years ago

Okay, I finally got round to reviewing this, and made the following tweaks:

I've merged this PR manually with my tweaks included (b2a1022), so closing this now :)

sumibi-yakitori commented 3 years ago

@Tairesh @17cupsofcoffee I needed a set of these functions as well, but I was hesitant to send a PR because I didn't think I should publish functions that could be highly dependent on SDL. Thanks for adding them.

17cupsofcoffee commented 3 years ago

@sumibi-yakitori: If you (or anyone else) are ever considering a PR but aren't sure if it'd get accepted, please open an issue or a discussion thread - I'm always happy to do a bit of research and let you know my thoughts 🙂

I'm usually happy to expose SDL2 functionality as long as there's a good use case for it and the API isn't miles away from what other windowing libraries have available - for example, I don't think all other windowing libraries have built-in 'center the window' functionality, but it'd not be too difficult to build it on top of their functions for getting the monitor size/setting the window position.

sumibi-yakitori commented 3 years ago

@17cupsofcoffee

OK, I'll do that next time! Do you have any plans to make tetra compatible with WASM? I don't really need it at the moment, but if you do, it will affect the design of APIs around Window.

17cupsofcoffee commented 3 years ago

@sumibi-yakitori: I would like to make Tetra WASM-compatible in the future (I actually have a prototype branch of it!), but desktop is probably going to remain the main focus, and I wouldn't be opposed to having stuff that's desktop-only as long as it's clearly documented.