mirror of
https://github.com/nicbarker/clay.git
synced 2025-04-18 12:18:03 +00:00
Merge 87ab6402f3
into 08033b03cb
This commit is contained in:
commit
00295c0bdf
81
clay.h
81
clay.h
@ -393,6 +393,14 @@ typedef struct
|
||||
bool found;
|
||||
} Clay_ScrollContainerData;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
Clay_BoundingBox elementLocation;
|
||||
|
||||
// Indicates whether an actual Element matched the provided ID or if the default struct was returned.
|
||||
bool found;
|
||||
} Clay_ElementLocationData;
|
||||
|
||||
typedef enum {
|
||||
CLAY_RENDER_COMMAND_TYPE_NONE,
|
||||
CLAY_RENDER_COMMAND_TYPE_RECTANGLE,
|
||||
@ -479,6 +487,7 @@ void Clay_SetDebugModeEnabled(bool enabled);
|
||||
void Clay_SetCullingEnabled(bool enabled);
|
||||
void Clay_SetMaxElementCount(uint32_t maxElementCount);
|
||||
void Clay_SetMaxMeasureTextCacheWordCount(uint32_t maxMeasureTextCacheWordCount);
|
||||
Clay_ElementLocationData Clay_GetElementLocationData (Clay_ElementId id);
|
||||
|
||||
// Internal API functions required by macros
|
||||
void Clay__OpenElement();
|
||||
@ -499,6 +508,35 @@ Clay_ElementId Clay__HashString(Clay_String key, uint32_t offset, uint32_t seed)
|
||||
void Clay__Noop();
|
||||
void Clay__OpenTextElement(Clay_String text, Clay_TextElementConfig *textConfig);
|
||||
|
||||
typedef struct Clay_LayoutElement Clay_LayoutElement;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
Clay_LayoutElement *layoutElement;
|
||||
Clay_BoundingBox boundingBox;
|
||||
Clay_Dimensions contentSize;
|
||||
Clay_Vector2 scrollOrigin;
|
||||
Clay_Vector2 pointerOrigin;
|
||||
Clay_Vector2 scrollMomentum;
|
||||
Clay_Vector2 scrollPosition;
|
||||
Clay_Vector2 previousDelta;
|
||||
float momentumTime;
|
||||
uint32_t elementId;
|
||||
bool openThisFrame;
|
||||
bool pointerScrollActive;
|
||||
} Clay__ScrollContainerDataInternal;
|
||||
|
||||
|
||||
typedef struct Clay__ScrollContainerDataInternalArray
|
||||
{
|
||||
uint32_t capacity;
|
||||
uint32_t length;
|
||||
Clay__ScrollContainerDataInternal *internalArray;
|
||||
} Clay__ScrollContainerDataInternalArray;
|
||||
|
||||
Clay__ScrollContainerDataInternal *Clay__ScrollContainerDataInternalArray_Get(Clay__ScrollContainerDataInternalArray *array, int index);
|
||||
|
||||
|
||||
extern Clay_Color Clay__debugViewHighlightColor;
|
||||
extern uint32_t Clay__debugViewWidth;
|
||||
|
||||
@ -951,7 +989,7 @@ typedef struct
|
||||
uint16_t length;
|
||||
} Clay__LayoutElementChildren;
|
||||
|
||||
typedef struct
|
||||
typedef struct Clay_LayoutElement
|
||||
{
|
||||
union {
|
||||
Clay__LayoutElementChildren children;
|
||||
@ -1044,32 +1082,11 @@ Clay_RenderCommand *Clay_RenderCommandArray_Get(Clay_RenderCommandArray *array,
|
||||
#pragma endregion
|
||||
// __GENERATED__ template
|
||||
|
||||
typedef struct
|
||||
{
|
||||
Clay_LayoutElement *layoutElement;
|
||||
Clay_BoundingBox boundingBox;
|
||||
Clay_Dimensions contentSize;
|
||||
Clay_Vector2 scrollOrigin;
|
||||
Clay_Vector2 pointerOrigin;
|
||||
Clay_Vector2 scrollMomentum;
|
||||
Clay_Vector2 scrollPosition;
|
||||
Clay_Vector2 previousDelta;
|
||||
float momentumTime;
|
||||
uint32_t elementId;
|
||||
bool openThisFrame;
|
||||
bool pointerScrollActive;
|
||||
} Clay__ScrollContainerDataInternal;
|
||||
|
||||
Clay__ScrollContainerDataInternal CLAY__SCROLL_CONTAINER_DEFAULT = CLAY__INIT(Clay__ScrollContainerDataInternal) {};
|
||||
|
||||
// __GENERATED__ template array_define,array_allocate,array_add,array_get TYPE=Clay__ScrollContainerDataInternal NAME=Clay__ScrollContainerDataInternalArray DEFAULT_VALUE=&CLAY__SCROLL_CONTAINER_DEFAULT
|
||||
#pragma region generated
|
||||
typedef struct
|
||||
{
|
||||
uint32_t capacity;
|
||||
uint32_t length;
|
||||
Clay__ScrollContainerDataInternal *internalArray;
|
||||
} Clay__ScrollContainerDataInternalArray;
|
||||
|
||||
Clay__ScrollContainerDataInternalArray Clay__ScrollContainerDataInternalArray_Allocate_Arena(uint32_t capacity, Clay_Arena *arena) {
|
||||
return CLAY__INIT(Clay__ScrollContainerDataInternalArray){.capacity = capacity, .length = 0, .internalArray = (Clay__ScrollContainerDataInternal *)Clay__Array_Allocate_Arena(capacity, sizeof(Clay__ScrollContainerDataInternal), CLAY__ALIGNMENT(Clay__ScrollContainerDataInternal), arena)};
|
||||
}
|
||||
@ -3811,6 +3828,22 @@ Clay_ScrollContainerData Clay_GetScrollContainerData(Clay_ElementId id) {
|
||||
return CLAY__INIT(Clay_ScrollContainerData) {};
|
||||
}
|
||||
|
||||
CLAY_WASM_EXPORT("Clay_GetElementLocationData")
|
||||
Clay_ElementLocationData Clay_GetElementLocationData(Clay_ElementId id){
|
||||
Clay_LayoutElementHashMapItem * item =Clay__GetHashMapItem(id.id);
|
||||
if(item == &CLAY__LAYOUT_ELEMENT_HASH_MAP_ITEM_DEFAULT) {
|
||||
return CLAY__INIT(Clay_ElementLocationData){
|
||||
.found=false,
|
||||
.elementLocation=CLAY__INIT(Clay_BoundingBox){}
|
||||
};
|
||||
}
|
||||
|
||||
return CLAY__INIT(Clay_ElementLocationData){
|
||||
.elementLocation=item->boundingBox,
|
||||
.found = true
|
||||
};
|
||||
}
|
||||
|
||||
CLAY_WASM_EXPORT("Clay_SetDebugModeEnabled")
|
||||
void Clay_SetDebugModeEnabled(bool enabled) {
|
||||
Clay__debugModeEnabled = enabled;
|
||||
@ -3862,4 +3895,4 @@ freely, subject to the following restrictions:
|
||||
|
||||
3. This notice may not be removed or altered from any source
|
||||
distribution.
|
||||
*/
|
||||
*/
|
Loading…
Reference in New Issue
Block a user