Kore
Loading...
Searching...
No Matches
surface.h
Go to the documentation of this file.
1#pragma once
2
3#include <kinc/global.h>
4
8
9#ifdef __cplusplus
10extern "C" {
11#endif
12
17KINC_FUNC void kinc_surface_set_touch_start_callback(void (*value)(int /*index*/, int /*x*/, int /*y*/));
18
23KINC_FUNC void kinc_surface_set_move_callback(void (*value)(int /*index*/, int /*x*/, int /*y*/));
24
29KINC_FUNC void kinc_surface_set_touch_end_callback(void (*value)(int /*index*/, int /*x*/, int /*y*/));
30
31void kinc_internal_surface_trigger_touch_start(int index, int x, int y);
32void kinc_internal_surface_trigger_move(int index, int x, int y);
33void kinc_internal_surface_trigger_touch_end(int index, int x, int y);
34
35#ifdef KINC_IMPLEMENTATION_INPUT
36#define KINC_IMPLEMENTATION
37#endif
38
39#ifdef KINC_IMPLEMENTATION
40
41#include <memory.h>
42#include <stddef.h>
43
44static void (*surface_touch_start_callback)(int /*index*/, int /*x*/, int /*y*/) = NULL;
45static void (*surface_move_callback)(int /*index*/, int /*x*/, int /*y*/) = NULL;
46static void (*surface_touch_end_callback)(int /*index*/, int /*x*/, int /*y*/) = NULL;
47
48void kinc_surface_set_touch_start_callback(void (*value)(int /*index*/, int /*x*/, int /*y*/)) {
49 surface_touch_start_callback = value;
50}
51
52void kinc_surface_set_move_callback(void (*value)(int /*index*/, int /*x*/, int /*y*/)) {
53 surface_move_callback = value;
54}
55
56void kinc_surface_set_touch_end_callback(void (*value)(int /*index*/, int /*x*/, int /*y*/)) {
57 surface_touch_end_callback = value;
58}
59
60void kinc_internal_surface_trigger_touch_start(int index, int x, int y) {
61 if (surface_touch_start_callback != NULL) {
62 surface_touch_start_callback(index, x, y);
63 }
64}
65
66void kinc_internal_surface_trigger_move(int index, int x, int y) {
67 if (surface_move_callback != NULL) {
68 surface_move_callback(index, x, y);
69 }
70}
71
72void kinc_internal_surface_trigger_touch_end(int index, int x, int y) {
73 if (surface_touch_end_callback != NULL) {
74 surface_touch_end_callback(index, x, y);
75 }
76}
77
78#endif
79
80#ifdef __cplusplus
81}
82#endif
Provides basic functionality that's used all over the place. There's usually no need to manually incl...
KINC_FUNC void kinc_surface_set_touch_start_callback(void(*value)(int, int, int))
Sets the surface-touch-start-callback which is called when a finger-touch is detected.
KINC_FUNC void kinc_surface_set_move_callback(void(*value)(int, int, int))
Sets the surface-move-callback which is called when a finger is moving around.
KINC_FUNC void kinc_surface_set_touch_end_callback(void(*value)(int, int, int))
Sets the surface-touch-end-callback which is called when a finger disappears. This is usually not a m...