[nostalgia] Move geo types to Ox
This commit is contained in:
@@ -5,8 +5,8 @@
|
||||
#include <imgui.h>
|
||||
#include <lodepng.h>
|
||||
|
||||
#include <ox/std/point.hpp>
|
||||
#include <keel/media.hpp>
|
||||
#include <nostalgia/geo/point.hpp>
|
||||
|
||||
#include "tilesheeteditor-imgui.hpp"
|
||||
|
||||
@@ -114,7 +114,7 @@ void TileSheetEditorImGui::keyStateChanged(core::Key key, bool down) {
|
||||
void TileSheetEditorImGui::draw(core::Context*) noexcept {
|
||||
const auto paneSize = ImGui::GetContentRegionAvail();
|
||||
const auto tileSheetParentSize = ImVec2(paneSize.x - m_palViewWidth, paneSize.y);
|
||||
const auto fbSize = geo::Vec2(tileSheetParentSize.x - 16, tileSheetParentSize.y - 16);
|
||||
const auto fbSize = ox::Vec2(tileSheetParentSize.x - 16, tileSheetParentSize.y - 16);
|
||||
ImGui::BeginChild("TileSheetView", tileSheetParentSize, true);
|
||||
{
|
||||
drawTileSheet(fbSize);
|
||||
@@ -240,7 +240,7 @@ studio::UndoStack *TileSheetEditorImGui::undoStack() noexcept {
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
geo::Vec2 TileSheetEditorImGui::clickPos(const ImVec2 &winPos, geo::Vec2 clickPos) noexcept {
|
||||
ox::Vec2 TileSheetEditorImGui::clickPos(const ImVec2 &winPos, ox::Vec2 clickPos) noexcept {
|
||||
clickPos.x -= winPos.x + 10;
|
||||
clickPos.y -= winPos.y + 10;
|
||||
return clickPos;
|
||||
@@ -274,9 +274,9 @@ void TileSheetEditorImGui::exportSubhseetToPng() noexcept {
|
||||
}
|
||||
}
|
||||
|
||||
void TileSheetEditorImGui::drawTileSheet(const geo::Vec2 &fbSize) noexcept {
|
||||
void TileSheetEditorImGui::drawTileSheet(const ox::Vec2 &fbSize) noexcept {
|
||||
const auto winPos = ImGui::GetWindowPos();
|
||||
const auto fbSizei = geo::Size(static_cast<int>(fbSize.x), static_cast<int>(fbSize.y));
|
||||
const auto fbSizei = ox::Size(static_cast<int>(fbSize.x), static_cast<int>(fbSize.y));
|
||||
if (m_framebuffer.width != fbSizei.width || m_framebuffer.height != fbSizei.height) {
|
||||
glutils::resizeInitFrameBuffer(&m_framebuffer, fbSizei.width, fbSizei.height);
|
||||
m_tileSheetEditor.resizeView(fbSize);
|
||||
@@ -296,7 +296,7 @@ void TileSheetEditorImGui::drawTileSheet(const geo::Vec2 &fbSize) noexcept {
|
||||
ImVec2(1, 0));
|
||||
// handle input, this must come after drawing
|
||||
const auto &io = ImGui::GetIO();
|
||||
const auto mousePos = geo::Vec2(io.MousePos);
|
||||
const auto mousePos = ox::Vec2(io.MousePos);
|
||||
if (ImGui::IsItemHovered()) {
|
||||
const auto wheel = io.MouseWheel;
|
||||
const auto wheelh = io.MouseWheelH;
|
||||
@@ -326,7 +326,7 @@ void TileSheetEditorImGui::drawTileSheet(const geo::Vec2 &fbSize) noexcept {
|
||||
}
|
||||
}
|
||||
if (ImGui::BeginPopupContextItem("TileMenu", ImGuiPopupFlags_MouseButtonRight)) {
|
||||
const auto popupPos = geo::Vec2(ImGui::GetWindowPos());
|
||||
const auto popupPos = ox::Vec2(ImGui::GetWindowPos());
|
||||
if (ImGui::MenuItem("Insert Tile")) {
|
||||
m_tileSheetEditor.insertTile(fbSize, clickPos(winPos, popupPos));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user