Age | Commit message (Collapse) | Author | Files | Lines |
|
Due to the use of SubImage, there can be multiple images pointing to the same
SDL_Texture with different alpha values. However, since the alpha mod set on
the texture was only set from Image::setAlpha, images were not always rendered
with the correct alpha value.
Now the alpha mod is always set right before rendering each image. Most of the
time the alpha will remain the same, but I don't expect this to become a
performance issue so I've not added extra variables and checks to suppress such
calls when they aren't needed.
On the upside, this simplifies the "use color" option, which previously had to
restore the previously set alpha mod.
Closes #117
|
|
Otherwise, at least on X11, the window is (visibly) re-created once the
SDL renderer is created. Also the window icon can be seen changing on
startup. Showing the window only after all related setup has been
completed avoids this.
On X11 this appears to have the added benefit of putting a "windowed
fullscreen" window on the active screen (in terms of where the mouse is)
rather than always using the primary screen.
On Windows, showing the window only after the initial paint avoids the
window initially appearing with its contents entirely black.
The window is still immediately shown in the following cases:
* In exclusive fullscreen mode, because on Windows this caused the
initial show of a fullscreen window to take much longer and on X11 it
could cause the resolution of the primary screen to be changed while
maximizing the Mana window on the active screen.
* In "windowed fullscreen" mode when the legacy OpenGL renderer is used,
where it was causing an additional flicker on Windows.
|
|
We don't need to keep an array of SubImage instances, but can just
remember the top, left, right and bottom margins and use those when
rendering the scaled ImageRect.
Graphics::drawRescaledImagePattern had to be extended to allow
specifying the source rectangle.
|
|
Clipping has been disabled globally by taking it out of
Graphics::pushClipArea. Now its name is a little confusing, but it can't
just be changed since it is part of Guichan.
Widgets that do need to clip their children use the new
Graphics::pushClipRect, which pushes a clipping rectangle without
affecting the local coordinates. These are:
* ScrollArea
* TextField
* TabbedArea (scrolling tabs)
* MiniMap
While it might count as a small optimization, I'm actually disabling
clipping because it is not always desired. For example it gets in the
way of rendering the complete ResizeGrip in the Jewelry theme because
that's a child widget.
|
|
Thanks to https://github.com/cgmb/guardonce and a follow-up replace to
remove duplicated newlines at end of file:
find src -type f -name '*.h' -exec \
sed --in-place -e :a -e '/^\n*$/{$d;N;};/\n$/ba' {} \;
Source: https://unix.stackexchange.com/questions/81685/how-to-remove-multiple-newlines-at-eof
Fixes compile on macOS, which appears to have been due to the EVENT_H
include guard.
|
|
Helps making sure we're not modifying the images in the rendering code.
Re-applies 4eea727b7649726670d8963d11ab4fd429624b3e (and reverts
363f71157a8107190b3bd2ba656faf0a0e63ab36).
|
|
This can be used for smoother mouse cursor movement when rendering our
own mouse cursor (already changed in this commit) and is also necessary
for implementing support for HiDPI font rendering.
Also dropped some almost duplicated OpenGL code.
|
|
* Added "Scale" user option, which can either by "Auto" or an explicit
scaling factor. Its maximum value depends on the current resolution.
The "Auto" factor is based on keeping the logical resolution on at
least 800x600, wheres the maximum scale is based on keeping the
logical resolution on at least 640x480.
* Enabled support for High DPI. This means the rendering target can now
have a different resolution than the window size, which can happen on
macOS, Windows and Wayland. The resulting scale is multiplied by the
above user-controlled scale.
Currently, this looks ugly for non-integer scales, which are not used
on macOS and can only be configured on some Wayland compositors.
Has not been tested on Windows.
* Simplified OpenGL initialization (moved out of _beginDraw).
* Made sure _beginDraw/_endDraw sets a clip area also for SDLGraphics.
|
|
The configuration and setup UI were adjusted to the new options.
This also fixes issues in applying new video settings.
Default resolution was changed from 800x600 to 1280x720. VSync is
enabled by default while FPS limit was disabled.
Display aspect ratio for the resolution options.
I had to work around some macOS issues:
* Don't change window size when it appears to be "maximized", since it
just changes the rendering area while leaving the window maximized.
* Unset fullscreen display mode temporarily to allow changing resolutions,
otherwise the rendering area no longer matches the screen and mouse
input is also off.
* Removed SDL_WINDOW_ALLOW_HIGHDPI for now because it causes issues on
macOS, since we're not actually handling the scaling factor.
A Video class and an SDLGraphics subclass were split off from Graphics.
This setup has Less duplication and leaves the OpenGLGraphics and
SDLGraphics better separated.
Fixes #57
Fixes #58
|