Implement M9.2 native client lifecycle and immutable render boundary

This commit is contained in:
dingo
2026-10-01 16:58:46 -04:00
parent d487d86ea3
commit 04c7715646
24 changed files with 827 additions and 34 deletions
+36
View File
@@ -0,0 +1,36 @@
#pragma once
#include <cstddef>
#include <cstdint>
#include <expected>
#include <span>
#include <vector>
namespace evo::render {
inline constexpr std::size_t max_rectangles = 4096;
struct Color {
std::uint8_t red{}, green{}, blue{}, alpha{255};
};
struct Rectangle {
float x{}, y{}, width{}, height{};
Color color;
};
enum class FrameError : std::uint8_t { too_many_primitives, invalid_geometry };
// Owns copied logical-window coordinates; never stores simulation/native handles.
class Frame {
public:
[[nodiscard]] static std::expected<Frame, FrameError>
create(std::span<const Rectangle> rectangles, Color background = {});
[[nodiscard]] std::span<const Rectangle> rectangles() const noexcept {
return rectangles_;
}
[[nodiscard]] Color background() const noexcept {
return background_;
}
private:
Frame(std::span<const Rectangle> rectangles, Color background)
: rectangles_(rectangles.begin(), rectangles.end()), background_{background} {}
std::vector<Rectangle> rectangles_;
Color background_;
};
} // namespace evo::render