Commit Graph
52 Commits
Author SHA1 Message Date
Walter Agazzi 6efd1cc41e AGS: Common: calculate real TTF glyphs extent, fix fonts cut from the top
This is an attempt to fix certain fonts getting "cut off" from the top when
being drawn on a limited size texture or bitmap.

The reason for such behavior is that fonts may include glyphs which
topmost extent is higher than the reported "ascender".
In this case the engine simply does not know that glyphs may be drawn
higher, and the prepared texture is not accommodated for that.

How we fix this:
1. Following a caller's instruction (a new flag ALFONT_FLG_PRECALC_MAX_CBOX),
alfont preloads all glyphs one by one and records the maximal extents of their "control boxes".
These values are saved and returned on demand.
2. Our FontMetrics struct has a new VExtent field, that keeps these values (converted to top-down
 Y axis) for the reference.
3. get_font_surface_height() now returns a surface height calculated from these extent values.
4. CalcFontGraphicalVExtent() now uses the extent values when telling how the text will be
graphically positioned, relative to the requested "text position".

From upstream ec362d744f7e7c0630d68a92219f2129fec7ab3d
2024-10-30 18:07:42 +02:00
Walter Agazzi eac87601c4 AGS: Common: fix couple of GUI functions that may fail when restoring a save
+ add workaround for Kathy Rain

From upstream b2859f93136cecc800e3b5cf30b09ad8f91fd0e2
2024-10-30 18:07:42 +02:00
Walter Agazzi 822842d038 AGS: Engine, Common: refactor guard using set_our_eip
Remove naked our_eip usages
From upstream 9f4371ab8c2fbc9ccf41b49f7b975ebe8bc5d1b8
2024-10-30 18:07:42 +02:00
Walter Agazzi 528a0a333f AGS: Engine: consistently reset "mouse-over" when GUI interact state changes
From upstream 39147657c363d59ebfc9f9cb865ace0a38c95b90
2024-10-30 18:07:42 +02:00
Walter Agazzi b52fe376d1 AGS: Common: inlined several getters in GUIMain and GUIObject
From upstream 121a989b407542763553123f2a5a5fbd11b09e27
2024-10-30 18:07:42 +02:00
Walter Agazzi bd1bf59315 AGS: Common: hide GUIObject's size behind the get/set methods
From upstream ca442e0f9259d74a2bc6ccd7d28e59381ac1b9d1
2024-10-30 18:07:42 +02:00
Walter Agazzi 90f94f74c0 AGS: Engine: reduced spriteset's [] operator use where possible
The spriteset's [] operator loads a sprite, but some operations may
 omit that and check the preloaded information instead.
This also makes it more certain where the actual sprite's bitmap is necessary.
From upstream df30fc1edd30d4f334addaf7883286e745dea2c3
2024-10-30 18:07:42 +02:00
Le Philousophe 49b4c1b3c4 AGS: Revert to use std namespace
This allows to minimize changes from upstream
2024-07-08 21:37:28 +02:00
Paul Gilbert c2a476411c AGS: Move std namespace into common/std/ 2024-07-07 15:28:31 -07:00
Walter Agazzi bcf5ebaae5 AGS: Common: account Font's YOffset when calculating GUI's graphical rect
This fixes fonts with a custom VerticalOffset set getting unexpectedly clipped by a control's texture. Fixes Button and Label controls.
From upstream 02b15886d09b1025ac051bc8adfd6c3e5e7cd171
2024-01-17 03:12:28 +01:00
Walter Agazzi 3cc56da41c Revert "AGS: Engine: don't Poll non-clickable GUIs"
This reverts commit c3589db569,
which breaks GUI functions in Kathy Rain
2023-11-02 20:06:26 +01:00
Walter Agazzi c3589db569 AGS: Engine: don't Poll non-clickable GUIs
From upstream 95a2ef2c0d6a4c04e3985d78920bfc4a70a641c0
2023-09-23 17:10:08 +02:00
Walter Agazzi ae30f78761 AGS: Engine: support mismatching GUI numbers in legacy saves
From upstream 9d2fa2c26dda45fa53141a625c71ec63601cd9e2
2023-09-16 13:32:58 +02:00
Walter Agazzi 6b214f0477 AGS: Engine: fixed Buttons with invitem pic not redrawn on ActiveInventory
From upstream 37127b81ea4c006f8f79f11df746c24e4039f0ba
2023-08-13 10:58:26 +02:00
Walter Agazzi 953356c758 AGS: Common: call OnMouseLeave on focused control in ResetOverControl()
From upstream b8de51fedf0318e8243e1fc3872c61f366a23144
2023-03-12 20:58:28 +00:00
Walter Agazzi 91d7299405 AGS: Engine: (again) fixed buttons not updated visually on interface enable
Complements / reimplements f310a08
From upstream b0e2fe40c1d73674a7b868a87152be6029df6cac
2023-03-12 20:58:28 +00:00
Thierry Crozat fa87b3f28f AGS: force update gui metrics on load and on game start
This fixes some controls not reporting their metrics correctly until first displayed on screen.

From upstream ea4e6762236a13621ba0771b9d5d8ac4bcf33ee8
2022-10-09 19:12:22 +01:00
Thierry Crozat 0c936b888d AGS: Fixed GUI textual controls not redrawn when translation changes
From upstream 618d2e38a118f47389aaf7e57972b2520b81fc1b
2022-06-21 23:28:01 +01:00
Paul Gilbert 1933841f79 AGS: Removed numgui* variables, use size of vectors instead
From upstream 095cf9d77c96fb3a1f9e887d7aaa1ef1e92ebe60
2022-05-10 21:35:19 -07:00
Paul Gilbert 706766f4b5 AGS: Guimain tidy-up
From upstream fd656469bc71385ffd9da50ad0315641cd5f6d22
2022-05-10 21:18:00 -07:00
Paul Gilbert a8ead540c5 AGS: GUIControl::CalcGraphicRect returns relative rect
From upstream f827c75396f433542b451ec4caaea4c41c22e5b2
2022-05-05 22:41:08 -07:00
Paul Gilbert d9da1e3759 AGS: Don't try rendering gui controls with zero size
From upstream 84179aecc419cc8feb56b947bb7519e69062fe70
2022-05-01 17:23:25 -07:00
Paul Gilbert 3b20393a17 AGS: Implemented gui control transparency in software mode
From upstream bcffc2cdeb24a426e2b048e8a98df9c84cb7c6f2
2022-05-01 17:23:23 -07:00
Paul Gilbert d8d593079a AGS: Don't MarkChanged guis changing Transparency or Visible flag
From upstream d4deb499893109a54ed7e011af22d2619c432549
2022-05-01 17:23:22 -07:00
Paul Gilbert 50b2b1af05 AGS: Replaced OnControlPositionChanged() with MarkControlsChanged()
From upstream 2f676fbad2b725fe0089de45ba9f925bc48ab586
2022-05-01 17:23:21 -07:00
Paul Gilbert a476850123 AGS: Calculate visible graphic size of gui controls for textures
From upstream a91bec5f3fa7f37187a084cabd0ab2289e609a6e
2022-05-01 17:23:19 -07:00
Paul Gilbert 2df62bdd55 AGS: Only redraw gui controls when they are marked as changed
From upstream 27a6bd6a13494cd670fb6749e5bd663f088487ea
2022-05-01 17:23:19 -07:00
Paul Gilbert c768b94cf6 AGS: Draw GUI Controls on separate textures
From upstream 5cbe36626842ddd900cbda8fd4b6ddfc3804456f
2022-04-29 22:20:41 -07:00
Paul Gilbert 62ebde86a1 AGS: Gui controls draw themselves at requested offset
From upstream 9e9c8ffafe465b907ed0d22bcb1ba4df06803b8b
2022-04-29 22:20:40 -07:00
Paul Gilbert 673c8c242e AGS: Split GUIMain::DrawAt into DrawSelf and DrawWithControls
From upstream d353f8151d77c1c9e66f8b1aed7b24ecbadf0609
2022-04-29 22:20:40 -07:00
Paul Gilbert 939d116fba AGS: Fixed GUIMain::Poll(), only affect clickable controls
From upstream 951e65274cd578b25436526dc12cc51ac5e20150
2022-04-29 22:20:40 -07:00
Paul Gilbert 250190e997 AGS: Fixing various type-cast warnings
From upstream 82e89d3c3dccfa0aba0b18c1aa544130ac7e6902
2022-04-25 18:47:12 -07:00
Le Philousophe 00876a1092 AGS: Fix int vs. int32_t discrepancies 2022-04-24 21:12:17 +02:00
Paul Gilbert 3467180e39 AGS: Refactored GUIMain to not use mouse coords directly
From upstream 2f736d3365dc5fae6eebe353b64e16af156308f8
2022-04-23 17:56:20 -07:00
Paul Gilbert 0e283a9a87 AGS: Removed guis list param from ResortGUI (useless)
From upstream fcb6c37e27be324a122be92fc28b8b36ad80bde9
2022-04-22 21:30:23 -07:00
Paul Gilbert 7dab6a4964 AGS: Exclude Sliders from clipping GUI controls rule
From upstream fd8976b09e821b015b8d267531c2bce659d95d13
2022-04-22 21:21:46 -07:00
Paul Gilbert 623e895971 AGS: Changed text alignment switches to use kGameVersion_360_21
From upstream 0948e6be65b46df8bd4b183f77655375d6a06e95
2022-04-22 21:01:38 -07:00
Paul Gilbert f2f80939ad AGS: Don't do text's v-alignment hack in the new games (> 3.6.0)
From upstream ed971d2c5d289db6df31e2a2214771bcb162e5ca
2022-04-22 20:57:16 -07:00
Paul Gilbert 62574f8eda AGS: Use outlined width/height when arranging text on GUI
From upstream 8fd4b1b55dc08949e70d295afb4be91d1a26da5c
2022-04-22 20:54:00 -07:00
Paul Gilbert e4a6bd71f6 AGS: Option to clip GUI Controls' contents to their rect
From upstream 6c2612eb087924255a04d2da1dc1d5c8559d28b3
2022-04-10 19:39:06 -07:00
Paul Gilbert 3425f8faf2 AGS: Moved couple of gui-related global vars into GuiOptions struct
From upstream 973d238a2c20368d8932ade22d2965d121cb7793
2022-04-10 19:39:06 -07:00
Paul Gilbert 662e9794ad AGS: Remove excessive validity checks in stream classes
From upstream 3ed254586a28e2f8ebe0e81b7a44270f3736efd6
2022-04-08 22:17:52 -07:00
Paul Gilbert af203d0da5 AGS: Removed guis list param from GUI:ReadGUI and WriteGUI (useless)
From upstream 08c64d187b56e042e2d09f11f76ebb5db6d3007c
2022-04-08 22:17:52 -07:00
Paul Gilbert df29806aec AGS: Replaced the remaining wgettextheight() with get_font_height()
From upstream d9c4a0306a6718cb03ccd6e84c1e63d093d9a64a
2022-03-22 22:30:13 -07:00
Paul Gilbert dc3ce9f70a AGS: Renamed few font functions for consistent naming style
From upstream 9c355da410b734edc79212009a5e1be0b502c3b0
2022-03-22 22:30:13 -07:00
D G Turner 6d7663b1b1 AGS: Fix Redundant Declaration Warnings
These are emitted by GCC when -Wredundant-decls is passed.
2022-03-09 15:28:19 +00:00
antoniou79 4505b60ef8 AGS: Fix for transparency test being unintentionally in 3.5.0
Resolves bug #13251 for Zniw GUI language selection screen being non-interactable

The fix is from AGS' github repository commit: https://github.com/adventuregamestudio/ags/commit/a087584a26106d2fb6a17c13b0cb3f6857f4cbed
by @ivan-mogilko on 26 Dec, 2021.
2022-02-15 22:52:24 +00:00
Eugene Sandulenko abea37c9bb ALL: Update ScummVM project license to GPLv3+ 2021-12-26 18:48:43 +01:00
Paul Gilbert 6a8f1f9a71 AGS: More accurate notification of GUI control changes for redrawing
From upstream fd7cb8dc822e50cc485aa0dfc937217ead1cb996
2021-08-20 21:49:38 -07:00
Paul Gilbert db783e1734 AGS: Mark GUI for redraw when a plugin font is set
From upstream dfb82a2e36ea16e21a557afd9dffdbd7035ca527
2021-08-20 21:49:38 -07:00