4 Commits

Author SHA1 Message Date
Skyth
fef357062d Update version milestone to Release Candidate 2. 2025-02-22 17:04:46 +03:00
Darío
03ef34ffe8 Dpi fixes (#449)
* Potential fix for DPI scaling.

* Show window size in pixels while in Fullscreen mode.
2025-02-22 16:12:56 +03:00
Darío
c90d1fcb7b Fix typo in Spanish translation. (#447) 2025-02-21 22:14:00 +03:00
Hyper
ae3dfb12df options_menu: append inaccessible reason to description (#446) 2025-02-21 21:10:00 +03:00
7 changed files with 42 additions and 23 deletions

View File

@@ -2344,7 +2344,7 @@ namespace plume {
dstWidth = rect.right - rect.left;
dstHeight = rect.bottom - rect.top;
# elif defined(SDL_VULKAN_ENABLED)
SDL_GetWindowSize(renderWindow, (int *)(&dstWidth), (int *)(&dstHeight));
SDL_GetWindowSizeInPixels(renderWindow, (int *)(&dstWidth), (int *)(&dstHeight));
# elif defined(__ANDROID__)
dstWidth = ANativeWindow_getWidth(renderWindow);
dstHeight = ANativeWindow_getHeight(renderWindow);

View File

@@ -2415,19 +2415,25 @@ static void DrawImGui()
// we can adjust the mouse events before ImGui processes them.
uint32_t width = g_swapChain->getWidth();
uint32_t height = g_swapChain->getHeight();
if (width != Video::s_viewportWidth || height != Video::s_viewportHeight)
float mousePosScaleX = float(width) / float(GameWindow::s_width);
float mousePosScaleY = float(height) / float(GameWindow::s_height);
float mousePosOffsetX = (width - Video::s_viewportWidth) / 2.0f;
float mousePosOffsetY = (height - Video::s_viewportHeight) / 2.0f;
for (int i = 0; i < io.Ctx->InputEventsQueue.Size; i++)
{
float mousePosOffsetX = (width - Video::s_viewportWidth) / 2.0f;
float mousePosOffsetY = (height - Video::s_viewportHeight) / 2.0f;
for (int i = 0; i < io.Ctx->InputEventsQueue.Size; i++)
auto& e = io.Ctx->InputEventsQueue[i];
if (e.Type == ImGuiInputEventType_MousePos)
{
auto& e = io.Ctx->InputEventsQueue[i];
if (e.Type == ImGuiInputEventType_MousePos)
if (e.MousePos.PosX != -FLT_MAX)
{
if (e.MousePos.PosX != -FLT_MAX) e.MousePos.PosX -= mousePosOffsetX;
if (e.MousePos.PosY != -FLT_MAX) e.MousePos.PosY -= mousePosOffsetY;
e.MousePos.PosX *= mousePosScaleX;
e.MousePos.PosX -= mousePosOffsetX;
}
if (e.MousePos.PosY != -FLT_MAX)
{
e.MousePos.PosY *= mousePosScaleY;
e.MousePos.PosY -= mousePosOffsetY;
}
}
}

View File

@@ -213,7 +213,7 @@ std::unordered_map<std::string_view, std::unordered_map<ELanguage, std::string>>
{ ELanguage::Japanese, "この\u200Bオプションは\u200B[現在:げんざい]の\u200BOSで\u200B[変更:へんこう]\u200Bできません" },
{ ELanguage::German, "Diese Option wird von diesem Betriebssystem nicht unterstützt." },
{ ELanguage::French, "Cette option n'est pas prise en charge par votre système d'exploitation." },
{ ELanguage::Spanish, "Está opción no está soportada por tu sistema operativo." },
{ ELanguage::Spanish, "Esta opción no está soportada por tu sistema operativo." },
{ ELanguage::Italian, "Questa opzione non è disponibile con il tuo sistema operativo." }
}
},

View File

@@ -1,4 +1,4 @@
VERSION_MILESTONE="Release Candidate 1"
VERSION_MILESTONE="Release Candidate 2"
VERSION_MAJOR=1
VERSION_MINOR=0
VERSION_REVISION=0

View File

@@ -378,6 +378,11 @@ SDL_Rect GameWindow::GetDimensions()
return rect;
}
void GameWindow::GetSizeInPixels(int *w, int *h)
{
SDL_GetWindowSizeInPixels(s_pWindow, w, h);
}
void GameWindow::SetDimensions(int w, int h, int x, int y)
{
s_width = w;

View File

@@ -37,6 +37,7 @@ public:
static bool IsMaximised();
static EWindowState SetMaximised(bool isEnabled);
static SDL_Rect GetDimensions();
static void GetSizeInPixels(int *w, int *h);
static void SetDimensions(int w, int h, int x = SDL_WINDOWPOS_CENTERED, int y = SDL_WINDOWPOS_CENTERED);
static void ResetDimensions();
static uint32_t GetWindowFlags();

View File

@@ -1121,17 +1121,25 @@ static void DrawConfigOption(int32_t rowIndex, float yOffset, ConfigDef<T>* conf
{
if (config == &Config::WindowSize)
{
auto displayModes = GameWindow::GetDisplayModes();
if (config->Value >= 0 && config->Value < displayModes.size())
if (Config::Fullscreen)
{
auto& displayMode = displayModes[config->Value];
valueText = fmt::format("{}x{}", displayMode.w, displayMode.h);
int displayW, displayH;
GameWindow::GetSizeInPixels(&displayW, &displayH);
valueText = fmt::format("{}x{}", displayW, displayH);
}
else
{
valueText = fmt::format("{}x{}", GameWindow::s_width, GameWindow::s_height);
auto displayModes = GameWindow::GetDisplayModes();
if (config->Value >= 0 && config->Value < displayModes.size())
{
auto& displayMode = displayModes[config->Value];
valueText = fmt::format("{}x{}", displayMode.w, displayMode.h);
}
else
{
valueText = fmt::format("{}x{}", GameWindow::s_width, GameWindow::s_height);
}
}
}
else if (config == &Config::Monitor)
@@ -1458,7 +1466,7 @@ static void DrawInfoPanel(ImVec2 infoMin, ImVec2 infoMax)
if (g_inaccessibleReason)
{
desc = *g_inaccessibleReason;
desc += "\n\n" + *g_inaccessibleReason;
}
else
{
@@ -1476,10 +1484,9 @@ static void DrawInfoPanel(ImVec2 infoMin, ImVec2 infoMax)
}
const auto& valueDescription = g_selectedItem->GetValueDescription(Config::Language);
if (!valueDescription.empty())
{
desc += "\n\n" + valueDescription;
}
}
clipRectMin = { clipRectMin.x, thumbnailMax.y };