[nostalgia/core] Cleanup
This commit is contained in:
parent
41cebff5fc
commit
779dd1fd05
@ -8,6 +8,7 @@
|
||||
|
||||
#include "assetmanager.hpp"
|
||||
#include "event.hpp"
|
||||
#include "input.hpp"
|
||||
|
||||
namespace nostalgia::common {
|
||||
class Size;
|
||||
@ -16,13 +17,7 @@ class Size;
|
||||
namespace nostalgia::core {
|
||||
|
||||
class Context;
|
||||
|
||||
class Drawer {
|
||||
public:
|
||||
virtual ~Drawer() = default;
|
||||
|
||||
virtual void draw(Context*) noexcept = 0;
|
||||
};
|
||||
class Drawer;
|
||||
|
||||
// User Input Output
|
||||
class Context {
|
||||
@ -31,6 +26,7 @@ class Context {
|
||||
friend constexpr T *applicationData(Context *ctx) noexcept;
|
||||
friend constexpr void setConstantRefresh(Context *ctx, bool) noexcept;
|
||||
friend bool bgStatus(Context *ctx, unsigned bg) noexcept;
|
||||
friend bool buttonDown(Context *ctx, Key) noexcept;
|
||||
friend common::Size getScreenSize(Context *ctx) noexcept;
|
||||
friend int getScreenHeight(Context *ctx) noexcept;
|
||||
friend int getScreenWidth(Context *ctx) noexcept;
|
||||
|
@ -17,6 +17,13 @@ namespace nostalgia::core {
|
||||
|
||||
extern char charMap[128];
|
||||
|
||||
class Drawer {
|
||||
public:
|
||||
virtual ~Drawer() = default;
|
||||
|
||||
virtual void draw(Context*) noexcept = 0;
|
||||
};
|
||||
|
||||
enum class TileSheetSpace {
|
||||
Background,
|
||||
Sprite
|
||||
|
@ -3,7 +3,6 @@
|
||||
*/
|
||||
|
||||
#include <GLFW/glfw3.h>
|
||||
#include <imgui_impl_opengl3.h>
|
||||
#include <imgui_impl_glfw.h>
|
||||
|
||||
#include <ox/std/defines.hpp>
|
||||
|
@ -11,24 +11,19 @@
|
||||
namespace nostalgia::core {
|
||||
|
||||
[[nodiscard]]
|
||||
constexpr std::size_t pointToIdx(int w, int x, int y) noexcept {
|
||||
constexpr std::size_t ptToIdx(int x, int y, int c) noexcept {
|
||||
constexpr auto colLength = static_cast<std::size_t>(PixelsPerTile);
|
||||
const auto rowLength = static_cast<std::size_t>(static_cast<std::size_t>(w / TileWidth) * colLength);
|
||||
const auto rowLength = static_cast<std::size_t>(static_cast<std::size_t>(c / TileWidth) * colLength);
|
||||
const auto colStart = static_cast<std::size_t>(colLength * static_cast<std::size_t>(x / TileWidth));
|
||||
const auto rowStart = static_cast<std::size_t>(rowLength * static_cast<std::size_t>(y / TileHeight));
|
||||
const auto colOffset = static_cast<std::size_t>(x % TileWidth);
|
||||
const auto rowOffset = static_cast<std::size_t>((y % TileHeight) * TileHeight);
|
||||
const auto rowOffset = static_cast<std::size_t>(static_cast<std::size_t>(y % TileHeight) * TileHeight);
|
||||
return static_cast<std::size_t>(colStart + colOffset + rowStart + rowOffset);
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
constexpr std::size_t ptToIdx(int x, int y, int c) noexcept {
|
||||
return pointToIdx(c * TileWidth, x, y);
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
constexpr std::size_t ptToIdx(common::Point pt, int c) noexcept {
|
||||
return pointToIdx(c * TileWidth, pt.x, pt.y);
|
||||
constexpr std::size_t ptToIdx(const common::Point &pt, int c) noexcept {
|
||||
return ptToIdx(pt.x, pt.y, c * TileWidth);
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
|
Loading…
x
Reference in New Issue
Block a user