Age | Commit message (Collapse) | Author | Files | Lines |
|
Rather than rendering the same texture 4 additional times, render a
specific outline version of the text. While reducing the number of times
the text is drawn, it does increase font texture use.
Result is a generally prettier outline due to rendering it properly at
sharp corners of the characters. The shadow for outlined text is now
also thicker, as appropriate.
As part of this change, the `TextRenderer` class was merged into the
`Graphics` and `TrueTypeFont` classes. There seemed to be little point
in having a separate function for this, apart from needing more static
casts to `Graphics*`.
Also fixed an issue where the font style was not being restored after
adjusting the font scale, when using an older SDL_ttf than 2.0.18.
Closes #87
|
|
This window gives an overview over completed and currently active
quests. A persistent checkbox toggles whether completed quests are
shown. Item links are supported in quest texts.
New window icon by meway. Completed quest icon for Mana theme copied
from ManaPlus.
The Quests window has no shortcut for now.
|
|
This enables customized outlines for each text color as well as adding
outlines for specific palettes, as done by the Jewelry theme.
Merged PARTY_CHAT_TAB and PARTY_SOCIAL_TAB into just PARTY_TAB since we
should probably be using the same color there anyway.
Split off WHISPER_TAB as separate color from WHISPER.
|
|
Each Skin can point to a different palette, which can be used to tweak text
colors where necessary. For now there is no generic solution for this, instead
a number of locations have been adjusted to take the palette into account:
* ChatWindow sets its palette on the BrowserBox used in its tabs.
* Popup sets its palette on child widgets when they are added (covering
BrowserBox, Label and TextBox).
* ItemPopup now uses its palette when looking up colors.
The BrowserBox now retrieves its numbered text colors from the theme. Also
added OLDCHAT, AWAYCHAT and GLOBAL theme colors, with ##g, ##o and ##a to
choose these colors respectively.
Fixed ImageRect move constructor.
TextPreview class was cleaned up from unused functionality.
Being name colors are no longer different between the name shown on the being
and the name shown in the SpeechDialog.
|
|
Sometimes I've used CamelCase and sometimes SNAKE_CASE for these values.
Since "enum class" values are always prefixed with the enum name, which
uses CamelCase, I find it more fitting to use it for the values as well.
Also fixes compilation on Windows where 'ERROR' was conflicting with a
define.
|
|
* Removed some unused includes and forward declarations.
* Use std::unique_ptr to automate cleanup.
* Use TextRenderer::renderText in BrowserBox to avoid code duplication.
* Removed unused STATE_NORMAL from StateFlags.
* Small layout fix in ServerDialog.
* Reduced rewrapping delay in BrowserBox to 33ms and disabled it
entirely when there are no more than 1000 lines to rewrap. The
rewrapping is usually fast enough.
|
|
Now when NPCs text includes "###MoveUp;", it will get replaced by "Up",
or whatever key is currently bound to that action.
For compatibility reasons the key name can optionally have a "key"
prefix, for example "###keyMoveUp;".
Closes #73
|
|
* Wrapped remaining PhysFS API calls and set PHYSFS_DEPRECATED to
suppress deprecation warnings for PHYSFS_getUserDir, since no
alternative is available for now.
* Removed support for decompressing .gz files, since it has been unused
for years and doesn't seem useful when updates are anyway served in an
archive.
* Use SDL_LoadFile and SDL_LoadFile_RW convenience functions (raises
minimum SDL version to 2.0.10).
* Removed ResourceManager::copyFile, since it was unused and will likely
stay unused.
* Removed ResourceManager::loadTextFile. Instead, split up the string in
BrowserBox::addRows without making additional copies.
|
|
The Timer is efficient because it does not depend on incrementing a
counter to keep track of time, nor does it call SDL_GetTicks every time
its state is checked (this happens once per frame instead).
Along with global functions Time::absoluteTimeMs() and
Time::deltaTimeMs(), this replaces previous globals tick_time, cur_time
and get_elapsed_time().
For now, there is still a fixed 100 times per second logic call rate,
but the new Time::deltaTimeMs() function should allow getting rid of
this.
|
|
Made the class and the code in general more readable by removing all
the needless getters and setters.
|
|
InputEvent::mIsConsumed is used to tell the Window it should not change
the mouse cursor as well.
This change also adds a closed hand mouse cursor, though this is unused
for now (might be useful when dragging stuff around).
The new cursors are by meway.
|
|
This was already the case for each newly added line, but when the entire
layout was redone previous selected colors would spill over to the next
line.
|
|
* Apply indentation after wrapping only in NPC dialogs and chat window,
since we don't want this in the updater window / news.
* Added some margin around the text in the updater window and NPC
dialogs, using gcn::Widget::setFrameSize.
* Cosmetic changes to BrowserBox implementation.
|
|
If a text contained for example "##3##B", expected behavior was to
switch to blue color and bold font. Instead, due to there being no
actual text in between the markers, the layouting code was aborting
prematurely here:
if (mMode == AUTO_WRAP && partWidth == 0)
break;
As far as I could judge, this check is actually not necessary anyway,
but I've kept it for now since the wrapping code looks so problematic.
Instead, a while loop now makes sure we process all consecutive
formatting markers.
Closes #75
|
|
(cherry picked from commit 0192d44d46dcf948ab26371862753f4baf5aae4e)
|
|
##B switches font to bold, ##b switches font to normal. Each line starts
with the normal font.
This change is roughly based on ManaPlus commit
6c4c6ca877c336e17c0378131a0a139792012a99.
|
|
* Use ConfirmDialog to confirm the opening of the external link.
* ConfirmDialog now centers on its parent window when provided.
* Reset hovered link when mouse exits the BrowserBox.
|
|
* Introduced a LayoutContext that conveniently allows for relayouting
all rows, or just a single one when it is added. BrowserBox::addRow
no longer relayouts all the rows.
* BrowserLink and LinePart are now merged into a new TextRow struct,
so they can be conveniently dropped when the row limit has been
reached.
* Removed "opaque" option, which was enabled by default but disabled
for all BrowserBox instances.
* Removed "always update" option, and instead start delaying relayouting
automatically when there are a lot of rows (> 100 currently).
* Update window now also has text wrapping enabled.
Closes #50
|
|
Doing some cleanups before working towards optimizing this code.
Removed needless additional wrapping code in BrowserBox::addRow, since
the text will be relayouted anyway.
Simplified layouting code a little. For example, there's no need to keep
track of the number of wrapped lines.
Use more optimal data structures, like an std::deque for the text rows
and a plain std::vector for the line parts. Both have less fragmentation
than an std::list.
|
|
This patch is not exhaustive.
|
|
modernize-loop-convert
modernize-deprecated-headers
|
|
modernize-use-auto
modernize-use-nullptr
modernize-use-override
modernize-use-using
|
|
SDL_ttf provides a separate function for getting the recommended line skip, or
the spacing between two lines of text. When rendering multiple lines of text
this should be used rather than the visual height of the font.
Since the information is only available for TrueTypeFont, a dynamic_cast was
used with a fallback on gcn::Font::getHeight.
Also made some small tweaks but nothing that really affects performance.
Reviewed-by: Yohann Ferreira
|
|
|
|
I added text shadow and outline support to the browserbox,
and made it adapt the text for the chattabs depending on the
GUI opacity.
Reviewed-by: Ablu.
|
|
Conflicts:
po/es.po
po/fr.po
src/net/tmwa/adminhandler.cpp
update-creator.sh
|
|
The compiler gave two times the warning:
comparison between signed and unsigned integer expressions.
Reviewed-by: thorbjorn
|
|
Reviewed-by: Kage
|
|
Conflicts:
src/being.cpp
src/client.cpp
src/commandhandler.cpp
src/gui/setup_video.cpp
src/gui/socialwindow.cpp
src/gui/viewport.cpp
src/gui/widgets/browserbox.cpp
src/gui/widgets/itemcontainer.cpp
src/imageparticle.cpp
src/localplayer.cpp
src/localplayer.h
src/map.cpp
src/net/tmwa/beinghandler.cpp
src/particle.cpp
src/particle.h
src/player.cpp
src/player.h
|
|
Reviewed-by: Thorbjorn
|
|
Parse chat lines in BrowserBox once after changes.
Reviewed-by: Thorbjorn
|
|
Reviewed-by: Yohann Ferreira
|
|
Themes can now control the colors they use. Colors in the Viewport (being
names, particles, etc) can still be changed by the user. Also make
ProgressBars more easily colored. DyePalette was made more flexible in the
process.
Also fixes comparing strings of different lengths insensitively.
Reviewed-by: Thorbjørn Lindeijer
|
|
|
|
|
|
They'd be in the correct position, just that the link length would always
stay at the length of the original font.
Signed-off-by: Tametomo <irarice@gmail.com>
|
|
Also added the update copyright tool from the Wormux Team.
( And not forgetting credit's due. :P )
|
|
Add a couple of missing wrapped = false; lines, so that it doesn't treat
every further ## as a line wrap
|
|
For improve chat speed this patch add some hacks to
BrowserBox class, split big words in ChatTab.
Also fix DoS in chat.
|
|
Moved remaining widgets into widgets folder, standardized include order, moved TextRenderer out.
|
|
|
|
Caused the underline for links at the bottom of the BrowserBox to draw
outside of the clip area.
|
|
In some situations, like when wrapping the "]." part after an item link,
the attempt at forced-wrapping the text never succeeded. The additional
guard "end > start" protects against these cases.
Also made some small optimizations. Removed redundant c_str() calls,
noticed by Octalot, and changed " " to ' ' for finding a space.
|
|
Patch by QOAL
(cherry picked from commit cc2cd67e1c3c3f95485ae4477b6a2f0d255e9163)
|
|
|
|
|
|
Now the BrowserBox can again display 9 build-in (non configurable)
colors, used for example in the client news and the help window.
|
|
|
|
In an attempt to make the GUI code a little more structured, basic
widgets are now put in gui/widgets. Many includes were also cleaned up.
|