Skip to content

Commit

Permalink
Simulate mouse motion to avoid initial flicker
Browse files Browse the repository at this point in the history
  • Loading branch information
daelsepara committed Aug 16, 2024
1 parent 3371008 commit 74b6c72
Show file tree
Hide file tree
Showing 7 changed files with 29 additions and 6 deletions.
2 changes: 1 addition & 1 deletion build/amd64/debian/LegendaryKingdoms.desktop
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[Desktop Entry]
Name=Legendary Kingdoms
Comment=Legendary Kingdoms
Version=1.0.7
Version=1.0.8
TryExec=/usr/local/games/LegendaryKingdoms/LegendaryKingdoms.exe
Exec=/usr/local/games/LegendaryKingdoms/LegendaryKingdoms.exe
Icon=/usr/local/games/LegendaryKingdoms/icons/legendary-kingdoms-red-128.png
Expand Down
2 changes: 1 addition & 1 deletion build/amd64/debian/control
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Package: legendary-kingdoms
Version: 1.0.7
Version: 1.0.8
Maintainer: Dael Separa <dael.separa@gmail.com>
Architecture: amd64
Description: Legendary Kingdoms (SDL)
Expand Down
2 changes: 1 addition & 1 deletion build/armhf/raspbian/LegendaryKingdoms.desktop
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[Desktop Entry]
Name=Legendary Kingdoms
Comment=Legendary Kingdoms
Version=1.0.7
Version=1.0.8
TryExec=/usr/local/games/LegendaryKingdoms/LegendaryKingdoms.exe
Exec=/usr/local/games/LegendaryKingdoms/LegendaryKingdoms.exe
Icon=/usr/local/games/LegendaryKingdoms/icons/legendary-kingdoms-red-128.png
Expand Down
2 changes: 1 addition & 1 deletion build/armhf/raspbian/control
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Package: legendary-kingdoms
Version: 1.0.7
Version: 1.0.8
Maintainer: Dael Separa <dael.separa@gmail.com>
Architecture: armhf
Description: Legendary Kingdoms (SDL)
Expand Down
2 changes: 1 addition & 1 deletion build/i386/debian/LegendaryKingdoms.desktop
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[Desktop Entry]
Name=Legendary Kingdoms
Comment=Legendary Kingdoms
Version=1.0.7
Version=1.0.8
TryExec=/usr/local/games/LegendaryKingdoms/LegendaryKingdoms.exe
Exec=/usr/local/games/LegendaryKingdoms/LegendaryKingdoms.exe
Icon=/usr/local/games/LegendaryKingdoms/icons/legendary-kingdoms-red-128.png
Expand Down
2 changes: 1 addition & 1 deletion build/i386/debian/control
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Package: legendary-kingdoms
Version: 1.0.7
Version: 1.0.8
Maintainer: Dael Separa <dael.separa@gmail.com>
Architecture: i386
Description: Legendary Kingdoms (SDL)
Expand Down
23 changes: 23 additions & 0 deletions src/LegendaryKingdoms.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26261,6 +26261,8 @@ bool mainScreen(SDL_Window *window, SDL_Renderer *renderer, Book::Type bookID, i

auto done = false;

auto first = true;

while (!done)
{
SDL_SetWindowTitle(window, "Legendary Kingdoms");
Expand All @@ -26281,6 +26283,27 @@ bool mainScreen(SDL_Window *window, SDL_Renderer *renderer, Book::Type bookID, i
auto scrollDown = false;
auto hold = false;

if (first)
{
SDL_Event user_event;

user_event.type = SDL_MOUSEMOTION;

user_event.motion.x = controls[0].X;

user_event.motion.y = controls[0].Y;

user_event.motion.xrel = controls[0].W / 2;

user_event.motion.yrel = controls[0].H / 2;

SDL_PushEvent(&user_event);

SDL_PumpEvents();

first = false;
}

Input::GetInput(renderer, controls, current, selected, scrollUp, scrollDown, hold);

if (selected && current >= 0 && current < controls.size())
Expand Down

0 comments on commit 74b6c72

Please sign in to comment.