mirror of
https://github.com/nicbarker/clay.git
synced 2025-05-17 07:48:02 +00:00
Compare commits
4 Commits
c32391c047
...
41bc5cb1f7
Author | SHA1 | Date | |
---|---|---|---|
|
41bc5cb1f7 | ||
|
22e8cc318c | ||
|
8e6640f7a2 | ||
|
adc31f82e8 |
@ -4,7 +4,7 @@
|
||||
### Major Features
|
||||
- Microsecond layout performance
|
||||
- Flex-box like layout model for complex, responsive layouts including text wrapping, scrolling containers and aspect ratio scaling
|
||||
- Single ~2k LOC **clay.h** file with **zero** dependencies (including no standard library)
|
||||
- Single ~4k LOC **clay.h** file with **zero** dependencies (including no standard library)
|
||||
- Wasm support: compile with clang to a 15kb uncompressed **.wasm** file for use in the browser
|
||||
- Static arena based memory use with no malloc / free, and low total memory overhead (e.g. ~3.5mb for 8192 layout elements).
|
||||
- React-like nested declarative syntax
|
||||
|
@ -102,6 +102,7 @@ TextAlignment :: enum EnumBackingType {
|
||||
}
|
||||
|
||||
TextElementConfig :: struct {
|
||||
userData: rawptr,
|
||||
textColor: Color,
|
||||
fontId: u16,
|
||||
fontSize: u16,
|
||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -489,7 +489,7 @@ errorHandler :: proc "c" (errorData: clay.ErrorData) {
|
||||
}
|
||||
|
||||
main :: proc() {
|
||||
minMemorySize: u32 = clay.MinMemorySize()
|
||||
minMemorySize: c.size_t = cast(c.size_t)clay.MinMemorySize()
|
||||
memory := make([^]u8, minMemorySize)
|
||||
arena: clay.Arena = clay.CreateArenaWithCapacityAndMemory(minMemorySize, memory)
|
||||
clay.Initialize(arena, {cast(f32)raylib.GetScreenWidth(), cast(f32)raylib.GetScreenHeight()}, { handler = errorHandler })
|
||||
|
4
clay.h
4
clay.h
@ -357,6 +357,8 @@ typedef CLAY_PACKED_ENUM {
|
||||
|
||||
// Controls various functionality related to text elements.
|
||||
typedef struct {
|
||||
// A pointer that will be transparently passed through to the resulting render command.
|
||||
void *userData;
|
||||
// The RGBA color of the font to render, conventionally specified as 0-255.
|
||||
Clay_Color textColor;
|
||||
// An integer transparently passed to Clay_MeasureText to identify the font to use.
|
||||
@ -2692,7 +2694,7 @@ void Clay__CalculateFinalLayout(void) {
|
||||
.letterSpacing = textElementConfig->letterSpacing,
|
||||
.lineHeight = textElementConfig->lineHeight,
|
||||
}},
|
||||
.userData = sharedConfig->userData,
|
||||
.userData = textElementConfig->userData,
|
||||
.id = Clay__HashNumber(lineIndex, currentElement->id).id,
|
||||
.zIndex = root->zIndex,
|
||||
.commandType = CLAY_RENDER_COMMAND_TYPE_TEXT,
|
||||
|
@ -119,6 +119,7 @@
|
||||
{name: 'bottomRight', type: 'float'},
|
||||
]};
|
||||
let textConfigDefinition = { name: 'text', type: 'struct', members: [
|
||||
{ name: 'userData', type: 'uint32_t' },
|
||||
{ name: 'textColor', ...colorDefinition },
|
||||
{ name: 'fontId', type: 'uint16_t' },
|
||||
{ name: 'fontSize', type: 'uint16_t' },
|
||||
|
Binary file not shown.
@ -119,6 +119,7 @@
|
||||
{name: 'bottomRight', type: 'float'},
|
||||
]};
|
||||
let textConfigDefinition = { name: 'text', type: 'struct', members: [
|
||||
{ name: 'userData', type: 'uint32_t' },
|
||||
{ name: 'textColor', ...colorDefinition },
|
||||
{ name: 'fontId', type: 'uint16_t' },
|
||||
{ name: 'fontSize', type: 'uint16_t' },
|
||||
|
Loading…
Reference in New Issue
Block a user