mirror of
https://github.com/nicbarker/clay.git
synced 2025-04-15 10:48:04 +00:00
added a pointer get method
This commit is contained in:
parent
766325c395
commit
13b588d8c1
9
clay.h
9
clay.h
@ -778,6 +778,9 @@ Clay_Arena Clay_CreateArenaWithCapacityAndMemory(uint32_t capacity, void *memory
|
||||
// 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.
|
||||
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_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)
|
||||
@ -3698,6 +3701,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);
|
||||
|
Loading…
Reference in New Issue
Block a user