From a3643a4036aa534295e445c28b043595f6167ec4 Mon Sep 17 00:00:00 2001 From: Gary Talent Date: Thu, 3 Feb 2022 21:46:03 -0600 Subject: [PATCH] [nostalgia/core/userland] Replace std::array with ox::Array --- src/nostalgia/core/userland/gfx.cpp | 3 ++- src/nostalgia/core/userland/gfx.hpp | 2 +- src/nostalgia/core/userland/gfx_opengl.cpp | 10 ++++------ 3 files changed, 7 insertions(+), 8 deletions(-) diff --git a/src/nostalgia/core/userland/gfx.cpp b/src/nostalgia/core/userland/gfx.cpp index 7abc6e24..19b27442 100644 --- a/src/nostalgia/core/userland/gfx.cpp +++ b/src/nostalgia/core/userland/gfx.cpp @@ -46,7 +46,8 @@ ox::Error loadBgTileSheet(Context *ctx, pixels[i * 2 + 1] = toColor32(palette->colors[tilesheet->pixels[i] >> 4]); } } - return renderer::loadBgTexture(ctx->rendererData(), section, pixels.data(), width, height); + renderer::loadBgTexture(ctx->rendererData(), section, pixels.data(), width, height); + return OxError(0); } void puts(Context *ctx, int column, int row, const char *str) noexcept { diff --git a/src/nostalgia/core/userland/gfx.hpp b/src/nostalgia/core/userland/gfx.hpp index e7e2fc5c..8a30f99f 100644 --- a/src/nostalgia/core/userland/gfx.hpp +++ b/src/nostalgia/core/userland/gfx.hpp @@ -14,6 +14,6 @@ ox::Error init(Context *ctx, void **rendererData) noexcept; void shutdown(Context *ctx, void *rendererData) noexcept; -ox::Error loadBgTexture(void *rendererData, int section, void *pixels, int w, int h) noexcept; +void loadBgTexture(void *rendererData, int section, void *pixels, int w, int h) noexcept; } diff --git a/src/nostalgia/core/userland/gfx_opengl.cpp b/src/nostalgia/core/userland/gfx_opengl.cpp index 55921ef9..339507df 100644 --- a/src/nostalgia/core/userland/gfx_opengl.cpp +++ b/src/nostalgia/core/userland/gfx_opengl.cpp @@ -2,12 +2,11 @@ * Copyright 2016 - 2022 Gary Talent (gary@drinkingtea.net). All rights reserved. */ -#include - #include #include +#include #include #include @@ -33,7 +32,7 @@ struct Background: public glutils::BufferSet { bool enabled = false; bool updated = false; - inline Background() noexcept { + Background() noexcept { vertices.resize(TileCount * BgVertexVboLength); elements.resize(TileCount * BgVertexEboLength); } @@ -43,7 +42,7 @@ struct GlImplData { glutils::GLProgram bgShader; int64_t prevFpsCheckTime = 0; uint64_t draws = 0; - std::array backgrounds; + ox::Array backgrounds; }; constexpr const GLchar *bgvshad = R"( @@ -200,12 +199,11 @@ void shutdown(Context*, void *rendererData) noexcept { delete id; } -ox::Error loadBgTexture(void *rendererData, int section, void *pixels, int w, int h) noexcept { +void loadBgTexture(void *rendererData, int section, void *pixels, int w, int h) noexcept { oxTracef("nostalgia::core::gfx::gl", "loadBgTexture: { section: {}, w: {}, h: {} }", section, w, h); const auto id = static_cast(rendererData); auto &tex = id->backgrounds[static_cast(section)].tex; tex = loadTexture(w, h, pixels); - return OxError(0); } }