mirror of
https://github.com/nicbarker/clay.git
synced 2025-04-23 22:58:06 +00:00
Compare commits
11 Commits
3f999de81c
...
97dee308a7
Author | SHA1 | Date | |
---|---|---|---|
|
97dee308a7 | ||
|
982ade4cf9 | ||
|
d5af2c3dc0 | ||
|
2677bec854 | ||
|
05ac2810d8 | ||
|
1f8cab8d72 | ||
|
6186596b41 | ||
|
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_SetLayoutDimensions](#clay_setlayoutdimensions)
|
||||
- [Clay_SetPointerState](#clay_setpointerstate)
|
||||
- [Clay_GetPointerState](#clay_getpointerstate)
|
||||
- [Clay_UpdateScrollContainers](#clay_updatescrollcontainers)
|
||||
- [Clay_BeginLayout](#clay_beginlayout)
|
||||
- [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
|
||||
|
||||
`void Clay_UpdateScrollContainers(bool enableDragScrolling, Clay_Vector2 scrollDelta, float deltaTime)`
|
||||
|
18
clay.h
18
clay.h
@ -102,6 +102,10 @@
|
||||
|
||||
static uint8_t CLAY__ELEMENT_DEFINITION_LATCH;
|
||||
|
||||
// GCC marks the above CLAY__ELEMENT_DEFINITION_LATCH as an unused variable for files that include clay.h but don't declare any layout
|
||||
// This is to suppress that warning
|
||||
static inline void Clay__SuppressUnusedLatchDefinitionVariableWarning(void) { (void) CLAY__ELEMENT_DEFINITION_LATCH; }
|
||||
|
||||
// Publicly visible layout element macros -----------------------------------------------------
|
||||
|
||||
/* This macro looks scary on the surface, but is actually quite simple.
|
||||
@ -798,6 +802,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,
|
||||
// as well as for Clay_Hovered() and scroll element handling.
|
||||
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.
|
||||
// - 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)
|
||||
@ -1654,6 +1661,8 @@ void Clay__CloseElement(void) {
|
||||
elementHasScrollVertical = config->config.scrollElementConfig->vertical;
|
||||
context->openClipElementStack.length--;
|
||||
break;
|
||||
} else if (config->type == CLAY__ELEMENT_CONFIG_TYPE_FLOATING) {
|
||||
context->openClipElementStack.length--;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1933,6 +1942,9 @@ void Clay__ConfigureOpenElementPtr(const Clay_ElementDeclaration *declaration) {
|
||||
if (!openLayoutElementId.id) {
|
||||
openLayoutElementId = Clay__HashString(CLAY_STRING("Clay__FloatingContainer"), context->layoutElementTreeRoots.length, 0);
|
||||
}
|
||||
int32_t currentElementIndex = Clay__int32_tArray_GetValue(&context->openLayoutElementStack, context->openLayoutElementStack.length - 1);
|
||||
Clay__int32_tArray_Set(&context->layoutElementClipElementIds, currentElementIndex, clipElementId);
|
||||
Clay__int32_tArray_Add(&context->openClipElementStack, clipElementId);
|
||||
Clay__LayoutElementTreeRootArray_Add(&context->layoutElementTreeRoots, CLAY__INIT(Clay__LayoutElementTreeRoot) {
|
||||
.layoutElementIndex = Clay__int32_tArray_GetValue(&context->openLayoutElementStack, context->openLayoutElementStack.length - 1),
|
||||
.parentId = floatingConfig.parentId,
|
||||
@ -3739,6 +3751,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_Context* Clay_Initialize(Clay_Arena arena, Clay_Dimensions layoutDimensions, Clay_ErrorHandler errorHandler) {
|
||||
Clay_Context *context = Clay__Context_Allocate_Arena(&arena);
|
||||
|
@ -3,6 +3,7 @@
|
||||
#include <SDL_ttf.h>
|
||||
#include <SDL_image.h>
|
||||
#include <stdio.h>
|
||||
#include <math.h>
|
||||
|
||||
#ifndef M_PI
|
||||
#define M_PI 3.14159
|
||||
|
Loading…
Reference in New Issue
Block a user