mirror of https://github.com/AxioDL/metaforce.git
Merge remote-tracking branch 'origin/imgui-freetype' into wgpu
# Conflicts: # .github/workflows/build.yml # .github/workflows/release.yml # README.md # imgui/CMakeLists.txt # imgui/ImGuiEngine.cpp
This commit is contained in:
commit
bd6aaddf1a
|
@ -46,7 +46,7 @@ jobs:
|
|||
sudo add-apt-repository "deb https://apt.repos.intel.com/oneapi all main"
|
||||
sudo apt-get -y install ninja-build clang lld libcurl4-openssl-dev intel-oneapi-ipp-devel \
|
||||
zlib1g-dev libglu1-mesa-dev libdbus-1-dev libvulkan-dev libxi-dev libxrandr-dev libasound2-dev \
|
||||
libpulse-dev libudev-dev libpng-dev libncurses5-dev libx11-xcb-dev qt5-default
|
||||
libpulse-dev libudev-dev libpng-dev libncurses5-dev libx11-xcb-dev qt5-default libfreetype-dev
|
||||
|
||||
yarn global add @sentry/cli
|
||||
echo "$(yarn global bin)" >> $GITHUB_PATH
|
||||
|
@ -103,7 +103,7 @@ jobs:
|
|||
run: |
|
||||
brew update
|
||||
brew upgrade --formula
|
||||
brew install ninja graphicsmagick imagemagick
|
||||
brew install ninja graphicsmagick imagemagick freetype
|
||||
yarn global add create-dmg
|
||||
|
||||
# universal qt5 from macports
|
||||
|
|
|
@ -46,7 +46,7 @@ jobs:
|
|||
sudo add-apt-repository "deb https://apt.repos.intel.com/oneapi all main"
|
||||
sudo apt-get -y install ninja-build clang lld libcurl4-openssl-dev intel-oneapi-ipp-devel \
|
||||
zlib1g-dev libglu1-mesa-dev libdbus-1-dev libvulkan-dev libxi-dev libxrandr-dev libasound2-dev \
|
||||
libpulse-dev libudev-dev libpng-dev libncurses5-dev libx11-xcb-dev qt5-default
|
||||
libpulse-dev libudev-dev libpng-dev libncurses5-dev libx11-xcb-dev qt5-default libfreetype-dev
|
||||
|
||||
yarn global add @sentry/cli
|
||||
echo "$(yarn global bin)" >> $GITHUB_PATH
|
||||
|
@ -121,7 +121,7 @@ jobs:
|
|||
run: |
|
||||
brew update
|
||||
brew upgrade --formula
|
||||
brew install ninja graphicsmagick imagemagick getsentry/tools/sentry-cli
|
||||
brew install ninja graphicsmagick imagemagick getsentry/tools/sentry-cli freetype
|
||||
yarn global add create-dmg
|
||||
|
||||
# universal qt5 from macports
|
||||
|
|
|
@ -75,11 +75,11 @@ NFS files dumped from Metroid Prime Trilogy on Wii U VC can be used directly wit
|
|||
build-essential curl git ninja-build clang lld zlib1g-dev libcurl4-openssl-dev \
|
||||
libglu1-mesa-dev libdbus-1-dev libvulkan-dev libxi-dev libxrandr-dev libasound2-dev libpulse-dev \
|
||||
libudev-dev libpng-dev libncurses5-dev cmake libx11-xcb-dev python3 python-is-python3 \
|
||||
qtbase5-dev qtchooser qt5-qmake qtbase5-dev-tools libclang-dev
|
||||
qtbase5-dev qtchooser qt5-qmake qtbase5-dev-tools libclang-dev libfreetype-dev
|
||||
```
|
||||
* Arch Linux packages
|
||||
```
|
||||
base-devel cmake ninja llvm vulkan-headers python3 qt6 clang lld alsa-lib libpulse libxrandr
|
||||
base-devel cmake ninja llvm vulkan-headers python3 qt6 clang lld alsa-lib libpulse libxrandr freetype2
|
||||
```
|
||||
* Fedora packages
|
||||
```
|
||||
|
@ -168,4 +168,4 @@ We currently do not have a good fix for this issue, however a workaround is to p
|
|||
and executing from there e.g:
|
||||
`D:\HECLProjects\`
|
||||
Another work around is to install a version of python that matches the one blender ships with and renaming the python directory in the blender directory to `python.bak`.
|
||||
This will force blender to use the system's python if it's available and will not have the same path limitation
|
||||
This will force blender to use the system's python if it's available and will not have the same path limitation
|
||||
|
|
|
@ -32,7 +32,7 @@ void ImGuiStringViewText(std::string_view text) {
|
|||
|
||||
void ImGuiTextCenter(std::string_view text) {
|
||||
ImGui::NewLine();
|
||||
float fontSize = ImGui::GetFontSize() * float(text.size()) / 2;
|
||||
float fontSize = ImGui::CalcTextSize(text.data(), text.data() + text.size()).x;
|
||||
ImGui::SameLine(ImGui::GetWindowSize().x / 2 - fontSize + fontSize / 2);
|
||||
ImGuiStringViewText(text);
|
||||
}
|
||||
|
|
|
@ -19,6 +19,14 @@ if (CMAKE_COMPILER_IS_GNUCXX)
|
|||
endif()
|
||||
target_link_libraries(imgui PRIVATE boo hecl-light RetroDataSpec aurora)
|
||||
|
||||
# Optional, replaces stb_freetype if available
|
||||
find_package(Freetype)
|
||||
if (FREETYPE_FOUND)
|
||||
target_sources(imgui PRIVATE ../extern/imgui/misc/freetype/imgui_freetype.cpp)
|
||||
target_compile_definitions(imgui PUBLIC IMGUI_ENABLE_FREETYPE)
|
||||
target_link_libraries(imgui PRIVATE Freetype::Freetype)
|
||||
endif ()
|
||||
|
||||
bintoc_compress(NotoMono.cpp NotoMono-Regular.ttf NOTO_MONO_FONT)
|
||||
bintoc(MetaforceIcon.cpp ../Runtime/platforms/freedesktop/256x256/apps/metaforce.png METAFORCE_ICON)
|
||||
|
||||
|
|
|
@ -10,6 +10,10 @@
|
|||
#define STBI_ONLY_PNG
|
||||
#include "stb_image.h"
|
||||
|
||||
#ifdef IMGUI_ENABLE_FREETYPE
|
||||
#include "misc/freetype/imgui_freetype.h"
|
||||
#endif
|
||||
|
||||
extern "C" const uint8_t NOTO_MONO_FONT[];
|
||||
extern "C" const size_t NOTO_MONO_FONT_SZ;
|
||||
extern "C" const size_t NOTO_MONO_FONT_DECOMPRESSED_SZ;
|
||||
|
@ -33,13 +37,22 @@ void ImGuiEngine_Initialize(float scale) {
|
|||
fontConfig.FontData = fontData;
|
||||
fontConfig.FontDataSize = int(NOTO_MONO_FONT_DECOMPRESSED_SZ);
|
||||
fontConfig.SizePixels = std::floor(14.f * scale);
|
||||
#ifdef IMGUI_ENABLE_FREETYPE
|
||||
fontConfig.FontBuilderFlags = ImGuiFreeTypeBuilderFlags_LightHinting;
|
||||
#endif
|
||||
snprintf(static_cast<char*>(fontConfig.Name), sizeof(fontConfig.Name), "Noto Mono Regular, %dpx",
|
||||
static_cast<int>(fontConfig.SizePixels));
|
||||
ImGuiEngine::fontNormal = io.Fonts->AddFont(&fontConfig);
|
||||
fontConfig.FontDataOwnedByAtlas = false; // first one took ownership
|
||||
fontConfig.SizePixels = std::floor(24.f * scale);
|
||||
#ifdef IMGUI_ENABLE_FREETYPE
|
||||
fontConfig.FontBuilderFlags |= ImGuiFreeTypeBuilderFlags_Bold;
|
||||
snprintf(static_cast<char*>(fontConfig.Name), sizeof(fontConfig.Name), "Noto Mono Bold, %dpx",
|
||||
static_cast<int>(fontConfig.SizePixels));
|
||||
#else
|
||||
snprintf(static_cast<char*>(fontConfig.Name), sizeof(fontConfig.Name), "Noto Mono Regular, %dpx",
|
||||
static_cast<int>(fontConfig.SizePixels));
|
||||
#endif
|
||||
ImGuiEngine::fontLarge = io.Fonts->AddFont(&fontConfig);
|
||||
|
||||
ImGui::GetStyle().ScaleAllSizes(scale);
|
||||
|
|
|
@ -8,6 +8,8 @@
|
|||
//#include <boo/graphicsdev/IGraphicsDataFactory.hpp>
|
||||
|
||||
namespace metaforce {
|
||||
constexpr inline int TranslateBooSpecialKey(boo::ESpecialKey key) { return 256 + static_cast<int>(key); }
|
||||
|
||||
class ImGuiEngine {
|
||||
public:
|
||||
static ImFont* fontNormal;
|
||||
|
|
Loading…
Reference in New Issue