修复gui错误

reconstruct-CmakeLIsts
InkSoul 2025-02-16 14:27:21 +08:00
parent bca2a1367f
commit 69fc13b883
2 changed files with 7 additions and 16 deletions

View File

@ -50,24 +50,15 @@ public:
Font texture loading
*/
ImGuiIO& io = ImGui::GetIO();
/// enable keyborad and gamepad input
io.ConfigFlags |= ImGuiConfigFlags_NavEnableKeyboard;
io.ConfigFlags |= ImGuiConfigFlags_NavEnableGamepad;
unsigned char* fontData;
int texWidth, texHeight;
#if defined(__ANDROID__)
float scale = (float)vks::android::screenDensity / (float)ACONFIGURATION_DENSITY_MEDIUM;
AAsset* asset = AAssetManager_open(androidApp->activity->assetManager, "Roboto-Medium.ttf", AASSET_MODE_STREAMING);
assert(asset);
size_t size = AAsset_getLength(asset);
assert(size > 0);
char *fontAsset = new char[size];
AAsset_read(asset, fontAsset, size);
AAsset_close(asset);
io.Fonts->AddFontFromMemoryTTF(fontAsset, size, 14.0f * scale);
delete[] fontAsset;
#else
std::string ttfFilePath = getAssetPath() + "/STXINWEI.TTF";
io.Fonts->AddFontFromFileTTF(ttfFilePath.data(), 16.0f,NULL, io.Fonts->GetGlyphRangesChineseSimplifiedCommon());
#endif
io.Fonts->GetTexDataAsRGBA32(&fontData, &texWidth, &texHeight);
fontTexture.loadFromBuffer(fontData, texWidth * texHeight * 4 * sizeof(char), VK_FORMAT_R8G8B8A8_UNORM, texWidth, texHeight, vulkanDevice, queue);

View File

@ -2080,12 +2080,11 @@ PlumageRender::PlumageRender()
bool updateShaderParams = false;
bool updateCBs = false;
float scale = 1.0f;
bool boolTitleWindowShow = false;
ImGui::NewFrame();
ImGui::SetNextWindowPos(ImVec2(10000, 10000));
//ImGui::SetNextWindowSize(ImVec2(200 * scale, (models.scene.animations.size() > 0 ? 440 : 360) * scale), ImGuiSetCond_Always);
ImGui::Begin("", nullptr, ImGuiWindowFlags_NoFocusOnAppearing|ImGuiWindowFlags_AlwaysAutoResize|ImGuiWindowFlags_NoBringToFrontOnFocus);
ImGui::Begin(title.c_str(), nullptr, ImGuiWindowFlags_NoFocusOnAppearing | ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoBringToFrontOnFocus);
ImGui::PushItemWidth(100.0f * scale);
@ -2116,6 +2115,7 @@ PlumageRender::PlumageRender()
if (!filename.empty()) {
vkDeviceWaitIdle(device);
std::wstring_convert<std::codecvt_utf8<wchar_t>> converter;
std::string stringFilename = converter.to_bytes(filename);
loadScene(stringFilename);
setupDescriptors();