Replace stdlib headers with import std

This commit is contained in:
Lexi / Zoe 2026-05-16 01:58:45 +02:00
parent 5a53457817
commit d5d480d854
Signed by: binaryDiv
GPG key ID: F8D4956E224DA232
21 changed files with 31 additions and 39 deletions

View file

@ -1,11 +1,10 @@
module; module;
#include <iostream>
#include <memory>
#include <SDL3/SDL_init.h> #include <SDL3/SDL_init.h>
export module rutile.app; export module rutile.app;
import std;
import rutile.config; import rutile.config;
import rutile.core.engine; import rutile.core.engine;
import rutile.game.game; import rutile.game.game;

View file

@ -1,7 +1,5 @@
module; module;
#include <format>
#ifdef NDEBUG #ifdef NDEBUG
#define DEBUG_BOOL false #define DEBUG_BOOL false
#else #else
@ -10,6 +8,8 @@ module;
export module rutile.config; export module rutile.config;
import std;
export namespace rutile::config export namespace rutile::config
{ {
constexpr auto debug = DEBUG_BOOL; constexpr auto debug = DEBUG_BOOL;

View file

@ -1,11 +1,10 @@
module; module;
#include <cassert> #include <cassert>
#include <optional>
#include <string>
export module rutile.core.drawing.sprite; export module rutile.core.drawing.sprite;
import std;
import rutile.core.render_server; import rutile.core.render_server;
import wrappers.sdl; import wrappers.sdl;

View file

@ -1,11 +1,10 @@
module; module;
#include <cassert> #include <cassert>
#include <cstddef>
#include <memory>
export module rutile.core.drawing.tile_map; export module rutile.core.drawing.tile_map;
import std;
import rutile.core.drawing.tile_set; import rutile.core.drawing.tile_set;
import rutile.core.render_server; import rutile.core.render_server;
import wrappers.sdl; import wrappers.sdl;
@ -13,7 +12,7 @@ import wrappers.sdl;
export namespace rutile export namespace rutile
{ {
// Restrict map size to 16 bit per dimension, so that width*height still fits within size_t // Restrict map size to 16 bit per dimension, so that width*height still fits within size_t
using MapCoord = uint16_t; using MapCoord = std::uint16_t;
class TileMap class TileMap
{ {

View file

@ -1,12 +1,10 @@
module; module;
#include <cassert> #include <cassert>
#include <string>
#include <utility>
#include <vector>
export module rutile.core.drawing.tile_set; export module rutile.core.drawing.tile_set;
import std;
import rutile.core.render_server; import rutile.core.render_server;
import wrappers.sdl; import wrappers.sdl;

View file

@ -1,10 +1,10 @@
module; module;
#include <cassert> #include <cassert>
#include <memory>
export module rutile.core.engine; export module rutile.core.engine;
import std;
import rutile.config; import rutile.config;
import rutile.core.render_server; import rutile.core.render_server;
import rutile.core.ui.ui_server; import rutile.core.ui.ui_server;

View file

@ -1,10 +1,8 @@
module; module;
#include <string>
#include <utility>
export module rutile.core.render_server; export module rutile.core.render_server;
import std;
import rutile.core.resource_manager; import rutile.core.resource_manager;
import rutile.core.texture_loader; import rutile.core.texture_loader;
import wrappers.sdl; import wrappers.sdl;

View file

@ -1,13 +1,11 @@
module; module;
#include <cassert> #include <cassert>
#include <map>
#include <optional>
#include <string>
#include <vector>
export module rutile.core.resource_manager; export module rutile.core.resource_manager;
import std;
export namespace rutile export namespace rutile
{ {
template <typename ResourceLoaderType, typename ResourceType> template <typename ResourceLoaderType, typename ResourceType>

View file

@ -1,9 +1,8 @@
module; module;
#include <string>
export module rutile.core.texture_loader; export module rutile.core.texture_loader;
import std;
import rutile.core.resource_manager; import rutile.core.resource_manager;
import wrappers.sdl; import wrappers.sdl;
import wrappers.sdl_image; import wrappers.sdl_image;

View file

@ -11,6 +11,7 @@ module;
export module rutile.core.ui.backend.rmlui_render_interface; export module rutile.core.ui.backend.rmlui_render_interface;
import std;
import wrappers.sdl; import wrappers.sdl;
import wrappers.sdl_image; import wrappers.sdl_image;
@ -78,9 +79,9 @@ export namespace rutile
{ {
const GeometryView* geometry = reinterpret_cast<GeometryView*>(handle); const GeometryView* geometry = reinterpret_cast<GeometryView*>(handle);
const Rml::Vertex* vertices = geometry->vertices.data(); const Rml::Vertex* vertices = geometry->vertices.data();
const size_t num_vertices = geometry->vertices.size(); const std::size_t num_vertices = geometry->vertices.size();
const int* indices = geometry->indices.data(); const int* indices = geometry->indices.data();
const size_t num_indices = geometry->indices.size(); const std::size_t num_indices = geometry->indices.size();
// Convert RmlUi vertices to SDL vertices // Convert RmlUi vertices to SDL vertices
auto sdl_vertices = std::make_unique<sdl::Vertex[]>(num_vertices); auto sdl_vertices = std::make_unique<sdl::Vertex[]>(num_vertices);
@ -125,7 +126,7 @@ export namespace rutile
} }
// Convert colors to premultiplied alpha, which is necessary for correct alpha compositing. // Convert colors to premultiplied alpha, which is necessary for correct alpha compositing.
const size_t pixels_byte_size = surface.get_width() * surface.get_height() * 4; const std::size_t pixels_byte_size = surface.get_width() * surface.get_height() * 4;
Rml::byte* pixels = static_cast<Rml::byte*>(surface.get_raw_pixels()); Rml::byte* pixels = static_cast<Rml::byte*>(surface.get_raw_pixels());
for (size_t i = 0; i < pixels_byte_size; i += 4) { for (size_t i = 0; i < pixels_byte_size; i += 4) {

View file

@ -1,12 +1,12 @@
module; module;
#include <cassert> #include <cassert>
#include <format>
#include <RmlUi/Core.h> #include <RmlUi/Core.h>
#include <RmlUi/Debugger.h> #include <RmlUi/Debugger.h>
export module rutile.core.ui.ui_server; export module rutile.core.ui.ui_server;
import std;
import rutile.core.ui.backend.rmlui_render_interface; import rutile.core.ui.backend.rmlui_render_interface;
import rutile.core.ui.backend.rmlui_system_interface; import rutile.core.ui.backend.rmlui_system_interface;
import rutile.core.ui.backend.rmlui_input_handler; import rutile.core.ui.backend.rmlui_input_handler;

View file

@ -1,13 +1,11 @@
module; module;
#include <cassert> #include <cassert>
#include <memory>
#include <optional>
#include <vector>
#include <RmlUi/Core/ElementDocument.h> #include <RmlUi/Core/ElementDocument.h>
export module rutile.game.game; export module rutile.game.game;
import std;
import rutile.core.drawing.sprite; import rutile.core.drawing.sprite;
import rutile.core.drawing.tile_map; import rutile.core.drawing.tile_map;
import rutile.core.drawing.tile_set; import rutile.core.drawing.tile_set;

View file

@ -1,10 +1,10 @@
module; module;
#include <string>
#include <SDL3/SDL_clipboard.h> #include <SDL3/SDL_clipboard.h>
export module wrappers.sdl.clipboard; export module wrappers.sdl.clipboard;
import std;
import wrappers.sdl.error; import wrappers.sdl.error;
import wrappers.sdl.utils; import wrappers.sdl.utils;

View file

@ -1,11 +1,11 @@
module; module;
#include <format>
#include <stdexcept>
#include <SDL3/SDL_error.h> #include <SDL3/SDL_error.h>
export module wrappers.sdl.error; export module wrappers.sdl.error;
import std;
export namespace sdl export namespace sdl
{ {
// Exception that wraps an SDL error (which SDL function caused the error, what's the error). // Exception that wraps an SDL error (which SDL function caused the error, what's the error).

View file

@ -1,10 +1,10 @@
module; module;
#include <type_traits>
#include <SDL3/SDL_init.h> #include <SDL3/SDL_init.h>
export module wrappers.sdl.init; export module wrappers.sdl.init;
import std;
import wrappers.sdl.error; import wrappers.sdl.error;
export namespace sdl export namespace sdl

View file

@ -5,9 +5,11 @@ module;
export module wrappers.sdl.mouse; export module wrappers.sdl.mouse;
import std;
export namespace sdl export namespace sdl
{ {
using MouseButtonIndex = uint8_t; using MouseButtonIndex = std::uint8_t;
namespace MouseButtons namespace MouseButtons
{ {

View file

@ -1,11 +1,11 @@
module; module;
#include <cassert> #include <cassert>
#include <memory>
#include <SDL3/SDL.h> #include <SDL3/SDL.h>
export module wrappers.sdl.render; export module wrappers.sdl.render;
import std;
import utils.memory; import utils.memory;
import wrappers.sdl.error; import wrappers.sdl.error;
import wrappers.sdl.rect; import wrappers.sdl.rect;

View file

@ -1,11 +1,11 @@
module; module;
#include <cassert> #include <cassert>
#include <memory>
#include <SDL3/SDL.h> #include <SDL3/SDL.h>
export module wrappers.sdl.surface; export module wrappers.sdl.surface;
import std;
import utils.memory; import utils.memory;
import wrappers.sdl.error; import wrappers.sdl.error;

View file

@ -1,10 +1,11 @@
module; module;
#include <string>
#include <SDL3/SDL_stdinc.h> #include <SDL3/SDL_stdinc.h>
export module wrappers.sdl.utils; export module wrappers.sdl.utils;
import std;
export namespace sdl export namespace sdl
{ {
/** /**

View file

@ -1,11 +1,11 @@
module; module;
#include <cassert> #include <cassert>
#include <memory>
#include <SDL3/SDL.h> #include <SDL3/SDL.h>
export module wrappers.sdl.video; export module wrappers.sdl.video;
import std;
import utils.memory; import utils.memory;
import wrappers.sdl.error; import wrappers.sdl.error;
import wrappers.sdl.rect; import wrappers.sdl.rect;

View file

@ -1,11 +1,11 @@
module; module;
#include <string>
#include <SDL3/SDL.h> #include <SDL3/SDL.h>
#include <SDL3_image/SDL_image.h> #include <SDL3_image/SDL_image.h>
export module wrappers.sdl_image; export module wrappers.sdl_image;
import std;
import utils.memory; import utils.memory;
import wrappers.sdl.error; import wrappers.sdl.error;
import wrappers.sdl.render; import wrappers.sdl.render;