[nostalgia/core] Delete all of core::Context's friendships
This commit is contained in:
parent
7d0dcae00e
commit
5dd3b678ae
@ -1,16 +1,3 @@
|
||||
/*
|
||||
* Copyright 2016 - 2023 Gary Talent (gary@drinkingtea.net). All rights reserved.
|
||||
*/
|
||||
|
||||
#include "context.hpp"
|
||||
#include "gfx.hpp"
|
||||
|
||||
#include "core.hpp"
|
||||
|
||||
namespace nostalgia::core {
|
||||
|
||||
Context::~Context() noexcept {
|
||||
shutdownGfx(this);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -14,62 +14,19 @@
|
||||
|
||||
#include "initparams.hpp"
|
||||
|
||||
namespace nostalgia::core {
|
||||
class Context;
|
||||
}
|
||||
|
||||
namespace nostalgia::core::gl {
|
||||
void drawMainView(core::Context*, ox::Size const&) noexcept;
|
||||
void drawMainView(core::Context*) noexcept;
|
||||
}
|
||||
|
||||
namespace nostalgia::core {
|
||||
|
||||
// User Input Output
|
||||
class Context {
|
||||
friend bool bgStatus(Context *ctx, unsigned bg) noexcept;
|
||||
friend ox::Error initGfx(Context *ctx, const InitParams&) noexcept;
|
||||
friend void shutdownGfx(Context *ctx) noexcept;
|
||||
friend ox::Error loadBgTileSheet(Context *ctx,
|
||||
unsigned cbb,
|
||||
const ox::FileAddress &tilesheetPath,
|
||||
const ox::FileAddress &palettePath) noexcept;
|
||||
friend ox::Error loadSpriteTileSheet(Context *ctx,
|
||||
const ox::FileAddress &tilesheetAddr,
|
||||
const ox::FileAddress &paletteAddr) noexcept;
|
||||
friend ox::Result<struct TileSheetData> loadTileSheet(Context *ctx,
|
||||
const struct CompactTileSheet &tilesheetAddr) noexcept;
|
||||
friend uint8_t bgStatus(Context *ctx) noexcept;
|
||||
friend void clearTileLayer(Context *ctx, unsigned bgIdx) noexcept;
|
||||
friend void draw(Context *ctx) noexcept;
|
||||
friend void setBgCbb(Context *ctx, unsigned bgIdx, unsigned cbb) noexcept;
|
||||
friend void setBgStatus(Context *ctx, uint32_t status) noexcept;
|
||||
friend void setBgStatus(Context *ctx, unsigned bg, bool status) noexcept;
|
||||
friend void setTile(Context *ctx, unsigned bgIdx, int column, int row, uint8_t tile) noexcept;
|
||||
friend void setSprite(Context *ctx,
|
||||
unsigned idx,
|
||||
int x,
|
||||
int y,
|
||||
unsigned tileIdx,
|
||||
unsigned spriteShape,
|
||||
unsigned spriteSize,
|
||||
unsigned flipX) noexcept;
|
||||
friend void hideSprite(Context *ctx, unsigned idx) noexcept;
|
||||
friend void gl::drawMainView(core::Context*, ox::Size const&) noexcept;
|
||||
friend void gl::drawMainView(core::Context*) noexcept;
|
||||
|
||||
public:
|
||||
turbine::Context *turbineCtx = nullptr;
|
||||
|
||||
public:
|
||||
Context() noexcept = default;
|
||||
|
||||
Context(Context &other) noexcept = delete;
|
||||
Context(const Context &other) noexcept = delete;
|
||||
Context(const Context &&other) noexcept = delete;
|
||||
|
||||
~Context() noexcept;
|
||||
|
||||
auto &rom() noexcept {
|
||||
return *turbineCtx->rom;
|
||||
}
|
||||
|
@ -81,3 +81,9 @@ void setSprite(Context *ctx, unsigned idx, int x, int y, unsigned tileIdx,
|
||||
void setSprite(Context *ctx, const Sprite &s) noexcept;
|
||||
|
||||
}
|
||||
|
||||
namespace nostalgia::core::gl {
|
||||
void drawMainView(core::Context*, ox::Size const&) noexcept;
|
||||
void drawMainView(core::Context*) noexcept;
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,6 @@
|
||||
target_sources(
|
||||
NostalgiaCore PRIVATE
|
||||
context.cpp
|
||||
core.cpp
|
||||
gfx.cpp
|
||||
)
|
||||
|
14
src/nostalgia/core/opengl/context.cpp
Normal file
14
src/nostalgia/core/opengl/context.cpp
Normal file
@ -0,0 +1,14 @@
|
||||
/*
|
||||
* Copyright 2016 - 2023 Gary Talent (gary@drinkingtea.net). All rights reserved.
|
||||
*/
|
||||
|
||||
#include "context.hpp"
|
||||
#include "gfx.hpp"
|
||||
|
||||
namespace nostalgia::core {
|
||||
|
||||
GlContext::~GlContext() noexcept {
|
||||
shutdownGfx(this);
|
||||
}
|
||||
|
||||
}
|
@ -10,6 +10,9 @@
|
||||
|
||||
#include "gfx.hpp"
|
||||
|
||||
#include "../gfx.hpp"
|
||||
#include "../context.hpp"
|
||||
|
||||
namespace nostalgia::core {
|
||||
|
||||
struct GlContext: public core::Context {
|
||||
@ -21,6 +24,7 @@ struct GlContext: public core::Context {
|
||||
ox::Array<renderer::Background, 4> backgrounds;
|
||||
ox::Optional<ox::Size> renderSize;
|
||||
renderer::Drawer drawer;
|
||||
~GlContext() noexcept;
|
||||
};
|
||||
|
||||
}
|
||||
|
@ -10,6 +10,8 @@
|
||||
|
||||
#include <glutils/glutils.hpp>
|
||||
|
||||
#include "../context.hpp"
|
||||
|
||||
namespace nostalgia::core::renderer {
|
||||
|
||||
constexpr uint64_t TileRows = 128;
|
||||
@ -59,5 +61,6 @@ class Drawer: public turbine::gl::Drawer {
|
||||
}
|
||||
|
||||
namespace nostalgia::core {
|
||||
ox::Error initGfx(Context *ctx, const InitParams &) noexcept;
|
||||
ox::Error initGfx(Context *ctx, const InitParams&) noexcept;
|
||||
void shutdownGfx(Context *ctx) noexcept;
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user