Skip to content

Commit 77f29ed

Browse files
committed
Overlay: move notifications out of letterbox area
1 parent 850c2a7 commit 77f29ed

File tree

3 files changed

+20
-11
lines changed

3 files changed

+20
-11
lines changed

src/game_addrs.hpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,18 @@ namespace Game
143143
return event(8)->data<EVWORK_CAR>();
144144
}
145145

146+
inline bool is_in_game()
147+
{
148+
return
149+
*Game::current_mode == GameState::STATE_GAME ||
150+
*Game::current_mode == GameState::STATE_GOAL ||
151+
*Game::current_mode == GameState::STATE_TIMEUP ||
152+
*Game::current_mode == GameState::STATE_TRYAGAIN ||
153+
*Game::current_mode == GameState::STATE_OUTRUNMILES ||
154+
*Game::current_mode == GameState::STATE_SMPAUSEMENU ||
155+
(*Game::current_mode == GameState::STATE_START && *Game::game_start_progress_code == 65);
156+
}
157+
146158
inline void init()
147159
{
148160
current_mode = Module::exe_ptr<GameState>(0x38026C);

src/hooks_uiscaling.cpp

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -693,16 +693,7 @@ class UILetterboxing : public Hook
693693
VertexBuf->Unlock();
694694
}
695695

696-
bool isInGame =
697-
*Game::current_mode == GameState::STATE_GAME ||
698-
*Game::current_mode == GameState::STATE_GOAL ||
699-
*Game::current_mode == GameState::STATE_TIMEUP ||
700-
*Game::current_mode == GameState::STATE_TRYAGAIN ||
701-
*Game::current_mode == GameState::STATE_OUTRUNMILES ||
702-
*Game::current_mode == GameState::STATE_SMPAUSEMENU ||
703-
(*Game::current_mode == GameState::STATE_START && *Game::game_start_progress_code == 65);
704-
705-
if (Settings::UILetterboxing == 1 && isInGame)
696+
if (Settings::UILetterboxing == 1 && Game::is_in_game())
706697
return; // disable letterboxing while in-game
707698

708699
// Backup existing cullmode and set to none, otherwise we won't get drawn

src/overlay/notifications.hpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,13 @@ class Notifications
4343
ImVec2 screenSize = ImGui::GetIO().DisplaySize;
4444

4545
// Calculate starting position for the latest notification
46-
float startX = screenSize.x - notificationSize.x - 10.0f; // 10px padding from the right
46+
// (move it outside of letterbox if letterboxing enabled)
47+
float contentWidth = screenSize.y / (3.f / 4.f);
48+
float borderWidth = ((screenSize.x - contentWidth) / 2) + 0.5f;
49+
if (Settings::UILetterboxing != 1 || Game::is_in_game())
50+
borderWidth = 0;
51+
52+
float startX = screenSize.x - notificationSize.x - borderWidth - 10.f; // 10px padding from the right
4753
float startY = (screenSize.y / 4.0f) - (notifications.size() * (notificationSize.y + notificationSpacing) / 2.0f);
4854

4955
std::lock_guard<std::mutex> lock(notificationsMutex);

0 commit comments

Comments
 (0)