Compare commits
3 Commits
5169a607cf
...
95f7c33419
Author | SHA1 | Date | |
---|---|---|---|
95f7c33419 | |||
535d8876d3 | |||
845e433221 |
1
Makefile
1
Makefile
@ -19,6 +19,7 @@ pkg-gba: build
|
|||||||
|
|
||||||
.PHONY: generate-studio-rsrc
|
.PHONY: generate-studio-rsrc
|
||||||
generate-studio-rsrc:
|
generate-studio-rsrc:
|
||||||
|
${BC_CMD_ENVRUN} ${BC_PY3} ./util/scripts/file-to-cpp.py --rsrc src/olympic/studio/applib/src/rsrc.json
|
||||||
${BC_CMD_ENVRUN} ${BC_PY3} ./util/scripts/file-to-cpp.py --rsrc src/nostalgia/studio/rsrc.json
|
${BC_CMD_ENVRUN} ${BC_PY3} ./util/scripts/file-to-cpp.py --rsrc src/nostalgia/studio/rsrc.json
|
||||||
|
|
||||||
.PHONY: build-player
|
.PHONY: build-player
|
||||||
|
@ -32,6 +32,7 @@ class WrapT: public Wrap {
|
|||||||
[[nodiscard]]
|
[[nodiscard]]
|
||||||
virtual constexpr T &obj() noexcept = 0;
|
virtual constexpr T &obj() noexcept = 0;
|
||||||
|
|
||||||
|
[[nodiscard]]
|
||||||
ox::UAnyPtr moveToCopy() noexcept final {
|
ox::UAnyPtr moveToCopy() noexcept final {
|
||||||
return new T{std::move(obj())};
|
return new T{std::move(obj())};
|
||||||
}
|
}
|
||||||
@ -46,14 +47,17 @@ class WrapRef final: public WrapT<T> {
|
|||||||
public:
|
public:
|
||||||
constexpr explicit WrapRef(T &obj): m_obj{obj} {}
|
constexpr explicit WrapRef(T &obj): m_obj{obj} {}
|
||||||
|
|
||||||
|
[[nodiscard]]
|
||||||
ox::CStringView typeName() const noexcept override {
|
ox::CStringView typeName() const noexcept override {
|
||||||
return ox::ModelTypeName_v<T>;
|
return ox::ModelTypeName_v<T>;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[[nodiscard]]
|
||||||
int typeVersion() const noexcept override {
|
int typeVersion() const noexcept override {
|
||||||
return ox::ModelTypeVersion_v<T>;
|
return ox::ModelTypeVersion_v<T>;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[[nodiscard]]
|
||||||
constexpr T &obj() noexcept override {
|
constexpr T &obj() noexcept override {
|
||||||
return m_obj;
|
return m_obj;
|
||||||
}
|
}
|
||||||
@ -72,14 +76,17 @@ class WrapInline final: public WrapT<T> {
|
|||||||
constexpr explicit WrapInline(Args &&...args): m_obj(ox::forward<Args>(args)...) {
|
constexpr explicit WrapInline(Args &&...args): m_obj(ox::forward<Args>(args)...) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[[nodiscard]]
|
||||||
ox::CStringView typeName() const noexcept override {
|
ox::CStringView typeName() const noexcept override {
|
||||||
return ox::ModelTypeName_v<T>;
|
return ox::ModelTypeName_v<T>;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[[nodiscard]]
|
||||||
int typeVersion() const noexcept override {
|
int typeVersion() const noexcept override {
|
||||||
return ox::ModelTypeVersion_v<T>;
|
return ox::ModelTypeVersion_v<T>;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[[nodiscard]]
|
||||||
constexpr T &obj() noexcept override {
|
constexpr T &obj() noexcept override {
|
||||||
return m_obj;
|
return m_obj;
|
||||||
}
|
}
|
||||||
|
@ -5,6 +5,7 @@ add_library(
|
|||||||
clawviewer.cpp
|
clawviewer.cpp
|
||||||
deleteconfirmation.cpp
|
deleteconfirmation.cpp
|
||||||
filedialogmanager.cpp
|
filedialogmanager.cpp
|
||||||
|
font.cpp
|
||||||
makecopypopup.cpp
|
makecopypopup.cpp
|
||||||
newdir.cpp
|
newdir.cpp
|
||||||
newmenu.cpp
|
newmenu.cpp
|
||||||
|
BIN
src/olympic/studio/applib/src/Roboto-Medium.ttf
Normal file
BIN
src/olympic/studio/applib/src/Roboto-Medium.ttf
Normal file
Binary file not shown.
16272
src/olympic/studio/applib/src/font.cpp
Normal file
16272
src/olympic/studio/applib/src/font.cpp
Normal file
File diff suppressed because it is too large
Load Diff
10
src/olympic/studio/applib/src/font.hpp
Normal file
10
src/olympic/studio/applib/src/font.hpp
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
// Generated
|
||||||
|
|
||||||
|
#include <ox/std/span.hpp>
|
||||||
|
|
||||||
|
namespace studio::files {
|
||||||
|
|
||||||
|
[[nodiscard]]
|
||||||
|
ox::SpanView<uint8_t> RobotoMedium_ttf() noexcept;
|
||||||
|
|
||||||
|
}
|
11
src/olympic/studio/applib/src/rsrc.json
Normal file
11
src/olympic/studio/applib/src/rsrc.json
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
{
|
||||||
|
"cpp": "font.cpp",
|
||||||
|
"hpp": "font.hpp",
|
||||||
|
"namespace": "studio::files",
|
||||||
|
"files": [
|
||||||
|
{
|
||||||
|
"path": "Roboto-Medium.ttf",
|
||||||
|
"cpp_name": "RobotoMedium_ttf"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
@ -14,6 +14,7 @@
|
|||||||
#include <studio/configio.hpp>
|
#include <studio/configio.hpp>
|
||||||
#include "clawviewer.hpp"
|
#include "clawviewer.hpp"
|
||||||
#include "filedialogmanager.hpp"
|
#include "filedialogmanager.hpp"
|
||||||
|
#include "font.hpp"
|
||||||
#include "studioui.hpp"
|
#include "studioui.hpp"
|
||||||
|
|
||||||
namespace studio {
|
namespace studio {
|
||||||
@ -57,6 +58,19 @@ StudioUI::StudioUI(turbine::Context &ctx, ox::StringParam projectDataDir) noexce
|
|||||||
m_projectExplorer{keelCtx(m_tctx)},
|
m_projectExplorer{keelCtx(m_tctx)},
|
||||||
m_newProject{m_projectDataDir},
|
m_newProject{m_projectDataDir},
|
||||||
m_aboutPopup{m_tctx} {
|
m_aboutPopup{m_tctx} {
|
||||||
|
{
|
||||||
|
ImFontConfig fontCfg;
|
||||||
|
fontCfg.FontDataOwnedByAtlas = false;
|
||||||
|
auto const &io = ImGui::GetIO();
|
||||||
|
auto const font = files::RobotoMedium_ttf();
|
||||||
|
// const_cast is needed because this data is definitely const,
|
||||||
|
// but AddFontFromMemoryTTF requires a mutable buffer.
|
||||||
|
// However, setting fontCfg.FontDataOwnedByAtlas ensures
|
||||||
|
// that it will still be treated as const.
|
||||||
|
// ImGui documentation recognize that this is a bad design,
|
||||||
|
// and hopefully it will change at some point.
|
||||||
|
io.Fonts->AddFontFromMemoryTTF(const_cast<uint8_t*>(font.data()), static_cast<int>(font.size()), 13, &fontCfg);
|
||||||
|
}
|
||||||
turbine::setApplicationData(m_tctx, &m_sctx);
|
turbine::setApplicationData(m_tctx, &m_sctx);
|
||||||
m_projectExplorer.fileChosen.connect(this, &StudioUI::openFile);
|
m_projectExplorer.fileChosen.connect(this, &StudioUI::openFile);
|
||||||
m_projectExplorer.addDir.connect(this, &StudioUI::addDir);
|
m_projectExplorer.addDir.connect(this, &StudioUI::addDir);
|
||||||
|
@ -235,6 +235,7 @@ struct IconData {
|
|||||||
};
|
};
|
||||||
|
|
||||||
[[nodiscard]]
|
[[nodiscard]]
|
||||||
|
[[maybe_unused]]
|
||||||
static ox::Result<IconData> toGlfwImgPixels(ox::SpanView<uint8_t> const &iconPng) noexcept {
|
static ox::Result<IconData> toGlfwImgPixels(ox::SpanView<uint8_t> const &iconPng) noexcept {
|
||||||
ox::Result<IconData> out;
|
ox::Result<IconData> out;
|
||||||
unsigned w{}, h{};
|
unsigned w{}, h{};
|
||||||
|
@ -40,7 +40,7 @@ def file_to_cpp(path: str, cpp_name: str) -> tuple[str, str]:
|
|||||||
cpp = ''
|
cpp = ''
|
||||||
hpp = ''
|
hpp = ''
|
||||||
data, data_len = file_to_hex(path, "\t")
|
data, data_len = file_to_hex(path, "\t")
|
||||||
cpp += f'\nstatic constexpr ox::Array<uint8_t, {data_len}> {cpp_name}Data {{\n{data}\n}};\n'
|
cpp += f'\nstatic const ox::Array<uint8_t, {data_len}> {cpp_name}Data {{\n{data}\n}};\n'
|
||||||
cpp += f'\nox::SpanView<uint8_t> {cpp_name}() noexcept {{ return {cpp_name}Data; }}\n'
|
cpp += f'\nox::SpanView<uint8_t> {cpp_name}() noexcept {{ return {cpp_name}Data; }}\n'
|
||||||
hpp += f'\n[[nodiscard]]\nox::SpanView<uint8_t> {cpp_name}() noexcept;\n'
|
hpp += f'\n[[nodiscard]]\nox::SpanView<uint8_t> {cpp_name}() noexcept;\n'
|
||||||
return cpp, hpp
|
return cpp, hpp
|
||||||
@ -89,8 +89,9 @@ def proc_rsrc_file(rsrc_path: str):# Open and read the JSON file
|
|||||||
hpp += h
|
hpp += h
|
||||||
if all_files is not None:
|
if all_files is not None:
|
||||||
all_files_func += f'\t\t{cpp_name}(),\n'
|
all_files_func += f'\t\t{cpp_name}(),\n'
|
||||||
cpp += all_files_func + '\t};\n}\n'
|
if all_files is not None:
|
||||||
hpp += all_files_func_decl
|
cpp += all_files_func + '\t};\n}\n'
|
||||||
|
hpp += all_files_func_decl
|
||||||
cpp += pop_ns
|
cpp += pop_ns
|
||||||
hpp += pop_ns
|
hpp += pop_ns
|
||||||
write_txt_file(os.path.join(base_path, data['cpp']), cpp)
|
write_txt_file(os.path.join(base_path, data['cpp']), cpp)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user