mirror of
https://github.com/nicbarker/clay.git
synced 2025-04-16 11:18:05 +00:00
Compare commits
6 Commits
8d1a2801d5
...
d000ea1fd8
Author | SHA1 | Date | |
---|---|---|---|
|
d000ea1fd8 | ||
|
06167b4f4b | ||
|
af3d63ad0f | ||
|
0eb162e3a3 | ||
|
d1fd147b09 | ||
|
13b588d8c1 |
@ -169,6 +169,7 @@ For help starting out or to discuss clay, considering joining [the discord serve
|
|||||||
- [Clay_SetCurrentContext](#clay_setcurrentcontext)
|
- [Clay_SetCurrentContext](#clay_setcurrentcontext)
|
||||||
- [Clay_SetLayoutDimensions](#clay_setlayoutdimensions)
|
- [Clay_SetLayoutDimensions](#clay_setlayoutdimensions)
|
||||||
- [Clay_SetPointerState](#clay_setpointerstate)
|
- [Clay_SetPointerState](#clay_setpointerstate)
|
||||||
|
- [Clay_GetPointerState](#clay_getpointerstate)
|
||||||
- [Clay_UpdateScrollContainers](#clay_updatescrollcontainers)
|
- [Clay_UpdateScrollContainers](#clay_updatescrollcontainers)
|
||||||
- [Clay_BeginLayout](#clay_beginlayout)
|
- [Clay_BeginLayout](#clay_beginlayout)
|
||||||
- [Clay_EndLayout](#clay_endlayout)
|
- [Clay_EndLayout](#clay_endlayout)
|
||||||
@ -646,6 +647,14 @@ Sets the internal pointer position and state (i.e. current mouse / touch positio
|
|||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
### Clay_GetPointerState
|
||||||
|
|
||||||
|
`Clay_PointerData Clay_GetPointerState()`
|
||||||
|
|
||||||
|
Get the internal pointer position and state (i.e. current mouse / touch position). returns clay internal click start and stop state.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
### Clay_UpdateScrollContainers
|
### Clay_UpdateScrollContainers
|
||||||
|
|
||||||
`void Clay_UpdateScrollContainers(bool enableDragScrolling, Clay_Vector2 scrollDelta, float deltaTime)`
|
`void Clay_UpdateScrollContainers(bool enableDragScrolling, Clay_Vector2 scrollDelta, float deltaTime)`
|
||||||
|
15
clay.h
15
clay.h
@ -801,6 +801,9 @@ CLAY_DLL_EXPORT Clay_Arena Clay_CreateArenaWithCapacityAndMemory(size_t capacity
|
|||||||
// Sets the state of the "pointer" (i.e. the mouse or touch) in Clay's internal data. Used for detecting and responding to mouse events in the debug view,
|
// Sets the state of the "pointer" (i.e. the mouse or touch) in Clay's internal data. Used for detecting and responding to mouse events in the debug view,
|
||||||
// as well as for Clay_Hovered() and scroll element handling.
|
// as well as for Clay_Hovered() and scroll element handling.
|
||||||
CLAY_DLL_EXPORT void Clay_SetPointerState(Clay_Vector2 position, bool pointerDown);
|
CLAY_DLL_EXPORT void Clay_SetPointerState(Clay_Vector2 position, bool pointerDown);
|
||||||
|
// Gets the state of the "pointer". This will return the position provided by `Clay_SetPointerState`
|
||||||
|
// and the frame pressed state.
|
||||||
|
CLAY_DLL_EXPORT Clay_PointerData Clay_GetPointerState();
|
||||||
// Initialize Clay's internal arena and setup required data before layout can begin. Only needs to be called once.
|
// Initialize Clay's internal arena and setup required data before layout can begin. Only needs to be called once.
|
||||||
// - arena can be created using Clay_CreateArenaWithCapacityAndMemory()
|
// - arena can be created using Clay_CreateArenaWithCapacityAndMemory()
|
||||||
// - layoutDimensions are the initial bounding dimensions of the layout (i.e. the screen width and height for a full screen layout)
|
// - layoutDimensions are the initial bounding dimensions of the layout (i.e. the screen width and height for a full screen layout)
|
||||||
@ -3859,6 +3862,12 @@ void Clay_SetPointerState(Clay_Vector2 position, bool isPointerDown) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CLAY_WASM_EXPORT("Clay_GetPointerState")
|
||||||
|
Clay_PointerData Clay_GetPointerState() {
|
||||||
|
Clay_Context* context = Clay_GetCurrentContext();
|
||||||
|
return context->pointerInfo;
|
||||||
|
}
|
||||||
|
|
||||||
CLAY_WASM_EXPORT("Clay_Initialize")
|
CLAY_WASM_EXPORT("Clay_Initialize")
|
||||||
Clay_Context* Clay_Initialize(Clay_Arena arena, Clay_Dimensions layoutDimensions, Clay_ErrorHandler errorHandler) {
|
Clay_Context* Clay_Initialize(Clay_Arena arena, Clay_Dimensions layoutDimensions, Clay_ErrorHandler errorHandler) {
|
||||||
Clay_Context *context = Clay__Context_Allocate_Arena(&arena);
|
Clay_Context *context = Clay__Context_Allocate_Arena(&arena);
|
||||||
@ -4118,11 +4127,15 @@ Clay_ScrollContainerData Clay_GetScrollContainerData(Clay_ElementId id) {
|
|||||||
for (int32_t i = 0; i < context->scrollContainerDatas.length; ++i) {
|
for (int32_t i = 0; i < context->scrollContainerDatas.length; ++i) {
|
||||||
Clay__ScrollContainerDataInternal *scrollContainerData = Clay__ScrollContainerDataInternalArray_Get(&context->scrollContainerDatas, i);
|
Clay__ScrollContainerDataInternal *scrollContainerData = Clay__ScrollContainerDataInternalArray_Get(&context->scrollContainerDatas, i);
|
||||||
if (scrollContainerData->elementId == id.id) {
|
if (scrollContainerData->elementId == id.id) {
|
||||||
|
Clay_ScrollElementConfig *scrollElementConfig = Clay__FindElementConfigWithType(scrollContainerData->layoutElement, CLAY__ELEMENT_CONFIG_TYPE_SCROLL).scrollElementConfig;
|
||||||
|
if (!scrollElementConfig) { // This can happen on the first frame before a scroll container is declared
|
||||||
|
return CLAY__INIT(Clay_ScrollContainerData) CLAY__DEFAULT_STRUCT;
|
||||||
|
}
|
||||||
return CLAY__INIT(Clay_ScrollContainerData) {
|
return CLAY__INIT(Clay_ScrollContainerData) {
|
||||||
.scrollPosition = &scrollContainerData->scrollPosition,
|
.scrollPosition = &scrollContainerData->scrollPosition,
|
||||||
.scrollContainerDimensions = { scrollContainerData->boundingBox.width, scrollContainerData->boundingBox.height },
|
.scrollContainerDimensions = { scrollContainerData->boundingBox.width, scrollContainerData->boundingBox.height },
|
||||||
.contentDimensions = scrollContainerData->contentSize,
|
.contentDimensions = scrollContainerData->contentSize,
|
||||||
.config = *Clay__FindElementConfigWithType(scrollContainerData->layoutElement, CLAY__ELEMENT_CONFIG_TYPE_SCROLL).scrollElementConfig,
|
.config = *scrollElementConfig,
|
||||||
.found = true
|
.found = true
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user