export module app; import core; import core.image; import core.math; export namespace app { struct path { static constexpr core::usize max = 0xff; static constexpr char seperator = '/'; core::u8 buffer[max + 1]; static constexpr path empty() { path empty_path = {0}; empty_path.buffer[max] = max; return empty_path; } core::slice as_slice() const { return {reinterpret_cast(this->buffer), this->size()}; } constexpr core::usize size() const { return max - this->buffer[max]; } core::i16 compare(path const & that) { return 0; } bool equals(path const & that) { return core::equals(this->as_slice(), that.as_slice()); } constexpr path joined(core::slice const & text) const { if (text.length > this->buffer[max]) return empty(); path joined_path = *this; for (char const c : text) { joined_path.buffer[joined_path.size()] = c; joined_path.buffer[max] -= 1; } return joined_path; } core::u64 hash() { return 0; } }; struct file_store { virtual void read_file(app::path const & file_path, core::callable const & then) = 0; }; enum class log_level { notice, warning, error, }; struct system { virtual bool poll() = 0; virtual file_store & bundle() = 0; virtual void log(log_level level, core::slice const & message) = 0; virtual core::allocator & thread_safe_allocator() = 0; }; struct graphics { enum class show_error { none, out_of_memory, }; struct canvas { core::color background_color; }; virtual void render(canvas & source_canvas) = 0; virtual void present() = 0; virtual show_error show(core::u16 physical_width, core::u16 physical_height) = 0; virtual void retitle(core::slice const & updated_title) = 0; }; }