module Sdl2_Ffi

The SDL2 Map of API Prototypes

Stub for SDL_assert.h, Unsure if we should translate or borrow existing functionality. TODO: Review for future implementation

sdl_error.h - Error handling routines.

SDL2 Mouse Support

SDL_pixels.h API

2D Accelerated Rendering

API Supports these primitives:

Rendered in Opaque, Blended, or Additive modes. Textures have additional tint or alpha modulation, and the API supports stretching, rotation, or mirroring. NOTE: THIS API IS NOT THREAD SAFE

SDL_rwops.h => sdl2/rwops.rb

require ‘sdl2/pixel_format’

SDL_syswm.h - “Include file for SDL custom system window manager hooks.”

Your application has access to a special type of event ::SDL_SYSWMEVENT,
which contains window-manager specific information and arrives whenever
an unhandled window event occurs.  This event is ignored by default, but
you can enable it with SDL_EventState().

Stub for now.. need to implement!!!

Constants

ALPHA_OPAQUE
ALPHA_TRANSPARENT
CACHELINE_SIZE
Colour

Alternative spelling of Color

GEM_VERSION
IMG
MIX

Interface for “SDL_mixer.h”

MIX_MAXVOLUME
Mix

Interface for “SDL_mixer.h”

NUM_SCANCODES

Not a key, just marks the number of scancodes for array bounds

OK_WHEN_GTE_ZERO

When the result must be positive

OK_WHEN_NOT_NULL

When resultnot null?

OK_WHEN_NOT_ZERO

When result is anything but zero

OK_WHEN_ONE

When the result is one, everything is ok

OK_WHEN_TRUE

When result is true

OK_WHEN_ZERO

When the result is zero, everything is ok.

PRESSED

General keyboard/mouse pressed state

RELEASED

General keyboard/mouse released state

SCANCODE_MASK

TODO: Review if I translated lines 44~45 right.

SDL_MODULE

Default load-path. To modify what library this RubyGem loads: 1) require ‘sdl2/sdl_module’ before anything else.

2) Modify the SDL2::SDL_MODULE array. 3) require any of the rest of the SDL2 module: require ‘sdl2/video’, etc

SYSWM
TOUCH_MOUSEID

Public Class Methods

bitsperpixel(x) click to toggle source

MACRO: SDL_BITSPERPIXEL(X) (((X) >> 8) & 0xFF)

# File lib/sdl2/pixels.rb, line 113
def self.bitsperpixel(x);   (((x) >> 8) & 0xFF); end
blit_scaled(src, srcrect, dst, dstrect) click to toggle source

using upper_blit_scaled

# File lib/sdl2/surface.rb, line 299
def self.blit_scaled(src, srcrect, dst, dstrect)
  upper_blit_scaled(src, srcrect, dst, dstrect)
end
blit_surface(src, srcrect, dst, dstrect) click to toggle source

using upper_blit

# File lib/sdl2/surface.rb, line 281
def self.blit_surface(src, srcrect, dst, dstrect)
  
  upper_blit(src, srcrect, dst, dstrect)
end
bytesperpixel(x) click to toggle source

MACRO: SDL_BYTESPERPIXEL(X) \

(SDL_ISPIXELFORMAT_FOURCC(X) ? \
    ((((X) == SDL_PIXELFORMAT_YUY2) || \
      ((X) == SDL_PIXELFORMAT_UYVY) || \
      ((X) == SDL_PIXELFORMAT_YVYU)) ? 2 : 1) : (((X) >> 0) & 0xFF))
# File lib/sdl2/pixels.rb, line 120
def self.bytesperpixel(x)
  (ispixelformat_fourcc(x) ?
  ((( x == PIXELFORMAT.YUV2 ) ||
  ( x == PIXELFORMAT.UYVY ) ||
  ( x == PIXELFORMAT.YVYU )) ? 2 : 1) : ((x >> 0) & 0xFF))
end
define_pixelformat(type, order, layout, bits, bytes) click to toggle source

MACRO: SDL_DEFINE_PIXELFORMAT(type, order, layout, bits, bytes) \

((1 << 28) | ((type) << 24) | ((order) << 20) | ((layout) << 16) | \
 ((bits) << 8) | ((bytes) << 0))
# File lib/sdl2/pixels.rb, line 95
def self.define_pixelformat(type, order, layout, bits, bytes)
  ((1 << 28) | ((type) << 24) | ((order) << 20) | ((layout) << 16) | 
   ((bits) << 8) | ((bytes) << 0))
end
define_pixelfourcc(a,b,c,d) click to toggle source

MACRO: SDL_DEFINE_PIXELFOURCC(A, B, C, D) SDL_FOURCC(A, B, C, D)

# File lib/sdl2/pixels.rb, line 88
def self.define_pixelfourcc(a,b,c,d)
  SDL2.fourcc(a,b,c,d);
end
fourcc(*args) click to toggle source
Define a four character code as a Uint32

MACRO: SDL_FOURCC(A, B, C, D) \

((SDL_static_cast(Uint32, SDL_static_cast(Uint8, (A))) << 0) | \
 (SDL_static_cast(Uint32, SDL_static_cast(Uint8, (B))) << 8) | \
 (SDL_static_cast(Uint32, SDL_static_cast(Uint8, (C))) << 16) | \
 (SDL_static_cast(Uint32, SDL_static_cast(Uint8, (D))) << 24))
# File lib/sdl2/stdinc.rb, line 14
def self.fourcc(*args)
  bit_cnt = 0
  result = 0
  args.each do |arg|
    arg = arg.codepoints[0] if arg.kind_of? String
    result = result | (arg << bit_cnt)
    bit_cnt += 8
  end
  return result
end
ispixelformat_alpha(format) click to toggle source

MACRO: SDL_ISPIXELFORMAT_ALPHA(format) \ (!SDL_ISPIXELFORMAT_FOURCC(format) && \ ((SDL_PIXELORDER(format) == SDL_PACKEDORDER_ARGB) || \ (SDL_PIXELORDER(format) == SDL_PACKEDORDER_RGBA) || \ (SDL_PIXELORDER(format) == SDL_PACKEDORDER_ABGR) || \ (SDL_PIXELORDER(format) == SDL_PACKEDORDER_BGRA)))

# File lib/sdl2/pixels.rb, line 145
def self.ispixelformat_alpha(format)
  (!pixelformat_fourcc(format) &&
  ((pixelorder(format) == PACKEDORDER.ARGB) ||
  (pixelorder(format) == PACKEDORDER.RGBA) ||
  (pixelorder(format) == PACKEDORDER.ABGR) ||
  (pixelorder(format) == PACKEDORDER.BGRA)))
end
ispixelformat_fourcc(format) click to toggle source

MACRO: SDL_ISPIXELFORMAT_FOURCC(format) \ ((format) && (SDL_PIXELFLAG(format) != 1))

# File lib/sdl2/pixels.rb, line 155
def self.ispixelformat_fourcc(format)
  ((format) && (pixelflag(format) != 1))
end
ispixelformat_indexed(format) click to toggle source

MACRO: SDL_ISPIXELFORMAT_INDEXED(format) \ (!SDL_ISPIXELFORMAT_FOURCC(format) && \ ((SDL_PIXELTYPE(format) == SDL_PIXELTYPE_INDEX1) || \ (SDL_PIXELTYPE(format) == SDL_PIXELTYPE_INDEX4) || \ (SDL_PIXELTYPE(format) == SDL_PIXELTYPE_INDEX8)))

# File lib/sdl2/pixels.rb, line 132
def self.ispixelformat_indexed(format)
  (!ispixelformat_fourcc(format) &&
  ((pixeltype(format) == PIXELTYPE.INDEX1) ||
  (pixeltype(format) == PIXELTYPE.INDEX4) ||
  (pixeltype(format) == PIXELTYPE.INDEX8)))
end
load_bmp(file) click to toggle source

Redefine SDL_LoadBMP macro:

# File lib/sdl2/surface.rb, line 212
def self.load_bmp(file)
  SDL2.load_bmp_rw(RWops.from_file(file, 'rb'), 1)
end
load_wav(file, spec, audio_buf, audio_len) click to toggle source
# File lib/sdl2/audio.rb, line 147
def self.load_wav(file, spec, audio_buf, audio_len)
  load_wav_rw(rw_from_file)
end
pixelflag(x) click to toggle source

MACRO: SDL_PIXELFLAG(X) (((X) >> 28) & 0x0F)

# File lib/sdl2/pixels.rb, line 101
def self.pixelflag(x);      (((x) >> 28) & 0x0F); end
pixellayout(x) click to toggle source

MACRO: SDL_PIXELLAYOUT(X) (((X) >> 16) & 0x0F)

# File lib/sdl2/pixels.rb, line 110
def self.pixellayout(x);    (((x) >> 16) & 0x0F); end
pixelorder(x) click to toggle source

MACRO: SDL_PIXELORDER(X) (((X) >> 20) & 0x0F)

# File lib/sdl2/pixels.rb, line 107
def self.pixelorder(x);     (((x) >> 20) & 0x0F); end
pixeltype(x) click to toggle source

MACRO: SDL_PIXELTYPE(X) (((X) >> 24) & 0x0F)

# File lib/sdl2/pixels.rb, line 104
def self.pixeltype(x);      (((x) >> 24) & 0x0F); end
save_bmp(surface, file) click to toggle source
# File lib/sdl2/surface.rb, line 222
def self.save_bmp(surface, file)
  SDL2.save_bmp_rw(surface, RWops.from_file(file, 'wb'), 1)
end
scancode_to_keycode(scancode) click to toggle source
# File lib/sdl2/keycode.rb, line 12
def self.scancode_to_keycode(scancode)
  scancode | SCANCODE_MASK
end

Public Instance Methods

SDL_AddTimer() click to toggle source
# File lib/sdl2/timer.rb, line 24
api :SDL_AddTimer, [:uint32, :timer_callback, :pointer], :timer_id
SDL_AllocFormat() click to toggle source
# File lib/sdl2/pixels.rb, line 220
api :SDL_AllocFormat, [:pixel_format], PixelFormat.ptr, {error: true, filter: OK_WHEN_NOT_NULL}
SDL_AllocPalette() click to toggle source
# File lib/sdl2/pixels.rb, line 226
api :SDL_AllocPalette, [:count], Palette.ptr, {error: true, filter: OK_WHEN_NOT_NULL}
SDL_AllocRW() click to toggle source

Allocate a RWops structure

# File lib/sdl2/rwops.rb, line 183
api :SDL_AllocRW, [], RWops.ptr, {error: true, filter: OK_WHEN_NOT_NULL}
SDL_AudioInit() click to toggle source
# File lib/sdl2/audio.rb, line 109
api :SDL_AudioInit, [:string], :int
SDL_AudioQuit() click to toggle source
# File lib/sdl2/audio.rb, line 112
api :SDL_AudioQuit, [], :void
SDL_BuildAudioCVT() click to toggle source
# File lib/sdl2/audio.rb, line 156
api :SDL_BuildAudioCVT, [Audio::CVT.by_ref, :audio_format, :uint8, :int, :audio_format, :uint8, :int], :int
SDL_ClearError() click to toggle source

Remove current SDL error string.

# File lib/sdl2/error.rb, line 9
api :SDL_ClearError, [], :void
SDL_ClearHints() click to toggle source
# File lib/sdl2/hints.rb, line 58
api :SDL_ClearHints, [], :void
SDL_CloseAudio() click to toggle source
# File lib/sdl2/audio.rb, line 184
api :SDL_CloseAudio, [], :void
SDL_CloseAudioDevice() click to toggle source
# File lib/sdl2/audio.rb, line 187
api :SDL_CloseAudioDevice, [:audio_device_id], :void
SDL_ConvertAudio() click to toggle source
# File lib/sdl2/audio.rb, line 159
api :SDL_ConvertAudio, [Audio::CVT.by_ref], :int
SDL_ConvertPixels() click to toggle source
# File lib/sdl2/surface.rb, line 269
api :SDL_ConvertPixels, [:int, :int, :pixel_format, :pointer, :int, :pixel_format, :pointer, :int], :int, {error: true}
SDL_ConvertSurface() click to toggle source
# File lib/sdl2/surface.rb, line 263
api :SDL_ConvertSurface, [Surface.by_ref, PixelFormat.by_ref, :surface_flags], Surface.ptr, {error: true, filter: OK_WHEN_NOT_NULL}
SDL_ConvertSurfaceFormat() click to toggle source
# File lib/sdl2/surface.rb, line 266
api :SDL_ConvertSurfaceFormat, [Surface.by_ref, :pixel_format, :surface_flags], Surface.ptr
SDL_CreateRGBSurface() click to toggle source
# File lib/sdl2/surface.rb, line 194
api :SDL_CreateRGBSurface, [:surface_flags, :int, :int, :int, :uint32, :uint32, :uint32, :uint32], Surface.ptr, {error: true, filter: OK_WHEN_NOT_NULL}
SDL_Delay() click to toggle source
# File lib/sdl2/timer.rb, line 16
api :SDL_Delay, [:uint32], :void
SDL_EnclosePoints() click to toggle source

Calculate a minimal rectangle enclosing a set of points

# File lib/sdl2/rect.rb, line 130
api :SDL_EnclosePoints, [Point.by_ref, :count, Rect.by_ref, Rect.by_ref], :bool
SDL_FillRect() click to toggle source
# File lib/sdl2/surface.rb, line 272
api :SDL_FillRect, [Surface.by_ref, Rect.by_ref, :uint32], :int, {error: true}
SDL_FillRects() click to toggle source
# File lib/sdl2/surface.rb, line 275
api :SDL_FillRects, [Surface.by_ref, Rect.by_ref, :count, :uint32], :int, {error: true}
SDL_FreeFormat() click to toggle source
# File lib/sdl2/pixels.rb, line 223
api :SDL_FreeFormat, [PixelFormat.by_ref], :void
SDL_FreePalette() click to toggle source
# File lib/sdl2/pixels.rb, line 235
api :SDL_FreePalette, [Palette.by_ref], :void
SDL_FreeRW() click to toggle source

Release a RWops structure

# File lib/sdl2/rwops.rb, line 186
api :SDL_FreeRW, [RWops.by_ref], :void
SDL_FreeSurface() click to toggle source
# File lib/sdl2/surface.rb, line 197
api :SDL_FreeSurface, [Surface.by_ref], :void
SDL_FreeWAV() click to toggle source
# File lib/sdl2/audio.rb, line 153
api :SDL_FreeWAV, [:pointer], :void
SDL_GameControllerAddMapping() click to toggle source
# File lib/sdl2/gamecontroller.rb, line 35
api :SDL_GameControllerAddMapping, [:string], :int
SDL_GameControllerClose() click to toggle source
# File lib/sdl2/gamecontroller.rb, line 101
api :SDL_GameControllerClose, [GameController.by_ref], :void
SDL_GameControllerEventState() click to toggle source
# File lib/sdl2/gamecontroller.rb, line 62
api :SDL_GameControllerEventState, [:int], :int
SDL_GameControllerGetAttached() click to toggle source
# File lib/sdl2/gamecontroller.rb, line 56
api :SDL_GameControllerGetAttached, [GameController.by_ref], :bool
SDL_GameControllerGetAxis() click to toggle source
# File lib/sdl2/gamecontroller.rb, line 80
api :SDL_GameControllerGetAxis, [GameController.by_ref, :game_controller_axis], :int16
SDL_GameControllerGetAxisFromString() click to toggle source
# File lib/sdl2/gamecontroller.rb, line 71
api :SDL_GameControllerGetAxisFromString, [:string], :game_controller_axis  
SDL_GameControllerGetBindForAxis() click to toggle source
# File lib/sdl2/gamecontroller.rb, line 77
api :SDL_GameControllerGetBindForAxis, [GameController.by_ref, :game_controller_axis], GameController::ButtonBind
SDL_GameControllerGetBindForButton() click to toggle source
# File lib/sdl2/gamecontroller.rb, line 95
api :SDL_GameControllerGetBindForButton, [GameController.by_ref, :game_controller_button], GameController::ButtonBind
SDL_GameControllerGetButton() click to toggle source
# File lib/sdl2/gamecontroller.rb, line 98
api :SDL_GameControllerGetButton, [GameController.by_ref, :game_controller_button], :uint8
SDL_GameControllerGetButtonFromString() click to toggle source
# File lib/sdl2/gamecontroller.rb, line 89
api :SDL_GameControllerGetButtonFromString, [:string], :game_controller_button
SDL_GameControllerGetJoystick() click to toggle source
# File lib/sdl2/gamecontroller.rb, line 59
api :SDL_GameControllerGetJoystick, [GameController.by_ref], Joystick.by_ref
SDL_GameControllerGetStringForAxis() click to toggle source
# File lib/sdl2/gamecontroller.rb, line 74
api :SDL_GameControllerGetStringForAxis, [:game_controller_axis], :string
SDL_GameControllerGetStringForButton() click to toggle source
# File lib/sdl2/gamecontroller.rb, line 92
api :SDL_GameControllerGetStringForButton, [:game_controller_button], :string
SDL_GameControllerMapping() click to toggle source
# File lib/sdl2/gamecontroller.rb, line 41
api :SDL_GameControllerMapping, [GameController.by_ref], :string
SDL_GameControllerMappingForGUID() click to toggle source
# File lib/sdl2/gamecontroller.rb, line 38
api :SDL_GameControllerMappingForGUID, [JoystickGUID.by_value], :string
SDL_GameControllerName() click to toggle source
# File lib/sdl2/gamecontroller.rb, line 53
api :SDL_GameControllerName, [GameController.by_ref], :string
SDL_GameControllerNameForIndex() click to toggle source
# File lib/sdl2/gamecontroller.rb, line 47
api :SDL_GameControllerNameForIndex, [:joystick_index], :string
SDL_GameControllerOpen() click to toggle source
# File lib/sdl2/gamecontroller.rb, line 50
api :SDL_GameControllerOpen, [:joystick_index], :string
SDL_GameControllerUpdate() click to toggle source
# File lib/sdl2/gamecontroller.rb, line 65
api :SDL_GameControllerUpdate, [], :void
SDL_GetAudioDeviceName() click to toggle source
# File lib/sdl2/audio.rb, line 127
api :SDL_GetAudioDeviceName, [:int, :int], :string
SDL_GetAudioDriver() click to toggle source
# File lib/sdl2/audio.rb, line 106
api :SDL_GetAudioDriver, [:int], :string
SDL_GetAudioStatus() click to toggle source
# File lib/sdl2/audio.rb, line 136
api :SDL_GetAudioStatus, [], :audio_status
SDL_GetCPUCacheLineSize() click to toggle source
# File lib/sdl2/cpuinfo.rb, line 12
api :SDL_GetCPUCacheLineSize, [], :int
SDL_GetCPUCount() click to toggle source
# File lib/sdl2/cpuinfo.rb, line 9
api :SDL_GetCPUCount, [], :int
SDL_GetClipRect() click to toggle source
# File lib/sdl2/surface.rb, line 260
api :SDL_GetClipRect, [Surface.by_ref, Rect.by_ref], :int, {error: true}
SDL_GetClipboardText() click to toggle source
# File lib/sdl2/clipboard.rb, line 29
api :SDL_GetClipboardText, [], :string
SDL_GetColorKey() click to toggle source
# File lib/sdl2/surface.rb, line 234
api :SDL_GetColorKey, [Surface.by_ref, TypedPointer::UInt32.by_ref], :uint32, {error: true}
SDL_GetCurrentAudioDriver() click to toggle source
# File lib/sdl2/audio.rb, line 115
api :SDL_GetCurrentAudioDriver, [], :string
SDL_GetError() click to toggle source

Retrieve current SDL error string.

# File lib/sdl2/error.rb, line 12
api :SDL_GetError, [], :string
SDL_GetHint() click to toggle source
# File lib/sdl2/hints.rb, line 61
api :SDL_GetHint, [:string], :string
SDL_GetKeyFromName() click to toggle source
# File lib/sdl2/keyboard.rb, line 73
api :SDL_GetKeyFromName, [:string], :keycode
SDL_GetKeyFromScancode() click to toggle source
# File lib/sdl2/keyboard.rb, line 58
api :SDL_GetKeyFromScancode, [:scancode], :keycode
SDL_GetKeyName() click to toggle source
# File lib/sdl2/keyboard.rb, line 70
api :SDL_GetKeyName, [:keycode], :string
get_keyboard_focus() click to toggle source
get_keyboard_focus!

Get the window which currently has keyboard focus.

# File lib/sdl2/keyboard.rb, line 28
api :SDL_GetKeyboardFocus, [], Window.by_ref
SDL_GetKeyboardState() click to toggle source

brief Get a snapshot of the current state of the keyboard.

*  numkeys if non-NULL, receives the length of the returned array.

@return An array of key states.

Indexes into this array are obtained by using ::SDL_Scancode values.

Example: See Keyboard::get_state() @code

count = FFI::MemoryPointer.new :int, 1
state = FFI::Pointer.new :uint8, SDL2::get_keyboard_state(count)
if state[SDL2::SCANCODE::RETURN]
  puts("<RETURN> is pressed.\n");
end
# File lib/sdl2/keyboard.rb, line 48
api :SDL_GetKeyboardState, [TypedPointer::Int.by_ref], :pointer
SDL_GetModState() click to toggle source
# File lib/sdl2/keyboard.rb, line 52
api :SDL_GetModState, [], :keymod
SDL_GetNumAudioDevices() click to toggle source
# File lib/sdl2/audio.rb, line 124
api :SDL_GetNumAudioDevices, [:int], :int
SDL_GetNumAudioDrivers() click to toggle source
# File lib/sdl2/audio.rb, line 103
api :SDL_GetNumAudioDrivers, [], :int
SDL_GetPerformanceCounter() click to toggle source
# File lib/sdl2/timer.rb, line 10
api :SDL_GetPerformanceCounter, [], :uint64
SDL_GetPerformanceFrequency() click to toggle source
# File lib/sdl2/timer.rb, line 13
api :SDL_GetPerformanceFrequency, [], :uint64    
SDL_GetPixelFormatName() click to toggle source
# File lib/sdl2/pixels.rb, line 211
api :SDL_GetPixelFormatName, [:pixel_format], :string
SDL_GetPowerInfo() click to toggle source
# File lib/sdl2/power.rb, line 18
api :SDL_GetPowerInfo, [TypedPointer::Int.by_ref, TypedPointer::Int.by_ref], :powerstate
SDL_GetRGB() click to toggle source
# File lib/sdl2/pixels.rb, line 244
api :SDL_GetRGB, [:uint32, PixelFormat.by_ref, TypedPointer::UInt8.by_ref,TypedPointer::UInt8.by_ref,TypedPointer::UInt8.by_ref], :void
SDL_GetRGBA() click to toggle source
# File lib/sdl2/pixels.rb, line 247
api :SDL_GetRGBA, [:uint32, PixelFormat.by_ref, TypedPointer::UInt8.by_ref,TypedPointer::UInt8.by_ref,TypedPointer::UInt8.by_ref,TypedPointer::UInt8.by_ref], :void
SDL_GetRevision() click to toggle source
# File lib/sdl2/version.rb, line 41
api :SDL_GetRevision, [], :string
SDL_GetRevisionNumber() click to toggle source
# File lib/sdl2/version.rb, line 44
api :SDL_GetRevisionNumber, [], :int
SDL_GetScancodeFromKey() click to toggle source
# File lib/sdl2/keyboard.rb, line 61
api :SDL_GetScancodeFromKey, [:keycode], :scancode
SDL_GetScancodeFromName() click to toggle source
# File lib/sdl2/keyboard.rb, line 67
api :SDL_GetScancodeFromName, [:string], :scancode
SDL_GetScancodeName() click to toggle source
# File lib/sdl2/keyboard.rb, line 64
api :SDL_GetScancodeName, [:scancode], :string
SDL_GetSurfaceAlphaMod() click to toggle source
# File lib/sdl2/surface.rb, line 248
api :SDL_GetSurfaceAlphaMod, [Surface.by_ref,TypedPointer::UInt8.by_ref], :int, {error: true}
SDL_GetSurfaceBlendMode() click to toggle source
# File lib/sdl2/surface.rb, line 254
api :SDL_GetSurfaceBlendMode, [Surface.by_ref, SDL2::TypedPointer::BlendMode.by_ref], :int, {error: true}
SDL_GetSurfaceColorMod() click to toggle source
# File lib/sdl2/surface.rb, line 242
api :SDL_GetSurfaceColorMod, [Surface.by_ref, TypedPointer::UInt8.by_ref,TypedPointer::UInt8.by_ref,TypedPointer::UInt8.by_ref], :int
SDL_GetTicks() click to toggle source
# File lib/sdl2/timer.rb, line 7
api :SDL_GetTicks, [], :uint32
SDL_GetVersion() click to toggle source
# File lib/sdl2/version.rb, line 47
api :SDL_GetVersion, [Version.by_ref], :void
SDL_GetWindowWMInfo() click to toggle source
# File lib/sdl2/syswm.rb, line 36
api :SDL_GetWindowWMInfo, [Window.by_ref, SYSWM::Info.by_ref], :bool
SDL_HapticClose() click to toggle source
# File lib/sdl2/haptic.rb, line 468
api :SDL_HapticClose, [Haptic.by_ref], :void
SDL_HapticDestroyEffect() click to toggle source
# File lib/sdl2/haptic.rb, line 498
api :SDL_HapticDestroyEffect, [Haptic.by_ref, :int], :int
SDL_HapticEffectSupported() click to toggle source
# File lib/sdl2/haptic.rb, line 483
api :SDL_HapticEffectSupported, [Haptic.by_ref, Haptic::Effect.by_ref], :int
SDL_HapticGetEffectStatus() click to toggle source
# File lib/sdl2/haptic.rb, line 501
api :SDL_HapticGetEffectStatus, [Haptic.by_ref, :int], :int
SDL_HapticIndex() click to toggle source
# File lib/sdl2/haptic.rb, line 453
api :SDL_HapticIndex, [Haptic.by_ref], :int
SDL_HapticName() click to toggle source
# File lib/sdl2/haptic.rb, line 444
api :SDL_HapticName, [:int], :string
SDL_HapticNewEffect() click to toggle source
# File lib/sdl2/haptic.rb, line 486
api :SDL_HapticNewEffect, [Haptic.by_ref, Haptic::Effect.by_ref], :int
SDL_HapticNumAxes() click to toggle source
# File lib/sdl2/haptic.rb, line 480
api :SDL_HapticNumAxes, [Haptic.by_ref], :int
SDL_HapticNumEffects() click to toggle source
# File lib/sdl2/haptic.rb, line 471
api :SDL_HapticNumEffects, [Haptic.by_ref], :int
SDL_HapticNumEffectsPlaying() click to toggle source
# File lib/sdl2/haptic.rb, line 474
api :SDL_HapticNumEffectsPlaying, [Haptic.by_ref], :int
SDL_HapticOpen() click to toggle source
# File lib/sdl2/haptic.rb, line 447
api :SDL_HapticOpen, [:int], Haptic.ptr
SDL_HapticOpenFromJoystick() click to toggle source
# File lib/sdl2/haptic.rb, line 465
api :SDL_HapticOpenFromJoystick, [Joystick.by_ref], Haptic.ptr
SDL_HapticOpenFromMouse() click to toggle source
# File lib/sdl2/haptic.rb, line 459
api :SDL_HapticOpenFromMouse, [], Haptic.ptr
SDL_HapticOpened() click to toggle source
# File lib/sdl2/haptic.rb, line 450
api :SDL_HapticOpened, [:int], :int
SDL_HapticPause() click to toggle source
# File lib/sdl2/haptic.rb, line 510
api :SDL_HapticPause, [Haptic.by_ref], :int
SDL_HapticQuery() click to toggle source
# File lib/sdl2/haptic.rb, line 477
api :SDL_HapticQuery, [Haptic.by_ref], :int
SDL_HapticRumbleInit() click to toggle source
# File lib/sdl2/haptic.rb, line 522
api :SDL_HapticRumbleInit, [Haptic.by_ref], :int
SDL_HapticRumblePlay() click to toggle source
# File lib/sdl2/haptic.rb, line 525
api :SDL_HapticRumblePlay, [Haptic.by_ref], :int
SDL_HapticRumbleStop() click to toggle source
# File lib/sdl2/haptic.rb, line 528
api :SDL_HapticRumbleStop, [Haptic.by_ref], :int
SDL_HapticRumbleSupported() click to toggle source
# File lib/sdl2/haptic.rb, line 519
api :SDL_HapticRumbleSupported, [Haptic.by_ref], :int
SDL_HapticRunEffect() click to toggle source
# File lib/sdl2/haptic.rb, line 492
api :SDL_HapticRunEffect, [Haptic.by_ref, :int, :uint32], :int
SDL_HapticSetAutocenter() click to toggle source
# File lib/sdl2/haptic.rb, line 507
api :SDL_HapticSetAutocenter, [Haptic.by_ref, :int], :int
SDL_HapticSetGain() click to toggle source
# File lib/sdl2/haptic.rb, line 504
api :SDL_HapticSetGain, [Haptic.by_ref, :int], :int
SDL_HapticStopAll() click to toggle source
# File lib/sdl2/haptic.rb, line 516
api :SDL_HapticStopAll, [Haptic.by_ref], :int
SDL_HapticStopEffect() click to toggle source
# File lib/sdl2/haptic.rb, line 495
api :SDL_HapticStopEffect, [Haptic.by_ref, :int], :int
SDL_HapticUnpause() click to toggle source
# File lib/sdl2/haptic.rb, line 513
api :SDL_HapticUnpause, [Haptic.by_ref], :int
SDL_HapticUpdateEffect() click to toggle source
# File lib/sdl2/haptic.rb, line 489
api :SDL_HapticUpdateEffect, [Haptic.by_ref, :int, Haptic::Effect.by_ref], :int
SDL_Has3DNow() click to toggle source
# File lib/sdl2/cpuinfo.rb, line 21
api :SDL_Has3DNow, [], :bool
SDL_HasAltiVec() click to toggle source
# File lib/sdl2/cpuinfo.rb, line 18
api :SDL_HasAltiVec, [], :bool
SDL_HasClipboardText() click to toggle source
# File lib/sdl2/clipboard.rb, line 32
api :SDL_HasClipboardText, [], :bool
SDL_HasIntersection() click to toggle source

Determine whether two rectangles intersect.

# File lib/sdl2/rect.rb, line 121
api :SDL_HasIntersection, [Rect.by_ref, Rect.by_ref], :bool
SDL_HasRDTSC() click to toggle source
# File lib/sdl2/cpuinfo.rb, line 15
api :SDL_HasRDTSC, [], :bool
SDL_HasSSE() click to toggle source
# File lib/sdl2/cpuinfo.rb, line 24
api :SDL_HasSSE, [], :bool
SDL_HasSSE2() click to toggle source
# File lib/sdl2/cpuinfo.rb, line 27
api :SDL_HasSSE2, [], :bool
SDL_HasSSE3() click to toggle source
# File lib/sdl2/cpuinfo.rb, line 30
api :SDL_HasSSE3, [], :bool
SDL_HasSSE41() click to toggle source
# File lib/sdl2/cpuinfo.rb, line 33
api :SDL_HasSSE41, [], :bool
SDL_HasSSE42() click to toggle source
# File lib/sdl2/cpuinfo.rb, line 36
api :SDL_HasSSE42, [], :bool
SDL_HasScreenKeyboardSupport() click to toggle source
# File lib/sdl2/keyboard.rb, line 88
api :SDL_HasScreenKeyboardSupport, [], :bool
SDL_InitSubSystem() click to toggle source
# File lib/sdl2/init.rb, line 29
api :SDL_InitSubSystem, [:init_flag], :int, {error: true}
SDL_IntersectRect() click to toggle source

Calculate the intersection of two rectangles.

# File lib/sdl2/rect.rb, line 124
api :SDL_IntersectRect, [Rect.by_ref, Rect.by_ref, Rect.by_ref], :bool
SDL_IntersectRectAndLine() click to toggle source

Calculate the intersection of a rectangle and a line segment.

# File lib/sdl2/rect.rb, line 133
api :SDL_IntersectRectAndLine, [Rect.by_ref, :int, :int, :int, :int], :bool
SDL_IsGameController() click to toggle source
# File lib/sdl2/gamecontroller.rb, line 44
api :SDL_IsGameController, [:joystick_index], :bool
SDL_IsScreenKeyboardShown() click to toggle source
# File lib/sdl2/keyboard.rb, line 91
api :SDL_IsScreenKeyboardShown, [], :bool
SDL_IsTextInputActive() click to toggle source
# File lib/sdl2/keyboard.rb, line 79
api :SDL_IsTextInputActive, [], :bool
SDL_JoystickIsHaptic() click to toggle source
# File lib/sdl2/haptic.rb, line 462
api :SDL_JoystickIsHaptic, [Joystick.by_ref], :int
SDL_LoadBMP_RW() click to toggle source
# File lib/sdl2/surface.rb, line 209
api :SDL_LoadBMP_RW, [RWops.by_ref, :int], Surface.ptr
SDL_LoadDollarTemplates() click to toggle source
# File lib/sdl2/gesture.rb, line 21
api :SDL_LoadDollarTemplates, [:touch_id, RWops.by_ref], :int
SDL_LoadWAV_RW() click to toggle source
# File lib/sdl2/audio.rb, line 145
api :SDL_LoadWAV_RW, [RWops.by_ref, :int, Audio::Spec.by_ref, :pointer, :pointer], Audio::Spec.by_ref
SDL_LockAudio() click to toggle source
# File lib/sdl2/audio.rb, line 171
api :SDL_LockAudio, [], :void
SDL_LockAudioDevice() click to toggle source
# File lib/sdl2/audio.rb, line 174
api :SDL_LockAudioDevice, [:audio_device_id], :void
SDL_LockSurface() click to toggle source
# File lib/sdl2/surface.rb, line 203
api :SDL_LockSurface, [Surface.by_ref], :int
SDL_Log() click to toggle source
# File lib/sdl2/log.rb, line 89
api :SDL_Log, [:string, :varargs], :void
SDL_LogCritical() click to toggle source
# File lib/sdl2/log.rb, line 92
api :SDL_LogCritical, [:log_category, :string, :varargs], :void
SDL_LogDebug() click to toggle source
# File lib/sdl2/log.rb, line 95
api :SDL_LogDebug, [:log_category, :string, :varargs], :void
SDL_LogError() click to toggle source
# File lib/sdl2/log.rb, line 98
api :SDL_LogError, [:log_category, :string, :varargs], :void
SDL_LogGetOutputFunction() click to toggle source
# File lib/sdl2/log.rb, line 122
api :SDL_LogGetOutputFunction, [:log_output_function, :pointer], :void
SDL_LogGetPriority() click to toggle source
# File lib/sdl2/log.rb, line 131
api :SDL_LogGetPriority, [:log_category], :log_priority
SDL_LogInfo() click to toggle source
# File lib/sdl2/log.rb, line 101
api :SDL_LogInfo, [:log_category, :string, :varargs], :void
SDL_LogMessage() click to toggle source
# File lib/sdl2/log.rb, line 110
api :SDL_LogMessage, [:log_category, :log_priority, :string, :varargs], :void
SDL_LogMessageV() click to toggle source
# File lib/sdl2/log.rb, line 113
api :SDL_LogMessageV, [:log_category, :log_priority, :string, :varargs], :void
SDL_LogResetPriorities() click to toggle source
# File lib/sdl2/log.rb, line 116
api :SDL_LogResetPriorities, [], :void
SDL_LogSetAllPriority() click to toggle source
# File lib/sdl2/log.rb, line 119
api :SDL_LogSetAllPriority, [:log_priority], :void
SDL_LogSetOutputFunction() click to toggle source
# File lib/sdl2/log.rb, line 125
api :SDL_LogSetOutputFunction, [:log_output_function, :pointer], :void
SDL_LogSetPriority() click to toggle source
# File lib/sdl2/log.rb, line 128
api :SDL_LogSetPriority, [:log_category, :log_priority], :void
SDL_LogVerbose() click to toggle source
# File lib/sdl2/log.rb, line 104
api :SDL_LogVerbose, [:log_category, :string, :varargs], :void
SDL_LogWarn() click to toggle source
# File lib/sdl2/log.rb, line 107
api :SDL_LogWarn, [:log_category, :string, :varargs], :void
SDL_LowerBlit() click to toggle source
# File lib/sdl2/surface.rb, line 290
api :SDL_LowerBlit, [Surface.by_ref, Rect.by_ref, Surface.by_ref, Rect.by_ref], :int
SDL_LowerBlitScaled() click to toggle source
# File lib/sdl2/surface.rb, line 307
api :SDL_LowerBlitScaled, [Surface.by_ref, Rect.by_ref, Surface.by_ref, Rect.by_ref], :int
SDL_MapRGB() click to toggle source
# File lib/sdl2/pixels.rb, line 238
api :SDL_MapRGB, [PixelFormat.by_ref, :uint8, :uint8, :uint8], :uint32
SDL_MapRGBA() click to toggle source
# File lib/sdl2/pixels.rb, line 241
api :SDL_MapRGBA, [PixelFormat.by_ref, :uint8, :uint8, :uint8, :uint8], :uint32
SDL_MasksToPixelFormatEnum() click to toggle source
# File lib/sdl2/pixels.rb, line 217
api :SDL_MasksToPixelFormatEnum, [:int, :uint32, :uint32, :uint32, :uint32], :pixel_format
SDL_MixAudio() click to toggle source
# File lib/sdl2/audio.rb, line 165
api :SDL_MixAudio, [:pointer, :pointer, :uint32, :int], :void
SDL_MixAudioFormat() click to toggle source
# File lib/sdl2/audio.rb, line 168
api :SDL_MixAudioFormat, [:pointer, :pointer, :audio_format, :uint32, :int], :void
SDL_MouseIsHaptic() click to toggle source
# File lib/sdl2/haptic.rb, line 456
api :SDL_MouseIsHaptic, [], :int
SDL_NumHaptics() click to toggle source

Get the number of haptics?

# File lib/sdl2/haptic.rb, line 441
api :SDL_NumHaptics, [], :int
SDL_OpenAudio() click to toggle source
# File lib/sdl2/audio.rb, line 118
api :SDL_OpenAudio, [Audio::Spec.by_ref, Audio::Spec.by_ref], :int
SDL_OpenAudioDevice() click to toggle source
# File lib/sdl2/audio.rb, line 130
api :SDL_OpenAudioDevice, [:string, :int, Audio::Spec.by_ref, Audio::Spec.by_ref, :int], :audio_device_id
SDL_PauseAudio() click to toggle source
# File lib/sdl2/audio.rb, line 139
api :SDL_PauseAudio, [:int], :void
SDL_PauseAudioDevice() click to toggle source
# File lib/sdl2/audio.rb, line 142
api :SDL_PauseAudioDevice, [:audio_device_id, :int], :void
SDL_PixelFormatEnumToMasks() click to toggle source
# File lib/sdl2/pixels.rb, line 214
api :SDL_PixelFormatEnumToMasks, [:pixel_format, TypedPointer::Int.by_ref, TypedPointer::UInt32.by_ref, TypedPointer::UInt32.by_ref,TypedPointer::UInt32.by_ref,TypedPointer::UInt32.by_ref,], :bool
SDL_Quit() click to toggle source
# File lib/sdl2/init.rb, line 46
api :SDL_Quit, [], :void
SDL_QuitSubSystem() click to toggle source
# File lib/sdl2/init.rb, line 50
api :SDL_QuitSubSystem, [:init_flag], :void
SDL_RWFromConstMem() click to toggle source

Load from “constant” memory

*  mem - constant pointer
*  size - integer
# File lib/sdl2/rwops.rb, line 180
api :SDL_RWFromConstMem, [:pointer, :count], RWops.ptr, {error: true, filter: OK_WHEN_NOT_NULL}
SDL_RWFromFP() click to toggle source

Load from a file pointer

*  fp - a file pointer
*  autoclose - boolean
# File lib/sdl2/rwops.rb, line 170
api :SDL_RWFromFP, [:pointer, :bool], RWops.ptr, {error: true, filter: OK_WHEN_NOT_NULL}
SDL_RWFromFile() click to toggle source

Load from a file

*  file - filename string (existing)
*  mode - mode string
# File lib/sdl2/rwops.rb, line 165
api :SDL_RWFromFile, [:string, :string], RWops.ptr, {error: true, filter: OK_WHEN_NOT_NULL}
SDL_RWFromMem() click to toggle source

Load from any pointer in memory

*  mem - pointer
*  size - integer
# File lib/sdl2/rwops.rb, line 175
api :SDL_RWFromMem, [:pointer, :count], RWops.ptr, {error: true, filter: OK_WHEN_NOT_NULL}
SDL_ReadBE16() click to toggle source

Read 16 bytes big endian

# File lib/sdl2/rwops.rb, line 195
api :SDL_ReadBE16, [RWops.by_ref], :uint16
SDL_ReadBE32() click to toggle source

Read 32 bytes big endian

# File lib/sdl2/rwops.rb, line 201
api :SDL_ReadBE32, [RWops.by_ref], :uint32
SDL_ReadBE64() click to toggle source

Read 32 bytes big endian

# File lib/sdl2/rwops.rb, line 207
api :SDL_ReadBE64, [RWops.by_ref], :uint64
SDL_ReadLE16() click to toggle source

Read 16 bytes little endian

# File lib/sdl2/rwops.rb, line 192
api :SDL_ReadLE16, [RWops.by_ref], :uint16
SDL_ReadLE32() click to toggle source

Read 32 bytes little endian

# File lib/sdl2/rwops.rb, line 198
api :SDL_ReadLE32, [RWops.by_ref], :uint32
SDL_ReadLE64() click to toggle source

Read 64 bytes little endian

# File lib/sdl2/rwops.rb, line 204
api :SDL_ReadLE64, [RWops.by_ref], :uint64
SDL_ReadU8() click to toggle source

Read 8 bytes

# File lib/sdl2/rwops.rb, line 189
api :SDL_ReadU8, [RWops.by_ref], :uint8
SDL_RecordGesture() click to toggle source
# File lib/sdl2/gesture.rb, line 12
api :SDL_RecordGesture, [:touch_id], :int
SDL_RemoveTimer() click to toggle source
# File lib/sdl2/timer.rb, line 27
api :SDL_RemoveTimer, [:timer_id], :bool  
SDL_SaveAllDollarTemplates() click to toggle source
# File lib/sdl2/gesture.rb, line 15
api :SDL_SaveAllDollarTemplates, [RWops.by_ref], :int
SDL_SaveBMP_RW() click to toggle source
# File lib/sdl2/surface.rb, line 220
api :SDL_SaveBMP_RW, [Surface.by_ref, RWops.by_ref, :int], :int
SDL_SaveDollarTemplate() click to toggle source
# File lib/sdl2/gesture.rb, line 18
api :SDL_SaveDollarTemplate, [:gesture_id, RWops.by_ref], :int
SDL_SetClipRect() click to toggle source
# File lib/sdl2/surface.rb, line 257
api :SDL_SetClipRect, [Surface.by_ref, Rect.by_ref], :int, {error: true}
SDL_SetClipboardText() click to toggle source
# File lib/sdl2/clipboard.rb, line 26
api :SDL_SetClipboardText, [:string], :int
SDL_SetColorKey() click to toggle source
# File lib/sdl2/surface.rb, line 231
api :SDL_SetColorKey, [Surface.by_ref, :bool, :uint32], :int, {error: true}
SDL_SetError() click to toggle source

Set current SDL error string.

# File lib/sdl2/error.rb, line 15
api :SDL_SetError, [:string, :varargs], :int
SDL_SetHint() click to toggle source
# File lib/sdl2/hints.rb, line 64
api :SDL_SetHint, [:string, :string], :bool, {error: true}
SDL_SetHintWithPriority() click to toggle source
# File lib/sdl2/hints.rb, line 67
api :SDL_SetHintWithPriority, [:string, :string, :hint_priority], :bool
SDL_SetModState() click to toggle source
# File lib/sdl2/keyboard.rb, line 55
api :SDL_SetModState, [:keymod], :void
SDL_SetPaletteColors() click to toggle source
# File lib/sdl2/pixels.rb, line 232
api :SDL_SetPaletteColors, [Palette.by_ref, :pointer, :int, :count], :int
SDL_SetPixelFormatPalette() click to toggle source
# File lib/sdl2/pixels.rb, line 229
api :SDL_SetPixelFormatPalette, [PixelFormat.by_ref, Palette.by_ref], :int
SDL_SetSurfaceAlphaMod() click to toggle source
# File lib/sdl2/surface.rb, line 245
api :SDL_SetSurfaceAlphaMod, [Surface.by_ref, :uint8], :int, {error: true}
SDL_SetSurfaceBlendMode() click to toggle source
# File lib/sdl2/surface.rb, line 251
api :SDL_SetSurfaceBlendMode, [Surface.by_ref, :blend_mode], :int, {error: true}
SDL_SetSurfaceColorMod() click to toggle source
# File lib/sdl2/surface.rb, line 239
api :SDL_SetSurfaceColorMod, [Surface.by_ref, :uint8, :uint8, :uint8], :int
SDL_SetSurfacePalette() click to toggle source
# File lib/sdl2/surface.rb, line 200
api :SDL_SetSurfacePalette, [Surface.by_ref, Palette.by_ref], :int, {error: true}
SDL_SetSurfaceRLE() click to toggle source
# File lib/sdl2/surface.rb, line 228
api :SDL_SetSurfaceRLE, [Surface.by_ref, :int], :int
SDL_SetTextInputRect() click to toggle source
# File lib/sdl2/keyboard.rb, line 85
api :SDL_SetTextInputRect, [Rect.by_ref], :void
SDL_SoftStretch() click to toggle source
# File lib/sdl2/surface.rb, line 293
api :SDL_SoftStretch, [Surface.by_ref, Rect.by_ref, Surface.by_ref, Rect.by_ref], :int
SDL_StartTextInput() click to toggle source
# File lib/sdl2/keyboard.rb, line 76
api :SDL_StartTextInput, [], :void
SDL_StopTextInput() click to toggle source
# File lib/sdl2/keyboard.rb, line 82
api :SDL_StopTextInput, [], :void
SDL_UnionRect() click to toggle source

Calculate the union of two rectangles.

# File lib/sdl2/rect.rb, line 127
api :SDL_UnionRect, [Rect.by_ref, Rect.by_ref, Rect.by_ref], :void
SDL_UnlockAudio() click to toggle source
# File lib/sdl2/audio.rb, line 177
api :SDL_UnlockAudio, [], :void
SDL_UnlockAudioDevice() click to toggle source
# File lib/sdl2/audio.rb, line 180
api :SDL_UnlockAudioDevice, [:audio_device_id], :void
SDL_UnlockSurface() click to toggle source
# File lib/sdl2/surface.rb, line 206
api :SDL_UnlockSurface, [Surface.by_ref], :void
SDL_UpperBlit() click to toggle source
# File lib/sdl2/surface.rb, line 278
api :SDL_UpperBlit, [Surface.by_ref, Rect.by_ref, Surface.by_ref, Rect.by_ref], :int, {error: true}
SDL_UpperBlitScaled() click to toggle source
# File lib/sdl2/surface.rb, line 296
api :SDL_UpperBlitScaled, [Surface.by_ref, Rect.by_ref, Surface.by_ref, Rect.by_ref], :int
SDL_WasInit() click to toggle source
# File lib/sdl2/init.rb, line 40
api :SDL_WasInit, [:init_flag], :uint32
SDL_WriteBE16() click to toggle source

Write 16 bytes big endian

# File lib/sdl2/rwops.rb, line 217
api :SDL_WriteBE16, [RWops.by_ref, :uint16], :size_t
SDL_WriteBE32() click to toggle source

Write 32 bytes big endian

# File lib/sdl2/rwops.rb, line 223
api :SDL_WriteBE32, [RWops.by_ref, :uint32], :size_t
SDL_WriteBE64() click to toggle source

Write 64 bytes big endian

# File lib/sdl2/rwops.rb, line 229
api :SDL_WriteBE64, [RWops.by_ref, :uint64], :size_t
SDL_WriteLE16() click to toggle source

Write 16 bytes little endian

# File lib/sdl2/rwops.rb, line 214
api :SDL_WriteLE16, [RWops.by_ref, :uint16], :size_t
SDL_WriteLE32() click to toggle source

Write 32 bytes little endian

# File lib/sdl2/rwops.rb, line 220
api :SDL_WriteLE32, [RWops.by_ref, :uint32], :size_t
SDL_WriteLE64() click to toggle source

Write 64 bytes little endian

# File lib/sdl2/rwops.rb, line 226
api :SDL_WriteLE64, [RWops.by_ref, :uint64], :size_t
SDL_WriteU8() click to toggle source

Write 8 bytes

# File lib/sdl2/rwops.rb, line 211
api :SDL_WriteU8, [RWops.by_ref, :uint8], :size_t
event_filter() click to toggle source

callback event_filter #=> Proc.new do |pointer, event|; return int; end

# File lib/sdl2/events.rb, line 36
callback :event_filter, [:pointer, Event.by_ref], :int
get_event_state(type) click to toggle source
# File lib/sdl2/events.rb, line 59
def get_event_state(type)
  event_state(type, EVENTSTATE::QUERY)
end
init_sub_system!(flags) click to toggle source
# File lib/sdl2/init.rb, line 31
def init_sub_system!(flags)
  error_code = init_sub_system(flags)
  if (error_code != 0)
    throw get_error
  end
end
unknown() click to toggle source

StructHelper defines a couple of handy macros, useful in structures and unions.

# File lib/sdl2.rb, line 14
autoload(:StructHelper, 'sdl2/struct_helper')