Review Request 130167: Fix incorrect resize before game is started.
Julian Helfferich
julian.helfferich at googlemail.com
Wed Jun 28 20:54:28 UTC 2017
> On June 27, 2017, 5:18 p.m., Albert Astals Cid wrote:
> > This seems like a workaround for a bug somewhere else? I mean if we're already calling it in resizeEvent calling it here again seems a bit redundant, no? Have you checked if maybe the mpGameScene->sceneRect() value in resizeEvent is bad or something?
Now I have found the underlying cause and I think my fix is perfectly good:
There are two possible values for sceneRect: [360, 360] for single game and [720, 360] for Human vs AI. The default value is [720, 360]. Thus, the scene is scaled such that this sceneRect fits into the view. However, when you start a single game, the sceneRect is set to [360, 360]. It does not fit correctly, but is only rescaled when you resize the window. Thus, the correct thing to do is to call fitIntoView() after a game has started and KBlocks knows which sceneRect values to use.
Knowing this, I have found an even worse variant of the bug:
1) Start the game
2) Start a single game
3) Shrink the KBlocks window horizontally
4) Start a Human vs. AI game
The scene again doesn't fit the view, but this time the play area of the AI is outside the view and thus invisible.
- Julian
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://git.reviewboard.kde.org/r/130167/#review103380
-----------------------------------------------------------
On June 27, 2017, 3:36 p.m., Julian Helfferich wrote:
>
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://git.reviewboard.kde.org/r/130167/
> -----------------------------------------------------------
>
> (Updated June 27, 2017, 3:36 p.m.)
>
>
> Review request for KDE Games.
>
>
> Bugs: 380464
> http://bugs.kde.org/show_bug.cgi?id=380464
>
>
> Repository: kblocks
>
>
> Description
> -------
>
> This commit fixes bug 380464.
>
> When the game window is resized before a game is started, the game scene is not correctly rescaled. When starting the game it might be too small (it seems never to be too large).
>
> This commit fixes the bug by triggering a fitInView() call of the gameView. The same function is triggered by a resize event.
>
>
> Diffs
> -----
>
> KBlocksWin.cpp d4eb6d2
>
> Diff: https://git.reviewboard.kde.org/r/130167/diff/
>
>
> Testing
> -------
>
> Started the program -> Resized the window (enlarged vertically) -> started a game -> resized the window.
>
> Before: Bug confirmed.
> After: Bug fixed.
>
>
> Thanks,
>
> Julian Helfferich
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-games-devel/attachments/20170628/4360770e/attachment.html>
More information about the kde-games-devel
mailing list