v0.11
版本发布时间: 2024-09-18 07:55:32
nicbarker/clay最新发布版本:v0.12(2024-10-23 07:44:07)
Clay 0.11
Changelog
-
New Feature: Visual Debug Tools. Similar to the inspector in Chrome or Firefox. Browse your layout hierarchy, inspect bounding boxes and config, and view any warnings output during layout. To activate the debug tools, call the new function
Clay_SetDebugModeEnabled
. See the README for more details.
- New Feature: Text Wrap Modes. A new feature of TEXT_CONFIG, this allows you to choose between three modes:
-
CLAY_TEXT_WRAP_WORDS
- Text will wrap on whitespace characters as container width shrinks. -
CLAY_TEXT_WRAP_NEWLINES
- Text will only wrap when encountering newline characters -
CLAY_TEXT_WRAP_NONE
- Text will never wrap even if its container is compressed beyond the text measured width.
I am considering a wrap mode which will wrap on individual characters in future but haven't decided on an implementation yet.
- Improved performance of text layout when wrap is disabled or no wrapping needs to occur.
- Fixed a bug that occurred when multiple nested floating containers were used.
- Fixed a bug where the text measurement cache would not be used correctly.
- Fixed a bug in the HTML renderer where text could be measured and cached before custom fonts had loaded.
- Fixed a bug in the HTML renderer where alpha wasn't correctly respected.
Upgrade Guide
Unfortunately, this release contains some small breaking changes to the public API.
While I do my best to avoid breaking changes, Clay is still in alpha and the API is subject to change.
- Element's
uint32_t id
has changed to a struct,Clay_ElementId
.CLAY_ID
andCLAY_IDI
now return this struct, so layout definitions that use macros should not require migration. There are several cases where you might need to change the type of variables.
// Before
uint32_t id = CLAY_ID("Button");
// After
Clay_ElementId id = CLAY_ID("Button");
While functions that previously took uint32_t id
as an argument have been updated, the parentId
field of CLAY_FLOATING_CONFIG is still uint32_t
. You can access the .id
field of the Clay_ElementId
struct in this case:
CLAY_FLOATING_CONTAINER(CLAY_ID("ScrollBar"), CLAY_LAYOUT(), CLAY_FLOATING_CONFIG(.parentId = CLAY_ID("OuterScrollContainer").id), {
-
Clay_BeginLayout
andClay_EndLayout
now take no arguments, and there is a seperate functionClay_SetLayoutDimensions
which is used to update the layout dimensions before the current frame. See the README for more details. -
Clay_Initialize
now expectsClay_Dimensions
to set the initial layout dimensions. See the README for more details. -
Clay_SetPointerPosition
has been renamed toClay_SetPointerState
, and now expects a second argumentisPointerDown
representing whether or not the main mouse button / touch is currently held down.
1、 clay-odin.zip 333.79KB
2、 clay.h 187.23KB