Skip to content

Commit ddfa847

Browse files
Finish SDL_pen.inc
1 parent fe4bea5 commit ddfa847

File tree

2 files changed

+36
-1
lines changed

2 files changed

+36
-1
lines changed

units/SDL3.pas

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ interface
9595
{$I SDL_mouse.inc} // 3.1.6-prev (unfinished)
9696
{$I SDL_keyboard.inc} // 3.1.6-prev (unfinished)
9797
{$I SDL_joystick.inc} // 3.1.6-prev (unfinished)
98-
{$I SDL_pen.inc} // 3.1.6-prev (unfinished)
98+
{$I SDL_pen.inc} // 3.1.6-prev
9999
{$I SDL_keycode.inc} // 3.1.6-prev (unfinished)
100100
{$I SDL_scancode.inc} // 3.1.6-prev
101101
{$I SDL_touch.inc} // 3.1.6-prev (unfinished)

units/SDL_pen.inc

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,28 @@
1+
{
2+
This file is part of:
3+
4+
SDL3 for Pascal
5+
(https://github.com/PascalGameDevelopment/SDL3-for-Pascal)
6+
SPDX-License-Identifier: Zlib
7+
}
8+
9+
{*
10+
* # CategoryPen
11+
*
12+
* SDL pen event handling.
13+
*
14+
* SDL provides an API for pressure-sensitive pen (stylus and/or eraser)
15+
* handling, e.g., for input and drawing tablets or suitably equipped mobile /
16+
* tablet devices.
17+
*
18+
* To get started with pens, simply handle SDL_EVENT_PEN_* events. When a pen
19+
* starts providing input, SDL will assign it a unique SDL_PenID, which will
20+
* remain for the life of the process, as long as the pen stays connected.
21+
*
22+
* Pens may provide more than simple touch input; they might have other axes,
23+
* such as pressure, tilt, rotation, etc.
24+
}
25+
126
{*
227
* SDL pen instance IDs.
328
*
@@ -13,6 +38,7 @@ type
1338
PPSDL_PenID = ^PSDL_PenID;
1439
PSDL_PenID = ^TSDL_PenID;
1540
TSDL_PenID = cuint32;
41+
1642
{*
1743
* Pen input flags, as reported by various pen events' `pen_state` field.
1844
*
@@ -22,6 +48,15 @@ type
2248
PSDL_PenInputFlags = ^TSDL_PenInputFlags;
2349
TSDL_PenInputFlags = cuint32;
2450
51+
const
52+
SDL_PEN_INPUT_DOWN = TSDL_PenInputFlags(1 shl 0); {*< pen is pressed down }
53+
SDL_PEN_INPUT_BUTTON_1 = TSDL_PenInputFlags(1 shl 1); {*< button 1 is pressed }
54+
SDL_PEN_INPUT_BUTTON_2 = TSDL_PenInputFlags(1 shl 2); {*< button 2 is pressed }
55+
SDL_PEN_INPUT_BUTTON_3 = TSDL_PenInputFlags(1 shl 3); {*< button 3 is pressed }
56+
SDL_PEN_INPUT_BUTTON_4 = TSDL_PenInputFlags(1 shl 4); {*< button 4 is pressed }
57+
SDL_PEN_INPUT_BUTTON_5 = TSDL_PenInputFlags(1 shl 5); {*< button 5 is pressed }
58+
SDL_PEN_INPUT_ERASER_TIP = TSDL_PenInputFlags(1 shl 30); {*< eraser tip is used }
59+
2560
{*
2661
* Pen axis indices.
2762
*

0 commit comments

Comments
 (0)