SDL3
view release on metacpan or search on metacpan
lib/SDL3.pm view on Meta::CPAN
push @{ $EXPORT_TAGS{ [ caller(1) ]->[3] =~ s/^.+?_//r } }, $n;
}
sub _const_and_export( $name, $value ) {
no strict 'refs';
*{$name} = sub() {$value};
push @{ $EXPORT_TAGS{ [ caller(1) ]->[3] =~ s/^.+?_//r } }, $name;
}
sub _export( $name, @tags ) { push @{ $EXPORT_TAGS{ [ caller(1) ]->[3] =~ s/^.+?_//r } }, $name }
sub _func_and_export( $name, $sub ) {
no strict 'refs';
my ( undef, undef, undef, $tag ) = caller;
*{$name} = $sub;
push @{ $EXPORT_TAGS{ [ caller(1) ]->[3] =~ s/^.+?_//r } }, $name;
}
sub _typedef_and_export( $name, $type //= () ) {
no strict 'refs';
my ( undef, undef, undef, $tag ) = caller;
if ( defined $type ) {
typedef $name, $type;
}
else {
typedef $name;
}
push @{ $EXPORT_TAGS{ [ caller(1) ]->[3] =~ s/^.+?_//r } }, $name;
}
sub _enum_and_export( $name, $values ) {
no strict 'refs';
my ( undef, undef, undef, $tag ) = caller;
typedef $name, Enum [@$values];
push @{ $EXPORT_TAGS{ [ caller(1) ]->[3] =~ s/^.+?_//r } }, $name;
#~ my $value = 0;
for my $enum (@$values) {
push @{ $EXPORT_TAGS{ [ caller(1) ]->[3] =~ s/^.+?_//r } }, ref $enum ? $enum->[0] : $enum;
}
}
=head3 C<:all>
This binds all functions, defines all types, and imports them into your package.
See L<the SDL3 Wiki|https://wiki.libsdl.org/SDL3/FrontPage> for documentation of the hundreds of types and functions
you'll have access to with this import tag.
=cut
sub _all() {
state $done++ && return;
_stdinc();
_assert();
_asyncio();
_atomic();
_audio();
_bits();
_blendmode();
_camera();
_clipboard();
_cpuinfo();
_dialog();
_error();
_events();
_filesystem();
_gamepad();
_gpu();
_guid();
_haptic();
_hidapi();
_hints();
_init();
_iostream();
_joystick();
_keyboard();
_keycode();
_loadso();
_locale();
_log();
_messagebox();
_metal();
_misc();
_mouse();
_mutex();
_pen();
_pixels();
_platform();
_power();
_process();
_properties();
_rect();
_render();
_scancode();
_sensor();
_storage();
_surface();
_system();
_thread();
_time();
_timer();
_tray();
_touch();
_version();
_video();
#
}
# No docs because this is a no-op.
sub _assert () {
state $done++ && return;
_error();
}
=head3 C<:asyncio> - Async I/O
SDL offers a way to perform I/O asynchronously. This allows an app to read or write files without waiting for data to
actually transfer; the functions that request I/O never block while the request is fulfilled.
See L<SDL3: CategoryAsyncIO|https://wiki.libsdl.org/SDL3/CategoryAsyncIO>
lib/SDL3.pm view on Meta::CPAN
[ SDL_BLENDFACTOR_SRC_ALPHA => 0x5 ],
[ SDL_BLENDFACTOR_ONE_MINUS_SRC_ALPHA => 0x6 ],
[ SDL_BLENDFACTOR_DST_COLOR => 0x7 ],
[ SDL_BLENDFACTOR_ONE_MINUS_DST_COLOR => 0x8 ],
[ SDL_BLENDFACTOR_DST_ALPHA => 0x9 ],
[ SDL_BLENDFACTOR_ONE_MINUS_DST_ALPHA => 0xA ]
];
_affix_and_export
SDL_ComposeCustomBlendMode =>
[ SDL_BlendFactor(), SDL_BlendFactor(), SDL_BlendOperation(), SDL_BlendFactor(), SDL_BlendFactor(), SDL_BlendOperation() ],
SDL_BlendMode();
}
=head3 C<:camera> - Camera Support
Video capture for the SDL library.
See L<SDL3: CategoryCamera|https://wiki.libsdl.org/SDL3/CategoryCamera>
=cut
sub _camera() {
state $done++ && return;
#
_error();
_pixels();
_properties();
_surface();
#
_typedef_and_export SDL_CameraID => UInt32;
_typedef_and_export SDL_Camera => Void;
_typedef_and_export SDL_CameraSpec => Struct [
format => SDL_PixelFormat(),
colorspace => SDL_Colorspace(),
width => Int,
height => Int,
framerate_numerator => Int,
framerate_denominator => Int
];
_enum_and_export SDL_CameraPosition =>
[ 'SDL_CAMERA_POSITION_UNKNOWN', 'SDL_CAMERA_POSITION_FRONT_FACING', 'SDL_CAMERA_POSITION_BACK_FACING' ];
_enum_and_export SDL_CameraPermissionState =>
[ [ SDL_CAMERA_PERMISSION_STATE_DENIED => -1 ], 'SDL_CAMERA_PERMISSION_STATE_PENDING', 'SDL_CAMERA_PERMISSION_STATE_APPROVED' ];
_affix_and_export SDL_GetNumCameraDrivers => [], Int;
_affix_and_export SDL_GetCameraDriver => [Int], String;
_affix_and_export SDL_GetCurrentCameraDriver => [], String;
_affix_and_export SDL_GetCameras => [ Pointer [Int] ], Pointer [ SDL_CameraID() ];
_affix_and_export SDL_GetCameraSupportedFormats => [ SDL_CameraID(), Pointer [Int] ], Pointer [ Pointer [ SDL_CameraSpec() ] ];
_affix_and_export SDL_GetCameraName => [ SDL_CameraID() ], String;
_affix_and_export SDL_GetCameraPosition => [ SDL_CameraID() ], SDL_CameraPosition();
_affix_and_export SDL_OpenCamera => [ SDL_CameraID(), Pointer [ SDL_CameraSpec() ] ], Pointer [ SDL_Camera() ];
_affix_and_export SDL_GetCameraPermissionState => [ Pointer [ SDL_Camera() ] ], SDL_CameraPermissionState();
_affix_and_export SDL_GetCameraID => [ Pointer [ SDL_Camera() ] ], SDL_CameraID();
_affix_and_export SDL_GetCameraProperties => [ Pointer [ SDL_Camera() ] ], SDL_PropertiesID();
_affix_and_export SDL_GetCameraFormat => [ Pointer [ SDL_Camera() ], Pointer [ SDL_CameraSpec() ] ], Bool;
_affix_and_export SDL_AcquireCameraFrame => [ Pointer [ SDL_Camera() ], Pointer [UInt64] ], Pointer [ SDL_Surface() ];
_affix_and_export SDL_ReleaseCameraFrame => [ Pointer [ SDL_Camera() ], Pointer [ SDL_Surface() ] ], Void;
_affix_and_export SDL_CloseCamera => [ Pointer [ SDL_Camera() ] ], Void;
}
=head3 C<:clipboard> - Clipboard Handling
SDL provides access to the system clipboard, both for reading information from other processes and publishing
information of its own.
This is not just text! SDL apps can access and publish data by mimetype.
See L<SDL3: CategoryClipboard|https://wiki.libsdl.org/SDL3/CategoryClipboard>
=cut
sub _clipboard() {
state $done++ && return;
#
_error();
_stdinc();
#
_affix_and_export SDL_SetClipboardText => [String], Bool;
_affix_and_export SDL_GetClipboardText => [], String;
_affix_and_export SDL_HasClipboardText => [], Bool;
_affix_and_export SDL_SetPrimarySelectionText => [String], Bool;
_affix_and_export SDL_GetPrimarySelectionText => [], String;
_affix_and_export SDL_HasPrimarySelectionText => [], Bool;
_typedef_and_export SDL_ClipboardDataCallback => Callback [ [ Pointer [Void], String, Pointer [Size_t] ] => Pointer [Void] ];
_typedef_and_export SDL_ClipboardCleanupCallback => Callback [ [ Pointer [Void] ] => Void ];
_affix_and_export
SDL_SetClipboardData => [ SDL_ClipboardDataCallback(), SDL_ClipboardCleanupCallback(), Pointer [Void], Pointer [String], Size_t ],
Bool;
_affix_and_export SDL_ClearClipboardData => [], Bool;
_affix_and_export SDL_GetClipboardData => [ String, Pointer [Size_t] ], Pointer [Void];
_affix_and_export SDL_HasClipboardData => [String], Bool;
_affix_and_export SDL_GetClipboardMimeTypes => [ Pointer [Size_t] ], Pointer [String];
}
=head3 C<:cpuinfo> - CPU Feature Detection
CPU feature detection for SDL.
These functions are largely concerned with reporting if the system has access to various SIMD instruction sets, but
also has other important info to share, such as system RAM size and number of logical CPU cores.
See L<SDL3: CategoryCPUInfo|https://wiki.libsdl.org/SDL3/CategoryCPUInfo>
=cut
sub _cpuinfo() {
state $done++ && return;
#
_stdinc();
#
_const_and_export SDL_CACHELINE_SIZE => 128;
_affix_and_export SDL_GetNumLogicalCPUCores => [], Int;
_affix_and_export SDL_GetCPUCacheLineSize => [], Int;
_affix_and_export SDL_HasAltiVec => [], Bool;
_affix_and_export SDL_HasMMX => [], Bool;
_affix_and_export SDL_HasSSE => [], Bool;
_affix_and_export SDL_HasSSE2 => [], Bool;
_affix_and_export SDL_HasSSE3 => [], Bool;
_affix_and_export SDL_HasSSE41 => [], Bool;
_affix_and_export SDL_HasSSE42 => [], Bool;
_affix_and_export SDL_HasAVX => [], Bool;
_affix_and_export SDL_HasAVX2 => [], Bool;
_affix_and_export SDL_HasAVX512F => [], Bool;
_affix_and_export SDL_HasARMSIMD => [], Bool;
_affix_and_export SDL_HasNEON => [], Bool;
_affix_and_export SDL_HasLSX => [], Bool;
_affix_and_export SDL_HasLASX => [], Bool;
_affix_and_export SDL_GetSystemRAM => [], Int;
_affix_and_export SDL_GetSIMDAlignment => [], Size_t;
#~ _affix_and_export SDL_GetSystemPageSize => [], Int;
}
lib/SDL3.pm view on Meta::CPAN
num_mime_types => SInt32,
mime_types => Pointer [String]
];
_typedef_and_export SDL_SensorEvent => Struct [
type => SDL_EventType(),
reserved => UInt32,
timestamp => UInt64,
which => SDL_SensorID(),
data => Array [ Float, 6 ],
sensor_timestamp => UInt64
];
_typedef_and_export SDL_QuitEvent => Struct [ type => SDL_EventType(), reserved => UInt32, timestamp => UInt64 ];
_typedef_and_export SDL_UserEvent => Struct [
type => UInt32,
reserved => UInt32,
timestamp => UInt64,
windowID => SDL_WindowID(),
code => SInt32,
data1 => Pointer [Void],
data2 => Pointer [Void]
];
_typedef_and_export SDL_Event => Union [
type => UInt32,
common => SDL_CommonEvent(),
display => SDL_DisplayEvent(),
window => SDL_WindowEvent(),
kdevice => SDL_KeyboardDeviceEvent(),
key => SDL_KeyboardEvent(),
edit => SDL_TextEditingEvent(),
edit_candidates => SDL_TextEditingCandidatesEvent(),
text => SDL_TextInputEvent(),
mdevice => SDL_MouseDeviceEvent(),
motion => SDL_MouseMotionEvent(),
button => SDL_MouseButtonEvent(),
wheel => SDL_MouseWheelEvent(),
jdevice => SDL_JoyDeviceEvent(),
jaxis => SDL_JoyAxisEvent(),
jball => SDL_JoyBallEvent(),
jhat => SDL_JoyHatEvent(),
jbutton => SDL_JoyButtonEvent(),
jbattery => SDL_JoyBatteryEvent(),
gdevice => SDL_GamepadDeviceEvent(),
gaxis => SDL_GamepadAxisEvent(),
gbutton => SDL_GamepadButtonEvent(),
gtouchpad => SDL_GamepadTouchpadEvent(),
gsensor => SDL_GamepadSensorEvent(),
adevice => SDL_AudioDeviceEvent(),
cdevice => SDL_CameraDeviceEvent(),
sensor => SDL_SensorEvent(),
quit => SDL_QuitEvent(),
user => SDL_UserEvent(),
tfinger => SDL_TouchFingerEvent(),
pinch => SDL_PinchFingerEvent(),
pproximity => SDL_PenProximityEvent(),
ptouch => SDL_PenTouchEvent(),
pmotion => SDL_PenMotionEvent(),
pbutton => SDL_PenButtonEvent(),
paxis => SDL_PenAxisEvent(),
render => SDL_RenderEvent(),
drop => SDL_DropEvent(),
clipboard => SDL_ClipboardEvent(),
padding => Array [ UInt8, 128 ]
];
_affix_and_export SDL_PumpEvents => [], Void;
_enum_and_export SDL_EventAction => [ 'SDL_ADDEVENT', 'SDL_PEEKEVENT', 'SDL_GETEVENT' ];
_affix_and_export SDL_PeepEvents => [ Pointer [ SDL_Event() ], Int, SDL_EventAction(), UInt32, UInt32 ], Int;
_affix_and_export SDL_HasEvent => [UInt32], Bool;
_affix_and_export SDL_HasEvents => [ UInt32, UInt32 ], Bool;
_affix_and_export SDL_FlushEvent => [UInt32], Void;
_affix_and_export SDL_FlushEvents => [ UInt32, UInt32 ], Void;
_affix_and_export SDL_PollEvent => [ Pointer [ SDL_Event() ] ], Bool;
_affix_and_export SDL_WaitEvent => [ Pointer [ SDL_Event() ] ], Bool;
_affix_and_export SDL_WaitEventTimeout => [ Pointer [ SDL_Event() ], SInt32 ], Bool;
_affix_and_export SDL_PushEvent => [ Pointer [ SDL_Event() ] ], Bool;
_typedef_and_export SDL_EventFilter => Callback [ [ Pointer [Void], Pointer [ SDL_Event() ] ] => Bool ];
_affix_and_export SDL_SetEventFilter => [ SDL_EventFilter(), Pointer [Void] ], Void;
_affix_and_export SDL_GetEventFilter => [ Pointer [ SDL_EventFilter() ], Pointer [ Pointer [Void] ] ], Bool;
_affix_and_export SDL_AddEventWatch => [ SDL_EventFilter(), Pointer [Void] ], Bool;
_affix_and_export SDL_RemoveEventWatch => [ SDL_EventFilter(), Pointer [Void] ], Void;
_affix_and_export SDL_FilterEvents => [ SDL_EventFilter(), Pointer [Void] ], Void;
_affix_and_export SDL_SetEventEnabled => [ UInt32, Bool ], Void;
_affix_and_export SDL_EventEnabled => [UInt32], Bool;
_affix_and_export SDL_RegisterEvents => [Int], UInt32;
_affix_and_export SDL_GetWindowFromEvent => [ Pointer [ SDL_Event() ] ], Pointer [ SDL_Window() ];
#~ _affix_and_export SDL_GetEventDescription => [ Pointer [ SDL_Event() ], String, Int ], Int;
}
=head3 C<:filesystem> - Filesystem Access
SDL offers an API for examining and manipulating the system's filesystem. This covers most things one would need to do
with directories, except for actual file I/O.
See L<SDL3: CategoryFilesystem|https://wiki.libsdl.org/SDL3/CategoryFilesystem>
=cut
sub _filesystem() {
state $done++ && return;
#
_error();
_stdinc();
#
_affix_and_export SDL_GetBasePath => [], String;
_affix_and_export SDL_GetPrefPath => [ String, String ], String;
_enum_and_export SDL_Folder => [
'SDL_FOLDER_HOME', 'SDL_FOLDER_DESKTOP', 'SDL_FOLDER_DOCUMENTS', 'SDL_FOLDER_DOWNLOADS',
'SDL_FOLDER_MUSIC', 'SDL_FOLDER_PICTURES', 'SDL_FOLDER_PUBLICSHARE', 'SDL_FOLDER_SAVEDGAMES',
'SDL_FOLDER_SCREENSHOTS', 'SDL_FOLDER_TEMPLATES', 'SDL_FOLDER_VIDEOS', 'SDL_FOLDER_COUNT'
];
_affix_and_export SDL_GetUserFolder => [ SDL_Folder() ], String;
_enum_and_export SDL_PathType => [ 'SDL_PATHTYPE_NONE', 'SDL_PATHTYPE_FILE', 'SDL_PATHTYPE_DIRECTORY', 'SDL_PATHTYPE_OTHER' ];
_typedef_and_export SDL_PathInfo => Struct [
type => SDL_PathType(),
size => UInt64,
create_time => SInt64, # SDL_Time
modify_time => SInt64,
access_time => SInt64
];
_typedef_and_export SDL_GlobFlags => UInt32;
_const_and_export SDL_GLOB_CASEINSENSITIVE => ( 1 << 0 );
( run in 0.549 second using v1.01-cache-2.11-cpan-2398b32b56e )