Commit Graph

157 Commits

Author SHA1 Message Date
Subhraman Sarkar
bd6f250c12
canvas: draw circle using cairo (#10007)
the circle is now antialiased using cairo.
2025-03-10 16:04:49 -04:00
Charles Dang
101dff854e GUI2/Canvas: use config::attribute_value for text
For some reason, if we store a t_string in the class and attempt to parse it later, it breaks text boxes (text will be there but not render) (see #9995). Using an std::string does not have that problem. I don't know why.

I considered a variant<typed_formula, t_string>, but since attribute_value is a variant under the hood, it seemed simpler to just use it directly. If that turns out to be a performance hit, we can deal with that later...

Closes #10001
2025-03-06 12:45:00 -05:00
Subhraman Sarkar
e1e7e2c0b9 canvas: keep a verbatim copy of text_ (closes #9995)
For some reason doing it all in `draw()` causes #9995.
2025-03-06 19:34:15 +05:30
Subhraman Sarkar
c9cbc9a793 canvas: simplify verbatim parsing of text 2025-03-03 20:17:27 +05:30
Charles Dang
b10d6cdf49 GUI2/Canvas: avoid saving config copy
- We now store the attribute list as a class member which is populated in the ctor.
- parse_text_as_formula = false will use a custom formula to resolve the value as a string.
2025-02-21 01:53:52 -05:00
pentarctagon
d674e9f462 automatic copyright update 2025-02-17 12:59:51 -06:00
Charles Dang
67c7c4bb10 GUI2/Canvas: clean up some remnants of old attribute handling 2025-02-15 02:47:38 -05:00
Charles Dang
99ee4a7703
Split text attribute handling into its own API (#9890) 2025-02-15 00:33:46 -05:00
Charles Dang
96f8e7604f GUI2/Canvas: accept the standard values for the family/face attribute
Ie, "script", "monospace", etc, instead of a specific font name.
2025-02-09 23:57:06 -05:00
Subhraman Sarkar
43b4d57009 canvas: add parse_text_as_formula key to [text]
This key toggles parsing of `text` key as formula or not. Default: true.
2025-02-03 07:25:41 +05:30
Subhraman Sarkar
aa625dafef canvas: fix semicolon in error message 2025-01-13 12:24:16 +05:30
Subhraman Sarkar
b077789251 canvas: improve error message in image_shape
the message now makes it obvious the 'name' key is faulty and covers the case where it is empty. Originally, it only notified that the formula was invalid.
2025-01-13 12:22:54 +05:30
Charles Dang
cb4d8a8dff Deploy utils::erase_if 2024-10-25 04:03:23 -04:00
Charles Dang
491c236113 Config: deploy all_children_view en-mass 2024-10-16 09:36:59 -04:00
Charles Dang
29191627fa
Rect: add padded_by, point_at, and subrect (#9465) 2024-10-15 23:42:16 -04:00
Charles Dang
56cc3aee0f
Config: remove implicit conversion to int and bool (#9444)
Resolves #9009, closes #9384. Besides the issues that came from having both int and bool conversions (even with bool marked explicit), it doesn't make sense to use int for all numeric assignments. I didn't test whether it would be an issue in practice, but it seems better to let callers be explicit about what type they want for numeric values than risking overflow or wrapping for very large values.
2024-10-09 01:36:10 -04:00
Wedge009
558650bd14 Typography update for source code (in addition to .cfg data files previously reviewed). 2024-10-06 09:13:10 +11:00
Charles Dang
95c9f0c720
Config: use structured bindings with all_children_range (#9387) 2024-09-27 02:49:57 -04:00
Subhraman Sarkar
cfe4924b5e canvas: remove unnecessary variables and attr["name"] -> name 2024-09-23 19:49:44 -04:00
Subhraman Sarkar
ae8d107c65 add default font size to canvas 2024-09-23 19:49:44 -04:00
Subhraman Sarkar
8bca642854 refactor attribute system and rename set_highlight_area 2024-09-23 19:49:44 -04:00
Charles Dang
457ed4bb43
Conduct surface manipulation in-place when possible (#9218) 2024-08-17 20:22:44 -04:00
Subhraman Sarkar
43f5644e36
Rich Text Label widget for Help Browser GUI2 port (#8655)
A rich text label widget that can show text marked up with help markup.
Also includes the GUI Test Window, accessible in the title screen after launching wesnoth using --clock option. It can be used as dialog template/example or as a place to test GUI2 code.
2024-06-06 16:33:37 +05:30
Subhraman Sarkar
9b38089db0
Story screen redesign (#8510) 2024-05-24 19:29:46 +05:30
Charles Dang
08fc993c16 GUI2/Canvas: allow text shape to set outline (resolves #8398) 2024-02-24 18:30:33 -05:00
Subhraman Sarkar
6c5a8e923d
Spinner and multiline textbox widgets (#8199) 2024-02-13 11:54:34 -06:00
pentarctagon
970163813d 2024 copyright update 2024-01-20 22:22:23 -06:00
gfgtdf
9f66b1e8ff Don't assert on config input.
assert() is not a good way to handle incorrect user input,
It is a debugging tool that should only be used for
conditions that the program guarantees to be true
(unless there a is a bug in the c++ code).
2023-12-13 17:01:28 +01:00
Tommy
5a4271ea98 Regenerate blur effects if canvas screen location has changed.
This should catch most cases of moving or resizing blurred windows.
2023-11-23 12:30:35 +13:00
Tommy
ca5edd5336 Regenerate story screen message panel blur when background changes. 2023-10-30 12:28:14 +13:00
Tommy
7695ee7159 Enable multi-pass rendering.
An extra rendering pass can be requested during render or expose
by calling draw_manager::request_extra_render_pass().
This is used for blur effects.
2023-10-30 12:28:14 +13:00
Tommy
766cfe8201 Implement deferred rendering for blurrables.
UI elements with blur effects (such as translucent windows) now defer
rendering for one frame, so they can snapshot the area underneath
for blurring.

In the future this should be done as multiple passes in one frame,
but for now this is fine.
2023-10-28 12:13:33 +13:00
Pentarctagon
c44cc2742e Copyright update.. 2023-04-29 10:48:11 -05:00
Charles Dang
ca366554a0 GUI2/Canvas: default to NN scaling for images if not specified 2022-08-20 20:53:22 -04:00
Tommy
29c82e308a CVideo: Remove CVideo singleton, replacing with "video" interface
The only real change is that in stead of passing around CVideo
pointers and calling things via CVideo::get_singleton().foo()
one simply does not pass around pointers, and calls video::foo().
2022-07-24 22:06:33 +12:00
Tommy
3835f9580b Fix some poor indentation, and tidy some TODOs 2022-07-22 15:07:59 +12:00
Tommy
ba24612f73 Remove trailing newlines from multiline log messages 2022-07-20 15:20:57 +12:00
Tommy
a02709e0ff Remove \n from log lines with it as suffix on the final string 2022-07-20 15:20:57 +12:00
Tommy
1c25ebdfa2 Remove std::endl from log lines, now that it's added automatically 2022-07-20 15:20:57 +12:00
Tommy
2931615cdf Ported over the text texture cache from new_rendering
Squashed from new_rendering:
 * Ported over the basic text texture cache
 * Font/Text: fixed bad hashing leading to duplicate textures
 * Use text texture drawing method instead of surface one
 * Cleaned up and optimized pango_text rendering pipeline
 * Font/Text: removed get_width and get_height in favor of just get_size
 * Font/Text: guard against caching a null texture

This breaks the credits screen. The game will crash when it tries to
display it.
2022-07-13 13:34:01 +12:00
Tommy
91e6ee91db draw: add fill overloads for filling the entire render target 2022-07-05 18:43:42 +12:00
Tommy
96703ca242 Replace sdl::intersect_rects with new rect::intersect and rect::clip
rect::intersect returns the constructed intersection, whereas
rect::clip modifies the rectangle.
2022-07-02 12:30:58 +12:00
Tommy
f0e4d3673f sdl/rect: Add scalar multiplication and division operators
Mostly useful for simplifying pixel scale conversions.
2022-07-02 12:30:58 +12:00
Tommy
e44129fb91 Address some slightly less straightforward TODOs 2022-07-01 15:06:25 +12:00
Tommy
132a45c52f sdl/rect: Move fill_surface_rect to sdl/utils.hpp
And then have to clean up over a dozen files that were relying on
sdl/rect.hpp including sdl/utils.hpp and various other side effects.
2022-06-29 13:13:15 +12:00
Charles Dang
7f1bc41162 GUI2/Canvas: removed unused image_shape members 2022-06-28 20:14:47 +12:00
Tommy
8efd9d43f2 GUI2: Port over most of the canvas cleanup
Text is still drawing clipped because otherwise Credits crashes. It has
bugs because the viewport is too large, but at least it doesn't crash.
2022-06-28 20:14:47 +12:00
Charles Dang
43a1ecc8bd CVideo: minor cleanup
- Removed overload of set_resolution taking two ints
- Removed get_width and get_height in favor of draw_area
- Removed some dead code
- Minor formatting cleanup
2022-06-14 14:48:34 +12:00
Tommy
ebcae03e48 Add a new image tiling mode: "tile_highres" for high-DPI tiled images.
The other options "tile" and "tile_center" work in draw space,
which is consistent with past behaviour, but doesn't look as nice.
2022-06-14 14:48:03 +12:00
Tommy
352236a094 Correctly handle images with resize_mode of scale or stretch.
Correctly meaning using linear filtering in stead of none.
2022-06-14 14:47:54 +12:00