Kumo

A hand-rolled game engine.

git clone https://git.sentomk.me/Kumo.git
commit 5d2aded2dab6f6e395ea7e0374130c21c20dca28
parent 0db8f6b8ebae917eb20f2e46857b64e0f3d82bea
Author: sentomk <sentomk@proton.me>
Date:   Fri,  9 Oct 2026 17:16:39 +0800

style: align pointers to the left and include what is used

Set PointerAlignment to Left and stop deriving it per file, so that `T&`
and `T*` are written the same way everywhere. Fix the @copydoc target in
frame_buffer.h, and include <cstdlib> and <utility> in raster.cpp for
std::abs and std::swap instead of relying on other headers pulling them in.

Diffstat:
M.clang-format | 2++
Msrc/render/frame_buffer.h | 8++++----
Msrc/render/raster.cpp | 2++
3 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/.clang-format b/.clang-format @@ -1 +1,3 @@ BasedOnStyle: Google +DerivePointerAlignment: false +PointerAlignment: Left diff --git a/src/render/frame_buffer.h b/src/render/frame_buffer.h @@ -36,12 +36,12 @@ struct FrameBuffer { } /// @brief The pixel at (x, y), which must be inside the buffer. - Color &at(int x, int y) { + Color& at(int x, int y) { return pixels[static_cast<size_t>(y) * static_cast<size_t>(width) + static_cast<size_t>(x)]; } - /// @copydoc at (int, int) + /// @copydoc at(int, int) Color at(int x, int y) const { return pixels[static_cast<size_t>(y) * static_cast<size_t>(width) + static_cast<size_t>(x)]; @@ -56,7 +56,7 @@ struct FrameBuffer { /// /// @param framebuffer The buffer to hash. /// @return The hash. -uint64_t hash_pixels(const FrameBuffer &framebuffer); +uint64_t hash_pixels(const FrameBuffer& framebuffer); /// @brief Saves a buffer as an uncompressed 32-bit TGA image. /// @@ -66,6 +66,6 @@ uint64_t hash_pixels(const FrameBuffer &framebuffer); /// @param framebuffer The buffer to save; both sides must be 1 to 65535. /// @param path File to create or overwrite. /// @return `true` on success. -bool write_tga(const FrameBuffer &framebuffer, const char *path); +bool write_tga(const FrameBuffer& framebuffer, const char* path); } // namespace kumo diff --git a/src/render/raster.cpp b/src/render/raster.cpp @@ -1,6 +1,8 @@ #include "render/raster.h" #include <algorithm> +#include <cstdlib> +#include <utility> namespace kumo {