Kore
Loading...
Searching...
No Matches
pen.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_pen_set_press_callback(void (*value)(int /*window*/, int /*x*/, int /*y*/, float /*pressure*/));
18
23KINC_FUNC void kinc_pen_set_move_callback(void (*value)(int /*window*/, int /*x*/, int /*y*/, float /*pressure*/));
24
29KINC_FUNC void kinc_pen_set_release_callback(void (*value)(int /*window*/, int /*x*/, int /*y*/, float /*pressure*/));
30
35KINC_FUNC void kinc_eraser_set_press_callback(void (*value)(int /*window*/, int /*x*/, int /*y*/, float /*pressure*/));
36
41KINC_FUNC void kinc_eraser_set_move_callback(void (*value)(int /*window*/, int /*x*/, int /*y*/, float /*pressure*/));
42
47KINC_FUNC void kinc_eraser_set_release_callback(void (*value)(int /*window*/, int /*x*/, int /*y*/, float /*pressure*/));
48
49void kinc_internal_pen_trigger_move(int window, int x, int y, float pressure);
50void kinc_internal_pen_trigger_press(int window, int x, int y, float pressure);
51void kinc_internal_pen_trigger_release(int window, int x, int y, float pressure);
52
53void kinc_internal_eraser_trigger_move(int window, int x, int y, float pressure);
54void kinc_internal_eraser_trigger_press(int window, int x, int y, float pressure);
55void kinc_internal_eraser_trigger_release(int window, int x, int y, float pressure);
56
57#ifdef KINC_IMPLEMENTATION_INPUT
58#define KINC_IMPLEMENTATION
59#endif
60
61#ifdef KINC_IMPLEMENTATION
62
63#include <memory.h>
64#include <stddef.h>
65
66static void (*pen_press_callback)(int /*window*/, int /*x*/, int /*y*/, float /*pressure*/) = NULL;
67static void (*pen_move_callback)(int /*window*/, int /*x*/, int /*y*/, float /*pressure*/) = NULL;
68static void (*pen_release_callback)(int /*window*/, int /*x*/, int /*y*/, float /*pressure*/) = NULL;
69
70static void (*eraser_press_callback)(int /*window*/, int /*x*/, int /*y*/, float /*pressure*/) = NULL;
71static void (*eraser_move_callback)(int /*window*/, int /*x*/, int /*y*/, float /*pressure*/) = NULL;
72static void (*eraser_release_callback)(int /*window*/, int /*x*/, int /*y*/, float /*pressure*/) = NULL;
73
74void kinc_pen_set_press_callback(void (*value)(int /*window*/, int /*x*/, int /*y*/, float /*pressure*/)) {
75 pen_press_callback = value;
76}
77
78void kinc_pen_set_move_callback(void (*value)(int /*window*/, int /*x*/, int /*y*/, float /*pressure*/)) {
79 pen_move_callback = value;
80}
81
82void kinc_pen_set_release_callback(void (*value)(int /*window*/, int /*x*/, int /*y*/, float /*pressure*/)) {
83 pen_release_callback = value;
84}
85
86void kinc_eraser_set_press_callback(void (*value)(int /*window*/, int /*x*/, int /*y*/, float /*pressure*/)) {
87 eraser_press_callback = value;
88}
89
90void kinc_eraser_set_move_callback(void (*value)(int /*window*/, int /*x*/, int /*y*/, float /*pressure*/)) {
91 eraser_move_callback = value;
92}
93
94void kinc_eraser_set_release_callback(void (*value)(int /*window*/, int /*x*/, int /*y*/, float /*pressure*/)) {
95 eraser_release_callback = value;
96}
97
98void kinc_internal_pen_trigger_press(int window, int x, int y, float pressure) {
99 if (pen_press_callback != NULL) {
100 pen_press_callback(window, x, y, pressure);
101 }
102}
103
104void kinc_internal_pen_trigger_move(int window, int x, int y, float pressure) {
105 if (pen_move_callback != NULL) {
106 pen_move_callback(window, x, y, pressure);
107 }
108}
109
110void kinc_internal_pen_trigger_release(int window, int x, int y, float pressure) {
111 if (pen_release_callback != NULL) {
112 pen_release_callback(window, x, y, pressure);
113 }
114}
115
116void kinc_internal_eraser_trigger_press(int window, int x, int y, float pressure) {
117 if (eraser_press_callback != NULL) {
118 eraser_press_callback(window, x, y, pressure);
119 }
120}
121
122void kinc_internal_eraser_trigger_move(int window, int x, int y, float pressure) {
123 if (eraser_move_callback != NULL) {
124 eraser_move_callback(window, x, y, pressure);
125 }
126}
127
128void kinc_internal_eraser_trigger_release(int window, int x, int y, float pressure) {
129 if (eraser_release_callback != NULL) {
130 eraser_release_callback(window, x, y, pressure);
131 }
132}
133
134#endif
135
136#ifdef __cplusplus
137}
138#endif
Provides basic functionality that's used all over the place. There's usually no need to manually incl...
KINC_FUNC void kinc_eraser_set_release_callback(void(*value)(int, int, int, float))
Sets the eraser-release-callback which is called when the pen is moved away from the drawing-surface ...
KINC_FUNC void kinc_eraser_set_move_callback(void(*value)(int, int, int, float))
Sets the eraser-move-callback which is called when the pen is moved while in eraser-mode.
KINC_FUNC void kinc_pen_set_press_callback(void(*value)(int, int, int, float))
Sets the pen-press-callback which is called when the pen is touching the drawing-surface.
KINC_FUNC void kinc_pen_set_move_callback(void(*value)(int, int, int, float))
Sets the pen-move-callback which is called when the pen is moved.
KINC_FUNC void kinc_pen_set_release_callback(void(*value)(int, int, int, float))
Sets the pen-release-callback which is called when the pen is moved away from the drawing-surface.
KINC_FUNC void kinc_eraser_set_press_callback(void(*value)(int, int, int, float))
Sets the eraser-press-callback which is called when the pen is touching the drawing-surface in eraser...