Commit Graph

147 Commits

Author SHA1 Message Date
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
Tommy
9af1251540 Update high-DPI font handling to reside entirely in font/text.cpp.
It is now transparent to the user.

The meaning of sdl::texture.w() and .h() have changed. These now
return the intended width and height of the texture in draw-space,
rather than the real width and height. To get the real width and
height, use texture::get_info().
2022-06-14 14:44:11 +12:00
Tommy
0d30c9d7c3 Fix text positioning when clipped to a viewport.
Should fix the lua console, and the credits screen.
2022-06-11 15:37:03 +12:00
Tommy
f183978071 Some small rendering fixes.
* halo background draw fixed
* tiled images clip correctly
* new interface/setter for reducing clipping area.
2022-06-01 00:35:53 +12:00
Tommy
743a1b5655 Implement a mirror mode for tiling textures.
It mirrors such that tiles always share a common edge.

This isn't currently used for anything, simply included for completeness.
2022-05-31 21:17:33 +12:00
Tommy
638c02b59e Rename image_shape.vertical_mirror_ to mirror_.
It is in fact (and always was) mirroring horizontally.
2022-05-31 21:17:33 +12:00
Tommy
e94291b2dc Fix canvas blits. 2022-05-31 21:17:33 +12:00
Tommy
881abd1123 Move circle drawing code to draw.cpp. 2022-05-31 21:17:33 +12:00
Tommy
96bc7d6046 Consolidate drawing functions in new "draw" namespace.
Contains primitive drawing functions, such as fill, points, line, etc,
and also texture drawing functions blit, flipped, tiled.

This removes specialty drawing code from several places, most notably
CVideo and gui/core/canvas.

Functions to draw to the screen should now go in draw.cpp.
2022-05-31 21:17:33 +12:00
Tommy
3bc0defdce image: deprecate get_image for new explicit get_surface and get_texture.
Places where usage is clear have been converted to the new calls.
Places that need extra work to convert are still using get_image(),
as are places that will be clobbered as part of general rendering
system upgrades anyway.
2022-05-31 21:17:33 +12:00
Tommy
f808039fb3 sdl::texture: cache texture width and height for easy access. 2022-05-31 21:17:33 +12:00