To demonstrate the improvements being made to KnightOS's C support, I've started to make a Real Project in C.
The source code is here, it's worth browsing (especially if you know C): https://github.com/SirCmpwn/pong
Pong is a pretty simple project, but since this is meant to be an example I've been keeping it carefully organized so that it's a clear example of how you might structure a large C project for KnightOS. Some important things going on here include:
I haven't put it in place yet, but dynamic linking with KnightOS libraries (i.e. corelib, configlib, etc) works and I'll be putting that into this game somehow.
Other than that, this is your usual project updates thread. Pong! Currently the ball logic is implemented (for bouncing around and scoring points), and you can move paddles around. Collision between paddle and ball isn't in place yet, nor is any sort of main menu or any other UI. More on that to come!
The source code is here, it's worth browsing (especially if you know C): https://github.com/SirCmpwn/pong
Pong is a pretty simple project, but since this is meant to be an example I've been keeping it carefully organized so that it's a clear example of how you might structure a large C project for KnightOS. Some important things going on here include:
- Images are kept as PNG files, and then magically converted to object files and linked into your application through kimg and scwrap. English: the sprites are PNG files, not hex written into the code
- This separates everything into separate C files for the sake of organization and they're all linked together correctly
- Globals work now! And libc is working well, and some bugs were fixed in unused function optimization and in kcc. Not really a feature of this project, but it wouldn't work without.
I haven't put it in place yet, but dynamic linking with KnightOS libraries (i.e. corelib, configlib, etc) works and I'll be putting that into this game somehow.
Other than that, this is your usual project updates thread. Pong! Currently the ball logic is implemented (for bouncing around and scoring points), and you can move paddles around. Collision between paddle and ball isn't in place yet, nor is any sort of main menu or any other UI. More on that to come!