summaryrefslogtreecommitdiff
path: root/src/gui
AgeCommit message (Collapse)AuthorFilesLines
6 daysGUI: Added Desktop skinHEADmasterThorbjørn Lindeijer1-10/+6
Replaces the default login wallpaper. The wallpaper can still be set either through branding or in the client data. This also fixes the scaling of the Manasource logo when using the Mana theme. Closes #99
7 daysFix gradient type text display being updated before slider value is read.Fedja Beader1-1/+1
This resulted in gradient type text lagging one step behind the actual type. This.. this bug was here for 14 years?! **** mana/verse!234
14 daysFixed issues related to wrong alpha mod set on texturesThorbjørn Lindeijer1-8/+0
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
14 daysAdded support for the hidden/neutral genderThorbjørn Lindeijer1-1/+3
TMWA supports a "neutral" gender, which in Mana client maps to "hidden". In The Mana World, it means a player character is not displayed as clearly male or female, using a dedicated base sprite with more underwear. It is not possible to choose the neutral gender on account registration or character creation. In TMW, these choices are not actually relevant anyway and could probably be removed. Fixes #114
2025-07-17Use layout system for Confirm and Ok dialogsThorbjørn Lindeijer4-72/+25
Fixes some issues with the manual layout.
2025-07-15Render font outlines using TTF_SetFontOutlineThorbjørn Lindeijer10-136/+197
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
2025-07-15Theme: Introduced HIGHLIGHT_TEXT colorThorbjørn Lindeijer6-8/+30
For customizing the text color used with HIGHLIGHT color as background.
2025-07-15Theme: Use TEXT color when rendering item amountsThorbjørn Lindeijer1-1/+1
Rather than hardcoded black.
2025-07-14Simplified cursor code using SDL_CreateRGBSurfaceWithFormatThorbjørn Lindeijer1-14/+2
2025-07-14Various small cleanupsThorbjørn Lindeijer2-2/+1
* Fixed doxygen comment on KeyFunction struct * Use SDL_BUTTON_LMASK instead of SDL_BUTTON(1) * Removed unused include
2025-07-14Fix quests window destruction and add QuestDB::initThorbjørn Lindeijer2-0/+3
The init call makes sure there are no quests loaded, which is necessary because `SettingsManager::unload` is only called on exit and not when switching servers. Closes #112
2025-07-11Make the screenshot file name a clickable linkThorbjørn Lindeijer1-0/+19
Some security checks are done because players might also write "screenshot:" in the chat to create file:// URLs and `SDL_OpenURL` can be used to open many things. So we disallow ".." and require a ".png" extension.
2025-07-11Cleaned up ImageRect a littleThorbjørn Lindeijer15-77/+38
* Use `std::unique_ptr`, so we can get rid of the custom move constructor and destructor. * Move and rename the `ImagePosition` enum to `WindowAlignment`, which fits better with what this enum is actually used for.
2025-07-08Jewelry: Adjusted color of highlighted tabThorbjørn Lindeijer1-3/+12
Seems this color just wasn't copied over correctly due to being on a different palette originally. Also made Tab::draw use the correct outline color. Addresses part of #98.
2025-07-06Add support for custom text colors for progress bars in GUI themeAndrew Hall1-1/+6
Since there was already specific support for theming different progress bars with a custom color gradient, it was relatively straight-forward to extend this to support custom text formats. Thanks to @Meway for having an initial go at this feature! Closes #111
2025-07-04Added logging priorities and use SDLs logging facilitiesThorbjørn Lindeijer17-46/+45
By using SDL logging, we can rely on SDL to filter the log messages by their priority before they get sent to our custom output function. For example, we now no longer get entries for created and destroyed Window instances by default, since these have only "debug" priority whereas the default priority for the "app" category is "info". We can also get log messages raised by SDL itself in our log now. Log levels can be controlled per category through the "SDL_LOGGING" environment variable. Many existing log messages have been assigned a category based on their existing prefix.
2025-07-02Added Quests windowThorbjørn Lindeijer6-16/+401
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.
2025-06-11Fixed the maximum size of the ShortcutWindowThorbjørn Lindeijer1-2/+5
It should be at least the minimum size. This was not the case when there were no emotes provided by the server (as for Source of Tales currently). Issue manifested itself as `std::clamp` assert in debug builds, and probably undefined but harmless behavior in release builds.
2025-05-25Fixed tooltip visibility logic for shortcut and inventory windowsThorbjørn Lindeijer3-25/+39
* When hovering an empty box in the shortcut window, the tooltip of a previously hovered non-empty box would stay visible. * When hovering to the right of a row of inventory items, the tooltip for the left-most item on the next row would be displayed. Also added some padding to shift the text and item icon a little in the shortcut window when using the Jewelry theme.
2025-05-12Fixed handling of "close2" script commandThorbjørn Lindeijer1-28/+10
When adding support for SMSG_NPC_COMMAND in d5ebad4e74da011777f9ba1a13f, I mistakenly assumed the "close dialog" (5) command should just close the NPC dialog. However, the client is expected to send CMSG_NPC_CLOSE as well. Closes #91 Closes #107 Closes #108
2025-05-01Fixed loading of servers saved in client configThorbjørn Lindeijer1-5/+0
This was broken by 79e4325192f3260ed4ded264e43da8429650bf72 due to there being a case difference between the serverTypeToString and parseType functions, causing loaded servers to be invalid due to unknown server type. Closes #105
2025-04-29Some Inventory and TradeWindow cleanupsThorbjørn Lindeijer3-23/+11
Mainly using std::vector<std::unique_ptr<Item>> to automate memory management.
2025-04-29Fixed compile with ENABLE_MANASERV=OFFThorbjørn Lindeijer2-3/+3
2025-04-28GUI: Removed fixed width for ItemAmountWindowThorbjørn Lindeijer1-1/+1
The window needs to be slightly larger on Jewelry theme. By not specifying a width, the layout will take care of this.
2025-04-28GUI: Added skin for the emote slots in the EmotePopupThorbjørn Lindeijer2-29/+26
Allows more flexible customization as needed by Jewelry theme.
2025-04-28GUI: Use theme icons for offline/online player indicatorsThorbjørn Lindeijer2-34/+24
Instead of loading images directly, which is less flexible. In Jewelry theme, these icons are embedded in the window.png image.
2025-04-26GUI: Added support for explicit outline color per palette entryThorbjørn Lindeijer11-55/+153
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.
2025-04-25GUI: Added support for multiple color palettes to ThemeThorbjørn Lindeijer26-314/+253
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.
2025-04-25Introduced theme dropdown in interface setupThorbjørn Lindeijer8-55/+115
* Added Theme dropdown to Interface setup * Added CARET theme color * Fixed issue with logging errors in `check` function in `theme.cpp` * Fixed XML::Children::Iterator to iterate only element nodes * Changed default theme to "jewelry" Changing the theme (or font size) shows a dialog that points out a restart is required to apply these changes. This is necessary at the moment because many things, like default or minimum window sizes, are only calculated once.
2025-04-25GUI: Added support for hiding the scroll area buttonsThorbjørn Lindeijer2-9/+138
And made the Jewelry theme hide those buttons.
2025-04-25GUI: Added support for fixed-size scrollarea markersThorbjørn Lindeijer2-7/+338
Due to getVerticalMarkerDimension and getHorizontalMarkerDimension not being virtual, this unfortunately required copying a lot of code from Guichan to make sure it calls our versions of these functions. Also addressed a small issue where gcn::ScrollArea::checkPolicies was not taking the frame size of the content into account.
2025-04-25Jewelry: Fixed sticky button positionThorbjørn Lindeijer1-18/+18
Used "spacing" to store the additional space between the sticky button and the edge of the window (or the close button). Adjusted Popup and ToolWindow skins by one pixel to make the sticky button align the same way as for the Window skin.
2025-04-25GUI: Added support for defining named icons to the themeThorbjørn Lindeijer3-68/+31
Now we can define icon names for each equipment box and then look up the icon image through the theme, enabling some shared control over equipment slot icons between the game data and GUI theme. The icon for an equipment slot is also no longer rendered when the slot has an item in it. Removed the needless storing of equipment box positions and images in the EquipmentWindow, because this information is readily available from the InventoryHandler and the images are already loaded by the Theme.
2025-04-25GUI: Allow theme to skin item slots and equipment boxesThorbjørn Lindeijer9-89/+81
* Added EquipmentBox and ItemSlot skin types. * Allowed rectangles drawn by the theme to be not filled. * Added width/height attributes to skin element since we needed a way to specify the size of the item slots and equipment boxes.
2025-04-25GUI: Allow customizing the SkinType used by a WindowThorbjørn Lindeijer5-13/+32
Now different windows can use different skin types. This also introduces a new ToolWindow skin type, which is generally a window without title bar nor close button. Customized windows are: * Chat -> Popup skin * MiniMap -> Popup skin * ShortcutWindow (items and emotes) -> ToolWindow skin Even though the MiniMap now appears as a Popup, it does have a title, so appropriate attributes have been added to this skin type.
2025-04-02Use a consistent naming style for enum class valuesThorbjørn Lindeijer17-102/+103
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.
2025-04-02General code cleanupsThorbjørn Lindeijer15-166/+76
* 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.
2025-04-02Fixed minimum width of the Social windowThorbjørn Lindeijer3-10/+25
Needs to allow space for all three buttons, especially since they are no longer clipped to the window.
2025-04-01Fixed crash on exit when CharCreateDialog is openThorbjørn Lindeijer1-1/+2
* Displayed Being was deleting its SpeechBubble after the WindowContainer had already deleted it. Resolved by registering a DeathListener. * On dialog deletion, the CharHandler had become a roaming pointer but was still accessed.
2025-04-01GUI: Made CheckBox, RadioButton and Slider more customizableThorbjørn Lindeijer12-72/+87
Added handling of padding and text format and added new "spacing" skin variable which is used for the space between the label and the control in case of CheckBox and RadioButton. Small tweaks to UI layout in various places.
2025-03-31Use color modulation to render text in different colorsThorbjørn Lindeijer1-19/+6
No need to cache the image in different colors since color modulation is cheap these days.
2025-03-31GUI: Support customizing widget text format through themeThorbjørn Lindeijer6-39/+138
The following widgets now support setting the font, text color, outline color and shadow color through the theme: * Button * Tab * Window (title) * ProgressBar The text format can be specified differently per skin state.
2025-03-31GUI: De-hardcode the window title offsetsThorbjørn Lindeijer2-9/+14
2025-03-31GUI: Apply clipping only where necessaryThorbjørn Lindeijer7-60/+65
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.
2025-03-24Expanded GUI theming capabilitiesThorbjørn Lindeijer34-305/+451
* Moved previously hardcoded values for frame size, padding and title bar height to the Skin. * Added support for rendering colored rectangles (used for scroll bar background). * Scroll bar width is now determined by its skin. * Added separate skins for horizontal and vertical scroll bars and horizontal and vertical scroll markers and added a skin for the shortcut box. * Added support for hovered state on window close button.
2025-03-24Define the GUI theme in XMLThorbjørn Lindeijer16-175/+186
Now all images used by the various UI widgets are defined in a `theme.xml`, removing hardcoded requirements on the size of images, borders and sub-images and their locations. The `colors.xml` file was merged into this new file as well. The `<img>` element defines either a plain image, or a 9-scale that is automatically rendered at the size of the widget when any of the `left`, `right`, `top` or `bottom` attributes are given. The `x`, `y`, `width` and `height` attributes determine the sub-rectangle within the image referenced by `src`. `x` and `y` default to 0 and `width` and `height` default to the imge size. The `<state>` element defines in which state its images are used by setting its `selected`, `disabled`, `hovered` or `focused` attributes to either `true` or `false`. Only the first matching state is rendered. The `Text` and `SpeechBubble` classes now use the same skin to draw the bubble, as well as using a newly introduced `BUBBLE_TEXT` color from the theme palette.
2025-03-17Have ImageRect automatically initialize and clean upThorbjørn Lindeijer2-4/+0
2025-03-17Don't call static ResourceManager methods through instanceThorbjørn Lindeijer1-5/+3
2025-03-14Moved widget drawing code into ThemeThorbjørn Lindeijer35-1273/+198
This is cleaner overall since now each widget type no longer needs to keep track of its own instances and updating of the GUI alpha. It also introduces a single point from where the GUI theme support can be enhanced. Theme is no longer a singleton, though for now there is a single instance owned by the Gui singleton. Widgets adjusted to delegate their painting to the Theme: * Button * Tab * TextField * CheckBox * RadioButton * Slider * DropDown * ProgressBar * ScrollArea * ResizeGrip * PlayerBox (by subclassing ScrollArea) The Window and Popup widgets already use the theme through the Skin class. They can actually use a different skin per instance, though this feature is only used by the SpeechBubble.
2025-03-13Removed needless case-insensitive string comparisonsThorbjørn Lindeijer1-1/+1
These are not necessary since we can instead make sure the referenced values match case, like we do for everything else. This affects server types in the server list and colors referenced in theme files. The server version was also compared case-insensitively for some reason.