[keel,nostalgia,studio] Fix implicit conversions
This commit is contained in:
parent
3fdfee33a9
commit
aa19cdf535
@ -116,7 +116,7 @@ ox::Result<std::size_t> getPreloadAddr(keel::Context *ctx, ox::CRStringView path
|
||||
oxRequire(stat, ctx->rom->stat(path));
|
||||
oxRequire(buff, static_cast<ox::MemFS*>(ctx->rom.get())->directAccess(path));
|
||||
PreloadPtr p;
|
||||
oxReturnError(ox::readMC(buff, stat.size, &p));
|
||||
oxReturnError(ox::readMC(buff, static_cast<std::size_t>(stat.size), &p));
|
||||
return static_cast<std::size_t>(p.preloadAddr) + ctx->preloadSectionOffset;
|
||||
}
|
||||
|
||||
@ -124,7 +124,7 @@ ox::Result<std::size_t> getPreloadAddr(keel::Context *ctx, const ox::FileAddress
|
||||
oxRequire(stat, ctx->rom->stat(file));
|
||||
oxRequire(buff, static_cast<ox::MemFS*>(ctx->rom.get())->directAccess(file));
|
||||
PreloadPtr p;
|
||||
oxReturnError(ox::readMC(buff, stat.size, &p));
|
||||
oxReturnError(ox::readMC(buff, static_cast<std::size_t>(stat.size), &p));
|
||||
return static_cast<std::size_t>(p.preloadAddr) + ctx->preloadSectionOffset;
|
||||
}
|
||||
|
||||
|
@ -26,7 +26,7 @@ if(TURBINE_BUILD_TYPE STREQUAL "Native")
|
||||
target_link_libraries(
|
||||
NostalgiaStudioModules PUBLIC
|
||||
StudioAppLib
|
||||
NostalgiaCore-Studio
|
||||
NostalgiaCore-Studio-ImGui
|
||||
NostalgiaScene-Studio
|
||||
)
|
||||
if(NOT MSVC)
|
||||
|
@ -13,6 +13,7 @@ endif()
|
||||
|
||||
if(NOT MSVC)
|
||||
target_compile_options(NostalgiaCore PUBLIC -Wsign-conversion)
|
||||
target_compile_options(NostalgiaCore PRIVATE -Wconversion)
|
||||
endif()
|
||||
|
||||
target_link_libraries(
|
||||
|
@ -46,7 +46,7 @@ constexpr uint8_t blue16(Color16 c) noexcept {
|
||||
|
||||
[[nodiscard]]
|
||||
constexpr uint8_t alpha16(Color16 c) noexcept {
|
||||
return c >> 15;
|
||||
return static_cast<uint8_t>(c >> 15);
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
@ -66,7 +66,7 @@ constexpr uint8_t blue32(Color16 c) noexcept {
|
||||
|
||||
[[nodiscard]]
|
||||
constexpr uint8_t alpha32(Color16 c) noexcept {
|
||||
return (c >> 15) * 255;
|
||||
return static_cast<uint8_t>((c >> 15) * 255);
|
||||
}
|
||||
|
||||
|
||||
@ -128,9 +128,20 @@ constexpr float bluef(Color32 c) noexcept {
|
||||
}
|
||||
|
||||
|
||||
[[nodiscard]]
|
||||
constexpr Color16 color16(int r, int g, int b, int a = 0) noexcept {
|
||||
return static_cast<Color16>(ox::min<uint8_t>(static_cast<uint8_t>(r), 31))
|
||||
| static_cast<Color16>(ox::min<uint8_t>(static_cast<uint8_t>(g), 31) << 5)
|
||||
| static_cast<Color16>(ox::min<uint8_t>(static_cast<uint8_t>(b), 31) << 10)
|
||||
| static_cast<Color16>(a << 15);
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
constexpr Color16 color16(uint8_t r, uint8_t g, uint8_t b, uint8_t a = 0) noexcept {
|
||||
return ox::min<uint8_t>(r, 31) | (ox::min<uint8_t>(g, 31) << 5) | (ox::min<uint8_t>(b, 31) << 10) | (a << 15);
|
||||
return static_cast<Color16>(ox::min<uint8_t>(r, 31))
|
||||
| static_cast<Color16>(ox::min<uint8_t>(g, 31) << 5)
|
||||
| static_cast<Color16>(ox::min<uint8_t>(b, 31) << 10)
|
||||
| static_cast<Color16>(a << 15);
|
||||
}
|
||||
|
||||
static_assert(color16(0, 31, 0) == 992);
|
||||
|
@ -138,12 +138,12 @@ ox::Error loadBgTileSheet(Context *ctx,
|
||||
target.pal.palette = MEM_BG_PALETTE;
|
||||
target.cbbData = &g_cbbData[cbb];
|
||||
target.tileMap = MEM_BG_TILES[cbb].data();
|
||||
oxReturnError(ox::readMC(ts, tsStat.size, &target));
|
||||
oxReturnError(ox::readMC(ts, static_cast<std::size_t>(tsStat.size), &target));
|
||||
// load external palette if available
|
||||
if (paletteAddr) {
|
||||
oxRequire(palStat, gctx.rom().stat(paletteAddr));
|
||||
oxRequire(pal, static_cast<const ox::MemFS&>(gctx.rom()).directAccess(paletteAddr));
|
||||
oxReturnError(ox::readMC(pal, palStat.size, &target.pal));
|
||||
oxReturnError(ox::readMC(pal, static_cast<std::size_t>(palStat.size), &target.pal));
|
||||
}
|
||||
// update bpp of all bgs with the updated cbb
|
||||
const auto bpp = g_cbbData[cbb].bpp;
|
||||
@ -164,12 +164,12 @@ ox::Error loadSpriteTileSheet(Context *ctx,
|
||||
GbaTileMapTarget target;
|
||||
target.pal.palette = MEM_SPRITE_PALETTE;
|
||||
target.tileMap = MEM_SPRITE_TILES;
|
||||
oxReturnError(ox::readMC(ts, tsStat.size, &target));
|
||||
oxReturnError(ox::readMC(ts, static_cast<std::size_t>(tsStat.size), &target));
|
||||
// load external palette if available
|
||||
if (paletteAddr) {
|
||||
oxRequire(palStat, gctx.rom().stat(paletteAddr));
|
||||
oxRequire(pal, static_cast<const ox::MemFS&>(gctx.rom()).directAccess(paletteAddr));
|
||||
oxReturnError(ox::readMC(pal, palStat.size, &target.pal));
|
||||
oxReturnError(ox::readMC(pal, static_cast<std::size_t>(palStat.size), &target.pal));
|
||||
}
|
||||
return {};
|
||||
}
|
||||
@ -180,7 +180,7 @@ ox::Error loadBgPalette(Context *ctx, unsigned, const ox::FileAddress &paletteAd
|
||||
target.palette = MEM_BG_PALETTE;
|
||||
oxRequire(palStat, gctx.rom().stat(paletteAddr));
|
||||
oxRequire(pal, static_cast<const ox::MemFS&>(gctx.rom()).directAccess(paletteAddr));
|
||||
oxReturnError(ox::readMC(pal, palStat.size, &target));
|
||||
oxReturnError(ox::readMC(pal, static_cast<std::size_t>(palStat.size), &target));
|
||||
return {};
|
||||
}
|
||||
|
||||
@ -190,7 +190,7 @@ ox::Error loadSpritePalette(Context *ctx, unsigned cbb, const ox::FileAddress &p
|
||||
target.palette = &MEM_SPRITE_PALETTE[cbb];
|
||||
oxRequire(palStat, gctx.rom().stat(paletteAddr));
|
||||
oxRequire(pal, static_cast<const ox::MemFS&>(gctx.rom()).directAccess(paletteAddr));
|
||||
oxReturnError(ox::readMC(pal, palStat.size, &target));
|
||||
oxReturnError(ox::readMC(pal, static_cast<std::size_t>(palStat.size), &target));
|
||||
return {};
|
||||
}
|
||||
|
||||
@ -217,7 +217,7 @@ void hideSprite(Context*, unsigned idx) noexcept {
|
||||
//oxAssert(g_spriteUpdates < config::GbaSpriteBufferLen, "Sprite update buffer overflow");
|
||||
teagba::GbaSpriteAttrUpdate oa;
|
||||
oa.attr0 = 2 << 8;
|
||||
oa.idx = idx;
|
||||
oa.idx = static_cast<uint16_t>(idx);
|
||||
teagba::addSpriteUpdate(oa);
|
||||
}
|
||||
|
||||
@ -231,14 +231,16 @@ void setSprite(Context*,
|
||||
unsigned flipX) noexcept {
|
||||
//oxAssert(g_spriteUpdates < config::GbaSpriteBufferLen, "Sprite update buffer overflow");
|
||||
teagba::GbaSpriteAttrUpdate oa;
|
||||
oa.attr0 = static_cast<uint16_t>(y & ox::onMask<uint8_t>(0b111'1111))
|
||||
oa.attr0 = static_cast<uint16_t>(
|
||||
static_cast<uint16_t>(y & ox::onMask<uint8_t>(0b111'1111))
|
||||
| (static_cast<uint16_t>(1) << 10) // enable alpha
|
||||
| (static_cast<uint16_t>(spriteShape) << 14);
|
||||
oa.attr1 = (static_cast<uint16_t>(x) & ox::onMask<uint8_t>(8))
|
||||
| (static_cast<uint16_t>(spriteShape) << 14));
|
||||
oa.attr1 = static_cast<uint16_t>(
|
||||
(static_cast<uint16_t>(x) & ox::onMask<uint8_t>(8))
|
||||
| (static_cast<uint16_t>(flipX) << 12)
|
||||
| (static_cast<uint16_t>(spriteSize) << 14);
|
||||
| (static_cast<uint16_t>(spriteSize) << 14));
|
||||
oa.attr2 = static_cast<uint16_t>(tileIdx & ox::onMask<uint16_t>(8));
|
||||
oa.idx = idx;
|
||||
oa.idx = static_cast<uint16_t>(idx);
|
||||
teagba::addSpriteUpdate(oa);
|
||||
}
|
||||
|
||||
|
@ -1,23 +1,34 @@
|
||||
add_library(
|
||||
NostalgiaCore-Studio OBJECT
|
||||
studiomodule.cpp
|
||||
NostalgiaCore-Studio
|
||||
paletteeditor.cpp
|
||||
paletteeditor-imgui.cpp
|
||||
tilesheeteditor-imgui.cpp
|
||||
tilesheeteditorview.cpp
|
||||
tilesheeteditormodel.cpp
|
||||
tilesheetpixelgrid.cpp
|
||||
tilesheetpixels.cpp
|
||||
)
|
||||
|
||||
add_library(
|
||||
NostalgiaCore-Studio-ImGui OBJECT
|
||||
studiomodule.cpp
|
||||
paletteeditor-imgui.cpp
|
||||
tilesheeteditor-imgui.cpp
|
||||
)
|
||||
|
||||
if(NOT MSVC)
|
||||
target_compile_options(NostalgiaCore-Studio PRIVATE -Wsign-conversion)
|
||||
target_compile_options(NostalgiaCore-Studio-ImGui PRIVATE -Wsign-conversion)
|
||||
endif()
|
||||
|
||||
target_link_libraries(
|
||||
NostalgiaCore-Studio PUBLIC
|
||||
Studio
|
||||
NostalgiaCore
|
||||
Studio
|
||||
)
|
||||
|
||||
target_link_libraries(
|
||||
NostalgiaCore-Studio-ImGui PUBLIC
|
||||
NostalgiaCore-Studio
|
||||
Studio
|
||||
lodepng
|
||||
)
|
||||
|
||||
@ -25,6 +36,7 @@ target_link_libraries(
|
||||
|
||||
install(
|
||||
TARGETS
|
||||
NostalgiaCore-Studio-ImGui
|
||||
NostalgiaCore-Studio
|
||||
LIBRARY DESTINATION
|
||||
${NOSTALGIA_DIST_MODULE}
|
||||
|
@ -53,7 +53,8 @@ void PaletteEditorImGui::draw(turbine::Context*) noexcept {
|
||||
const auto sz = ImVec2(70, 24);
|
||||
if (ImGui::Button("Add", sz)) {
|
||||
const auto colorSz = static_cast<int>(m_pal.colors.size());
|
||||
undoStack()->push(ox::make<AddColorCommand>(&m_pal, 0, colorSz));
|
||||
constexpr Color16 c = 0;
|
||||
undoStack()->push(ox::make<AddColorCommand>(&m_pal, c, colorSz));
|
||||
}
|
||||
ImGui::SameLine();
|
||||
ImGui::BeginDisabled(m_selectedRow >= m_pal.colors.size());
|
||||
|
@ -35,7 +35,7 @@ ox::Error toPngFile(const ox::String &path, const TileSheet::SubSheet &s, const
|
||||
++idx;
|
||||
}
|
||||
constexpr auto fmt = alpha ? LCT_RGBA : LCT_RGB;
|
||||
return OxError(lodepng_encode_file(path.c_str(), outData.data(), width, height, fmt, 8));
|
||||
return OxError(static_cast<ox::ErrorCode>(lodepng_encode_file(path.c_str(), outData.data(), width, height, fmt, 8)));
|
||||
}
|
||||
|
||||
TileSheetEditorImGui::TileSheetEditorImGui(turbine::Context *ctx, ox::CRStringView path): m_tileSheetEditor(ctx, path) {
|
||||
@ -361,8 +361,8 @@ void TileSheetEditorImGui::drawPaletteSelector() noexcept {
|
||||
}
|
||||
// header
|
||||
if (ImGui::BeginTable("PaletteTable", 3, ImGuiTableFlags_RowBg | ImGuiTableFlags_SizingStretchProp)) {
|
||||
ImGui::TableSetupColumn("No.", 0, 0.45);
|
||||
ImGui::TableSetupColumn("", 0, 0.22);
|
||||
ImGui::TableSetupColumn("No.", 0, 0.45f);
|
||||
ImGui::TableSetupColumn("", 0, 0.22f);
|
||||
ImGui::TableSetupColumn("Color16", 0, 3);
|
||||
ImGui::TableHeadersRow();
|
||||
if (auto pal = m_tileSheetEditor.pal()) {
|
||||
|
@ -130,7 +130,7 @@ class DrawCommand: public TileSheetCommand {
|
||||
});
|
||||
if (existing == m_changes.cend()) {
|
||||
m_changes.emplace_back(static_cast<uint32_t>(idx), subsheet.getPixel(m_img->bpp, idx));
|
||||
subsheet.setPixel(m_img->bpp, idx, m_palIdx);
|
||||
subsheet.setPixel(m_img->bpp, idx, static_cast<uint8_t>(m_palIdx));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@ -148,14 +148,14 @@ class DrawCommand: public TileSheetCommand {
|
||||
void redo() noexcept final {
|
||||
auto &subsheet = m_img->getSubSheet(m_subSheetIdx);
|
||||
for (const auto &c : m_changes) {
|
||||
subsheet.setPixel(m_img->bpp, c.idx, m_palIdx);
|
||||
subsheet.setPixel(m_img->bpp, c.idx, static_cast<uint8_t>(m_palIdx));
|
||||
}
|
||||
}
|
||||
|
||||
void undo() noexcept final {
|
||||
auto &subsheet = m_img->getSubSheet(m_subSheetIdx);
|
||||
for (const auto &c : m_changes) {
|
||||
subsheet.setPixel(m_img->bpp, c.idx, c.oldPalIdx);
|
||||
subsheet.setPixel(m_img->bpp, c.idx, static_cast<uint8_t>(c.oldPalIdx));
|
||||
}
|
||||
}
|
||||
|
||||
@ -205,14 +205,14 @@ class CutPasteCommand: public TileSheetCommand {
|
||||
void redo() noexcept final {
|
||||
auto &subsheet = m_img->getSubSheet(m_subSheetIdx);
|
||||
for (const auto &c : m_changes) {
|
||||
subsheet.setPixel(m_img->bpp, c.idx, c.newPalIdx);
|
||||
subsheet.setPixel(m_img->bpp, c.idx, static_cast<uint8_t>(c.newPalIdx));
|
||||
}
|
||||
}
|
||||
|
||||
void undo() noexcept final {
|
||||
auto &subsheet = m_img->getSubSheet(m_subSheetIdx);
|
||||
for (const auto &c : m_changes) {
|
||||
subsheet.setPixel(m_img->bpp, c.idx, c.oldPalIdx);
|
||||
subsheet.setPixel(m_img->bpp, c.idx, static_cast<uint8_t>(c.oldPalIdx));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -138,8 +138,8 @@ struct TileSheet {
|
||||
} else {
|
||||
if (pBpp == 4) {
|
||||
for (auto p: this->pixels) {
|
||||
pPixels->emplace_back(p & 0b1111);
|
||||
pPixels->emplace_back(p >> 4);
|
||||
pPixels->emplace_back(static_cast<uint8_t>(p & 0b1111));
|
||||
pPixels->emplace_back(static_cast<uint8_t>(p >> 4));
|
||||
}
|
||||
} else {
|
||||
for (auto p: this->pixels) {
|
||||
@ -226,14 +226,15 @@ struct TileSheet {
|
||||
pixels.size());
|
||||
//oxAssert(pixels.size() == pixelCnt, "Pixel count does not match rows and columns");
|
||||
for (std::size_t i = 0; i < pixelCnt; ++i) {
|
||||
const auto colorIdx1 = pixels[i] & 0xF;
|
||||
const auto colorIdx2 = pixels[i] >> 4;
|
||||
const auto colorIdx1 = static_cast<uint8_t>(pixels[i] & 0xF);
|
||||
const auto colorIdx2 = static_cast<uint8_t>(pixels[i] >> 4);
|
||||
callback(i * 2 + 0, colorIdx1);
|
||||
callback(i * 2 + 1, colorIdx2);
|
||||
}
|
||||
} else {
|
||||
const auto pixelCnt = ox::min<std::size_t>(static_cast<std::size_t>(columns * rows * PixelsPerTile),
|
||||
pixels.size());
|
||||
const auto pixelCnt = ox::min<std::size_t>(
|
||||
static_cast<std::size_t>(columns * rows * PixelsPerTile),
|
||||
pixels.size());
|
||||
for (std::size_t i = 0; i < pixelCnt; ++i) {
|
||||
const auto p = pixels[i];
|
||||
callback(i, p);
|
||||
@ -242,10 +243,10 @@ struct TileSheet {
|
||||
}
|
||||
|
||||
constexpr void setPixel(int8_t pBpp, uint64_t idx, uint8_t palIdx) noexcept {
|
||||
auto &pixel = this->pixels[idx / 2];
|
||||
auto &pixel = this->pixels[static_cast<std::size_t>(idx / 2)];
|
||||
if (pBpp == 4) {
|
||||
if (idx & 1) {
|
||||
pixel = (pixel & 0b0000'1111) | (palIdx << 4);
|
||||
pixel = static_cast<uint8_t>((pixel & 0b0000'1111) | (palIdx << 4));
|
||||
} else {
|
||||
pixel = (pixel & 0b1111'0000) | (palIdx);
|
||||
}
|
||||
|
@ -28,10 +28,11 @@ ox::Error Scene::setupDisplay(core::Context *ctx) noexcept {
|
||||
auto y = 0;
|
||||
auto width = m_sceneStatic.rows[layerNo];
|
||||
for (const auto &tile : layer) {
|
||||
core::setTile(ctx, layerNo, x, y, tile);
|
||||
core::setTile(ctx, layerNo, x + 1, y, tile + 1);
|
||||
core::setTile(ctx, layerNo, x, y + 1, tile + 2);
|
||||
core::setTile(ctx, layerNo, x + 1, y + 1, tile + 3);
|
||||
auto tile8 = static_cast<uint8_t >(tile);
|
||||
core::setTile(ctx, layerNo, x, y, tile8);
|
||||
core::setTile(ctx, layerNo, x + 1, y, tile8 + 1);
|
||||
core::setTile(ctx, layerNo, x, y + 1, tile8 + 2);
|
||||
core::setTile(ctx, layerNo, x + 1, y + 1, tile8 + 3);
|
||||
x += 2;
|
||||
if (x >= width * 2) {
|
||||
x = 0;
|
||||
|
@ -102,16 +102,20 @@ oxModelEnd()
|
||||
|
||||
|
||||
constexpr void setTopEdge(uint8_t &layerAttachments, unsigned val) noexcept {
|
||||
layerAttachments = (layerAttachments & 0b11111100) | val;
|
||||
const auto val8 = static_cast<uint8_t>(val);
|
||||
layerAttachments = (layerAttachments & 0b11111100) | val8;
|
||||
}
|
||||
constexpr void setBottomEdge(uint8_t &layerAttachments, unsigned val) noexcept {
|
||||
layerAttachments = (layerAttachments & 0b11110011) | (val << 2);
|
||||
const auto val8 = static_cast<uint8_t>(val);
|
||||
layerAttachments = (layerAttachments & 0b11110011) | static_cast<uint8_t>(val8 << 2);
|
||||
}
|
||||
constexpr void setLeftEdge(uint8_t &layerAttachments, unsigned val) noexcept {
|
||||
layerAttachments = (layerAttachments & 0b11001111) | (val << 4);
|
||||
const auto val8 = static_cast<uint8_t>(val);
|
||||
layerAttachments = (layerAttachments & 0b11001111) | static_cast<uint8_t>(val8 << 4);
|
||||
}
|
||||
constexpr void setRightEdge(uint8_t &layerAttachments, unsigned val) noexcept {
|
||||
layerAttachments = (layerAttachments & 0b00111111) | (val << 6);
|
||||
const auto val8 = static_cast<uint8_t>(val);
|
||||
layerAttachments = (layerAttachments & 0b00111111) | static_cast<uint8_t>(val8 << 6);
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
@ -171,8 +175,8 @@ struct SceneStatic {
|
||||
return {tileMapIdx[i], tileType[i], layerAttachments[i]};
|
||||
}
|
||||
constexpr auto setDimensions(ox::Size dim) noexcept {
|
||||
columns = dim.width;
|
||||
rows = dim.height;
|
||||
columns = static_cast<uint16_t>(dim.width);
|
||||
rows = static_cast<uint16_t>(dim.height);
|
||||
const auto tileCnt = static_cast<unsigned>(columns * rows);
|
||||
tileMapIdx.resize(tileCnt);
|
||||
tileType.resize(tileCnt);
|
||||
|
@ -62,7 +62,6 @@ void NewMenu::drawNewItemType(turbine::Context *ctx) noexcept {
|
||||
}
|
||||
ImGui::ListBox("Item Type", &m_selectedType, items.get(), static_cast<int>(m_types.size()));
|
||||
drawFirstPageButtons();
|
||||
ImGui::EndPopup();
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -4,14 +4,14 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <functional>
|
||||
|
||||
#include <ox/event/signal.hpp>
|
||||
#include <ox/std/string.hpp>
|
||||
#include <ox/std/vec.hpp>
|
||||
|
||||
#include <turbine/context.hpp>
|
||||
|
||||
#include "imguiuitl.hpp"
|
||||
|
||||
namespace studio {
|
||||
|
||||
|
||||
@ -47,14 +47,7 @@ class Popup {
|
||||
return m_title;
|
||||
}
|
||||
|
||||
void drawWindow(turbine::Context *ctx, bool *open, auto drawContents) {
|
||||
studio::ig::centerNextWindow(ctx);
|
||||
ImGui::SetNextWindowSize(static_cast<ImVec2>(m_size));
|
||||
constexpr auto modalFlags = ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoResize;
|
||||
if (ImGui::BeginPopupModal(m_title.c_str(), open, modalFlags)) {
|
||||
drawContents();
|
||||
}
|
||||
}
|
||||
void drawWindow(turbine::Context *ctx, bool *open, const std::function<void()> &drawContents);
|
||||
|
||||
};
|
||||
|
||||
|
@ -2,6 +2,18 @@
|
||||
* Copyright 2016 - 2023 Gary Talent (gary@drinkingtea.net). All rights reserved.
|
||||
*/
|
||||
|
||||
#include <studio/imguiuitl.hpp>
|
||||
#include <studio/popup.hpp>
|
||||
|
||||
namespace studio {
|
||||
|
||||
void Popup::drawWindow(turbine::Context *ctx, bool *open, const std::function<void()> &drawContents) {
|
||||
studio::ig::centerNextWindow(ctx);
|
||||
ImGui::SetNextWindowSize(static_cast<ImVec2>(m_size));
|
||||
constexpr auto modalFlags = ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoResize;
|
||||
if (ImGui::BeginPopupModal(m_title.c_str(), open, modalFlags)) {
|
||||
drawContents();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -35,7 +35,7 @@ Project::Project(keel::Context *ctx, ox::String path, ox::CRStringView projectDa
|
||||
ox::Error Project::create() noexcept {
|
||||
std::error_code ec;
|
||||
std::filesystem::create_directory(m_path.toStdString(), ec);
|
||||
return OxError(ec.value(), "PassThroughFS: mkdir failed");
|
||||
return OxError(static_cast<ox::ErrorCode>(ec.value()), "PassThroughFS: mkdir failed");
|
||||
}
|
||||
|
||||
ox::FileSystem *Project::romFs() noexcept {
|
||||
|
@ -16,9 +16,10 @@ extern "C" void turbine_isr();
|
||||
namespace turbine {
|
||||
|
||||
// Timer Consts
|
||||
constexpr int NanoSecond = 1000000000;
|
||||
constexpr int NanoSecond = 1'000'000'000;
|
||||
constexpr int MilliSecond = 1000;
|
||||
constexpr int TicksMs59ns = 65535 - (NanoSecond / MilliSecond) / 59.59;
|
||||
constexpr int TicksMs59ns =
|
||||
65535 - static_cast<uint16_t>(static_cast<double>(NanoSecond / MilliSecond) / 59.59);
|
||||
|
||||
extern volatile gba_timer_t g_timerMs;
|
||||
|
||||
|
@ -141,60 +141,67 @@ static void themeImgui() noexcept {
|
||||
style.ButtonTextAlign = ImVec2(0.5, 0.5);
|
||||
style.SelectableTextAlign = ImVec2(0.0, 0.0);
|
||||
// colors
|
||||
style.Colors[ImGuiCol_Text] = ImVec4(0.9490196108818054, 0.95686274766922, 0.9764705896377563, 1.0);
|
||||
style.Colors[ImGuiCol_TextDisabled] = ImVec4(0.3568627536296844, 0.4196078479290009, 0.4666666686534882, 1.0);
|
||||
style.Colors[ImGuiCol_WindowBg] = ImVec4(0.1098039224743843, 0.1490196138620377, 0.168627455830574, 1.0);
|
||||
style.Colors[ImGuiCol_ChildBg] = ImVec4(0.1490196138620377, 0.1764705926179886, 0.2196078449487686, 1.0);
|
||||
style.Colors[ImGuiCol_PopupBg] = ImVec4(0.0784313753247261, 0.0784313753247261, 0.0784313753247261, 0.9399999976158142);
|
||||
style.Colors[ImGuiCol_Border] = ImVec4(0.0784313753247261, 0.09803921729326248, 0.1176470592617989, 1.0);
|
||||
style.Colors[ImGuiCol_BorderShadow] = ImVec4(0.0, 0.0, 0.0, 0.0);
|
||||
style.Colors[ImGuiCol_FrameBg] = ImVec4(0.2000000029802322, 0.2470588237047195, 0.2862745225429535, 1.0);
|
||||
style.Colors[ImGuiCol_FrameBgHovered] = ImVec4(0.1176470592617989, 0.2000000029802322, 0.2784313857555389, 1.0);
|
||||
style.Colors[ImGuiCol_FrameBgActive] = ImVec4(0.08627451211214066, 0.1176470592617989, 0.1372549086809158, 1.0);
|
||||
style.Colors[ImGuiCol_TitleBg] = ImVec4(0.08627451211214066, 0.1176470592617989, 0.1372549086809158, 0.6499999761581421);
|
||||
style.Colors[ImGuiCol_TitleBgActive] = ImVec4(0.0784313753247261, 0.09803921729326248, 0.1176470592617989, 1.0);
|
||||
style.Colors[ImGuiCol_TitleBgCollapsed] = ImVec4(0.0, 0.0, 0.0, 0.5099999904632568);
|
||||
style.Colors[ImGuiCol_MenuBarBg] = ImVec4(0.1490196138620377, 0.1764705926179886, 0.2196078449487686, 1.0);
|
||||
style.Colors[ImGuiCol_ScrollbarBg] = ImVec4(0.01960784383118153, 0.01960784383118153, 0.01960784383118153, 0.3899999856948853);
|
||||
style.Colors[ImGuiCol_ScrollbarGrab] = ImVec4(0.2000000029802322, 0.2470588237047195, 0.2862745225429535, 1.0);
|
||||
style.Colors[ImGuiCol_ScrollbarGrabHovered] = ImVec4(0.1764705926179886, 0.2196078449487686, 0.2470588237047195, 1.0);
|
||||
style.Colors[ImGuiCol_ScrollbarGrabActive] = ImVec4(0.08627451211214066, 0.2078431397676468, 0.3098039329051971, 1.0);
|
||||
style.Colors[ImGuiCol_CheckMark] = ImVec4(0.2784313857555389, 0.5568627715110779, 1.0, 1.0);
|
||||
style.Colors[ImGuiCol_SliderGrab] = ImVec4(0.2784313857555389, 0.5568627715110779, 1.0, 1.0);
|
||||
style.Colors[ImGuiCol_SliderGrabActive] = ImVec4(0.3686274588108063, 0.6078431606292725, 1.0, 1.0);
|
||||
style.Colors[ImGuiCol_Button] = ImVec4(0.2000000029802322, 0.2470588237047195, 0.2862745225429535, 1.0);
|
||||
style.Colors[ImGuiCol_ButtonHovered] = ImVec4(0.2784313857555389, 0.5568627715110779, 1.0, 1.0);
|
||||
style.Colors[ImGuiCol_ButtonActive] = ImVec4(0.05882352963089943, 0.529411792755127, 0.9764705896377563, 1.0);
|
||||
constexpr auto imVec4 = [](double r, double g, double b, double a) {
|
||||
return ImVec4(
|
||||
static_cast<float>(r),
|
||||
static_cast<float>(g),
|
||||
static_cast<float>(b),
|
||||
static_cast<float>(a));
|
||||
};
|
||||
style.Colors[ImGuiCol_Text] = imVec4(0.9490196108818054, 0.95686274766922, 0.9764705896377563, 1.0);
|
||||
style.Colors[ImGuiCol_TextDisabled] = imVec4(0.3568627536296844, 0.4196078479290009, 0.4666666686534882, 1.0);
|
||||
style.Colors[ImGuiCol_WindowBg] = imVec4(0.1098039224743843, 0.1490196138620377, 0.168627455830574, 1.0);
|
||||
style.Colors[ImGuiCol_ChildBg] = imVec4(0.1490196138620377, 0.1764705926179886, 0.2196078449487686, 1.0);
|
||||
style.Colors[ImGuiCol_PopupBg] = imVec4(0.0784313753247261, 0.0784313753247261, 0.0784313753247261, 0.9399999976158142);
|
||||
style.Colors[ImGuiCol_Border] = imVec4(0.0784313753247261, 0.09803921729326248, 0.1176470592617989, 1.0);
|
||||
style.Colors[ImGuiCol_BorderShadow] = imVec4(0.0, 0.0, 0.0, 0.0);
|
||||
style.Colors[ImGuiCol_FrameBg] = imVec4(0.2000000029802322, 0.2470588237047195, 0.2862745225429535, 1.0);
|
||||
style.Colors[ImGuiCol_FrameBgHovered] = imVec4(0.1176470592617989, 0.2000000029802322, 0.2784313857555389, 1.0);
|
||||
style.Colors[ImGuiCol_FrameBgActive] = imVec4(0.08627451211214066, 0.1176470592617989, 0.1372549086809158, 1.0);
|
||||
style.Colors[ImGuiCol_TitleBg] = imVec4(0.08627451211214066, 0.1176470592617989, 0.1372549086809158, 0.6499999761581421);
|
||||
style.Colors[ImGuiCol_TitleBgActive] = imVec4(0.0784313753247261, 0.09803921729326248, 0.1176470592617989, 1.0);
|
||||
style.Colors[ImGuiCol_TitleBgCollapsed] = imVec4(0.0, 0.0, 0.0, 0.5099999904632568);
|
||||
style.Colors[ImGuiCol_MenuBarBg] = imVec4(0.1490196138620377, 0.1764705926179886, 0.2196078449487686, 1.0);
|
||||
style.Colors[ImGuiCol_ScrollbarBg] = imVec4(0.01960784383118153, 0.01960784383118153, 0.01960784383118153, 0.3899999856948853);
|
||||
style.Colors[ImGuiCol_ScrollbarGrab] = imVec4(0.2000000029802322, 0.2470588237047195, 0.2862745225429535, 1.0);
|
||||
style.Colors[ImGuiCol_ScrollbarGrabHovered] = imVec4(0.1764705926179886, 0.2196078449487686, 0.2470588237047195, 1.0);
|
||||
style.Colors[ImGuiCol_ScrollbarGrabActive] = imVec4(0.08627451211214066, 0.2078431397676468, 0.3098039329051971, 1.0);
|
||||
style.Colors[ImGuiCol_CheckMark] = imVec4(0.2784313857555389, 0.5568627715110779, 1.0, 1.0);
|
||||
style.Colors[ImGuiCol_SliderGrab] = imVec4(0.2784313857555389, 0.5568627715110779, 1.0, 1.0);
|
||||
style.Colors[ImGuiCol_SliderGrabActive] = imVec4(0.3686274588108063, 0.6078431606292725, 1.0, 1.0);
|
||||
style.Colors[ImGuiCol_Button] = imVec4(0.2000000029802322, 0.2470588237047195, 0.2862745225429535, 1.0);
|
||||
style.Colors[ImGuiCol_ButtonHovered] = imVec4(0.2784313857555389, 0.5568627715110779, 1.0, 1.0);
|
||||
style.Colors[ImGuiCol_ButtonActive] = imVec4(0.05882352963089943, 0.529411792755127, 0.9764705896377563, 1.0);
|
||||
// custom value
|
||||
style.Colors[ImGuiCol_Header] = ImVec4(0.4000000029802322, 0.4470588237047195, 0.4862745225429535, 0.550000011920929);
|
||||
style.Colors[ImGuiCol_HeaderHovered] = ImVec4(0.2588235437870026, 0.5882353186607361, 0.9764705896377563, 0.800000011920929);
|
||||
style.Colors[ImGuiCol_HeaderActive] = ImVec4(0.2588235437870026, 0.5882353186607361, 0.9764705896377563, 1.0);
|
||||
style.Colors[ImGuiCol_Separator] = ImVec4(0.2000000029802322, 0.2470588237047195, 0.2862745225429535, 1.0);
|
||||
style.Colors[ImGuiCol_SeparatorHovered] = ImVec4(0.09803921729326248, 0.4000000059604645, 0.7490196228027344, 0.7799999713897705);
|
||||
style.Colors[ImGuiCol_SeparatorActive] = ImVec4(0.09803921729326248, 0.4000000059604645, 0.7490196228027344, 1.0);
|
||||
style.Colors[ImGuiCol_ResizeGrip] = ImVec4(0.2588235437870026, 0.5882353186607361, 0.9764705896377563, 0.25);
|
||||
style.Colors[ImGuiCol_ResizeGripHovered] = ImVec4(0.2588235437870026, 0.5882353186607361, 0.9764705896377563, 0.6700000166893005);
|
||||
style.Colors[ImGuiCol_ResizeGripActive] = ImVec4(0.2588235437870026, 0.5882353186607361, 0.9764705896377563, 0.949999988079071);
|
||||
style.Colors[ImGuiCol_Tab] = ImVec4(0.1098039224743843, 0.1490196138620377, 0.168627455830574, 1.0);
|
||||
style.Colors[ImGuiCol_TabHovered] = ImVec4(0.2588235437870026, 0.5882353186607361, 0.9764705896377563, 0.800000011920929);
|
||||
style.Colors[ImGuiCol_TabActive] = ImVec4(0.2000000029802322, 0.2470588237047195, 0.2862745225429535, 1.0);
|
||||
style.Colors[ImGuiCol_TabUnfocused] = ImVec4(0.1098039224743843, 0.1490196138620377, 0.168627455830574, 1.0);
|
||||
style.Colors[ImGuiCol_TabUnfocusedActive] = ImVec4(0.1098039224743843, 0.1490196138620377, 0.168627455830574, 1.0);
|
||||
style.Colors[ImGuiCol_PlotLines] = ImVec4(0.6078431606292725, 0.6078431606292725, 0.6078431606292725, 1.0);
|
||||
style.Colors[ImGuiCol_PlotLinesHovered] = ImVec4(1.0, 0.4274509847164154, 0.3490196168422699, 1.0);
|
||||
style.Colors[ImGuiCol_PlotHistogram] = ImVec4(0.8980392217636108, 0.6980392336845398, 0.0, 1.0);
|
||||
style.Colors[ImGuiCol_PlotHistogramHovered] = ImVec4(1.0, 0.6000000238418579, 0.0, 1.0);
|
||||
style.Colors[ImGuiCol_TableHeaderBg] = ImVec4(0.1882352977991104, 0.1882352977991104, 0.2000000029802322, 1.0);
|
||||
style.Colors[ImGuiCol_TableBorderStrong] = ImVec4(0.3098039329051971, 0.3098039329051971, 0.3490196168422699, 1.0);
|
||||
style.Colors[ImGuiCol_TableBorderLight] = ImVec4(0.2274509817361832, 0.2274509817361832, 0.2470588237047195, 1.0);
|
||||
style.Colors[ImGuiCol_TableRowBg] = ImVec4(0.0, 0.0, 0.0, 0.0);
|
||||
style.Colors[ImGuiCol_TableRowBgAlt] = ImVec4(1.0, 1.0, 1.0, 0.05999999865889549);
|
||||
style.Colors[ImGuiCol_TextSelectedBg] = ImVec4(0.2588235437870026, 0.5882353186607361, 0.9764705896377563, 0.3499999940395355);
|
||||
style.Colors[ImGuiCol_DragDropTarget] = ImVec4(1.0, 1.0, 0.0, 0.8999999761581421);
|
||||
style.Colors[ImGuiCol_NavHighlight] = ImVec4(0.2588235437870026, 0.5882353186607361, 0.9764705896377563, 1.0);
|
||||
style.Colors[ImGuiCol_NavWindowingHighlight] = ImVec4(1.0, 1.0, 1.0, 0.699999988079071);
|
||||
style.Colors[ImGuiCol_NavWindowingDimBg] = ImVec4(0.800000011920929, 0.800000011920929, 0.800000011920929, 0.2000000029802322);
|
||||
style.Colors[ImGuiCol_ModalWindowDimBg] = ImVec4(0.800000011920929, 0.800000011920929, 0.800000011920929, 0.3499999940395355);
|
||||
style.Colors[ImGuiCol_Header] = imVec4(0.4000000029802322, 0.4470588237047195, 0.4862745225429535, 0.550000011920929);
|
||||
style.Colors[ImGuiCol_HeaderHovered] = imVec4(0.2588235437870026, 0.5882353186607361, 0.9764705896377563, 0.800000011920929);
|
||||
style.Colors[ImGuiCol_HeaderActive] = imVec4(0.2588235437870026, 0.5882353186607361, 0.9764705896377563, 1.0);
|
||||
style.Colors[ImGuiCol_Separator] = imVec4(0.2000000029802322, 0.2470588237047195, 0.2862745225429535, 1.0);
|
||||
style.Colors[ImGuiCol_SeparatorHovered] = imVec4(0.09803921729326248, 0.4000000059604645, 0.7490196228027344, 0.7799999713897705);
|
||||
style.Colors[ImGuiCol_SeparatorActive] = imVec4(0.09803921729326248, 0.4000000059604645, 0.7490196228027344, 1.0);
|
||||
style.Colors[ImGuiCol_ResizeGrip] = imVec4(0.2588235437870026, 0.5882353186607361, 0.9764705896377563, 0.25);
|
||||
style.Colors[ImGuiCol_ResizeGripHovered] = imVec4(0.2588235437870026, 0.5882353186607361, 0.9764705896377563, 0.6700000166893005);
|
||||
style.Colors[ImGuiCol_ResizeGripActive] = imVec4(0.2588235437870026, 0.5882353186607361, 0.9764705896377563, 0.949999988079071);
|
||||
style.Colors[ImGuiCol_Tab] = imVec4(0.1098039224743843, 0.1490196138620377, 0.168627455830574, 1.0);
|
||||
style.Colors[ImGuiCol_TabHovered] = imVec4(0.2588235437870026, 0.5882353186607361, 0.9764705896377563, 0.800000011920929);
|
||||
style.Colors[ImGuiCol_TabActive] = imVec4(0.2000000029802322, 0.2470588237047195, 0.2862745225429535, 1.0);
|
||||
style.Colors[ImGuiCol_TabUnfocused] = imVec4(0.1098039224743843, 0.1490196138620377, 0.168627455830574, 1.0);
|
||||
style.Colors[ImGuiCol_TabUnfocusedActive] = imVec4(0.1098039224743843, 0.1490196138620377, 0.168627455830574, 1.0);
|
||||
style.Colors[ImGuiCol_PlotLines] = imVec4(0.6078431606292725, 0.6078431606292725, 0.6078431606292725, 1.0);
|
||||
style.Colors[ImGuiCol_PlotLinesHovered] = imVec4(1.0, 0.4274509847164154, 0.3490196168422699, 1.0);
|
||||
style.Colors[ImGuiCol_PlotHistogram] = imVec4(0.8980392217636108, 0.6980392336845398, 0.0, 1.0);
|
||||
style.Colors[ImGuiCol_PlotHistogramHovered] = imVec4(1.0, 0.6000000238418579, 0.0, 1.0);
|
||||
style.Colors[ImGuiCol_TableHeaderBg] = imVec4(0.1882352977991104, 0.1882352977991104, 0.2000000029802322, 1.0);
|
||||
style.Colors[ImGuiCol_TableBorderStrong] = imVec4(0.3098039329051971, 0.3098039329051971, 0.3490196168422699, 1.0);
|
||||
style.Colors[ImGuiCol_TableBorderLight] = imVec4(0.2274509817361832, 0.2274509817361832, 0.2470588237047195, 1.0);
|
||||
style.Colors[ImGuiCol_TableRowBg] = imVec4(0.0, 0.0, 0.0, 0.0);
|
||||
style.Colors[ImGuiCol_TableRowBgAlt] = imVec4(1.0, 1.0, 1.0, 0.05999999865889549);
|
||||
style.Colors[ImGuiCol_TextSelectedBg] = imVec4(0.2588235437870026, 0.5882353186607361, 0.9764705896377563, 0.3499999940395355);
|
||||
style.Colors[ImGuiCol_DragDropTarget] = imVec4(1.0, 1.0, 0.0, 0.8999999761581421);
|
||||
style.Colors[ImGuiCol_NavHighlight] = imVec4(0.2588235437870026, 0.5882353186607361, 0.9764705896377563, 1.0);
|
||||
style.Colors[ImGuiCol_NavWindowingHighlight] = imVec4(1.0, 1.0, 1.0, 0.699999988079071);
|
||||
style.Colors[ImGuiCol_NavWindowingDimBg] = imVec4(0.800000011920929, 0.800000011920929, 0.800000011920929, 0.2000000029802322);
|
||||
style.Colors[ImGuiCol_ModalWindowDimBg] = imVec4(0.800000011920929, 0.800000011920929, 0.800000011920929, 0.3499999940395355);
|
||||
}
|
||||
|
||||
ox::Error initGfx(Context &ctx) noexcept {
|
||||
|
Loading…
Reference in New Issue
Block a user