ArthurSonzogni / smk

SMK - Simple multimedia kit - C++ WebAssembly
MIT License
123 stars 18 forks source link

Enforced coding standards? #5

Closed TheMaverickProgrammer closed 3 years ago

TheMaverickProgrammer commented 3 years ago

I see a lot of different coding styles throughout the project and many places where doxygen-style documentation is not enforced.

For instance, the global default shaders use snake case shader_program_2d() while the rest of the code is Pascal case, so shouldn't it be ShaderProgram2D()?

window.input() instead of window.Input() as well.

There are also a number of places where getters/setters are avoided completely by exposing the variable itself. Like in FrameBuffer's color_texture. There ought to be a getter for that smk::Texture& ColorTexture()...

What are the coding standards?

If there are none, I'd like to have your blessing to spruce up the library by enforcing Pascal-case, I'll add more documentation, and proper encapsulation with appropriate getters and setters.

Not to be pushy but let me know soon! I have free time tomorrow to do all of this and I am porting a big project to SMK so it'd be a great use of my free time and SMK would greatly benefit from it!

ArthurSonzogni commented 3 years ago

I would be really happy accepting pull request improving the coding style! Even the ones breaking API.

I am following the chromium coding style: https://chromium.googlesource.com/chromium/src/+/master/styleguide/styleguide.md (more or less consistently)

You can auto format using clang-format: https://github.com/ArthurSonzogni/smk/blob/master/.clang-format

TheMaverickProgrammer commented 3 years ago

Gotta say I'm not a fan of the style but it's not my library haha I'll sweep through and standardize it to chromium

ArthurSonzogni commented 3 years ago

Gotta say I'm not a fan of the style but it's not my library haha

That was my initial reaction when I started working on Chromium.... Now I am used to it, I am loving it ;-)

I'll sweep through and standardize it to chromium

Some formatting can be done using clang-format and also by running: https://github.com/ArthurSonzogni/smk/blob/master/other/format.sh

TheMaverickProgrammer commented 3 years ago

maybe it's because I spent the last day reviewing the style and patching up smk, but now it's growing on me too