home
 
 index of namespace default
 
 index of project tksdl
 
 index of module tksdl

Class tksdl.SDL


SynopsisStatic wrapper class for the SDL library. 

  Base classes:
  Methods:
  Constants: Description:


Please notice that some functionality is placed in separate classes (Mouse, Viewport, AudioDevice, Cursor, FPS)
This class uses the following signals/callbacks:
- onKeyboard(Key k) - Called when a key was pressed or released - onMouse(int absx, int absy, int currbuttonstate, int changedbuttonstate) - Called when a mouse event occured - onJoyAxisMotion(int dev, int axis, int val) - onJoyButton(int dev, int button, int pressed) - onJoyHatMotion(int dev, int hat, int state) - onJoyBallMotion(int dev, int hat, int dx, int dy) - onDraw() - Called when window/view needs to be redrawn - onOpen() - Called after window/view has been opened - onClose() - Called when window/view is about to be closed. By returning false in the callback function, the window/view can be prevented from closing (e.g. if the user has clicked the window close button) - onResize() - Called after window/view has been resized (onOpen() is called immediately after) - onEvent(Event ev) - Called when user event has been received (see sendEvent()()) - onExpose() - Called when (parts) of the window/view have become visible - onApplicationActive(boolean bActive) - Called when application window/view becomes active - onMouseFocusActive(boolean bActive) - onInputFocusActive(boolean bActive) - onIdle() - **Deprecated**, only called regularly when event polling is enabled (see setEventPolling()()) - onDropFiles() - Called when one or more files were dragged and dropped onto the window/view [win32 only] - onTimer() - Called from timer thread when interval has been configured using setTimerInterval().


 
 top of page
Method delay
Deprecated:  Use TKS.sleep()() instead
Suspend thread for the given number of millisec
Signature
delay(intmillisec)
Arguments
intmillisec

 
 top of page
Method enableKeyRepeat
Deprecated:  Since this is a global setting it is recommend to use the tkui (per widget) keyrepeat mechanism instead
Configure SDL key repeat
Signature
enableKeyRepeat(intdelay,
  intrate 
  )  
Arguments
intdelay
intrate
Description

This is a wrapper for the SDL_EnableKeyRepeat() native function.

 
 top of page
Method enableUNICODE
Configure whether unicode conversion shall be performed when processing keyboard events
Signature
enableUNICODE(booleanbEnabled)
Arguments
booleanbEnabled
Description

This is a wrapper for the SDL_EnableUNICODE() native function.

 
 top of page
Method eventLoop
Enter SDL event loop.
Signature
eventLoop()
Description
This method does not return until the window is closed resp. exitEventLoop() is called.
See also:  


 
 top of page
Method exitEventLoop
Exit SDL event loop.
Signature
exitEventLoop()
Description

This causes the eventLoop() method to return.
See also:  


 
 top of page
Method getEventPolling
Query whether blocking waits shall be used when retrieving the next SDL message
Signature
getEventPolling():boolean
Returns
boolean

 
 top of page
Method getJoystick
Return Joystick device object
Signature
getJoystick(intdev)
 :Joystick
Arguments
intdev
Returns

 
 top of page
Method getNumJoysticks
Query number of available joystick devices.
Signature
getNumJoysticks():int
Returns
int

 
 top of page
Method getRedrawFlag
Query redraw behaviour
Signature
getRedrawFlag():int
Returns
int

 
 top of page
Method getTicks
Deprecated:  Use the milliSeconds()() core function instead
Return number of ticks (millisec) since app. start
Signature
getTicks():int
Returns
int
See also:  


 
 top of page
Method getTimerInterval
Query timer interval.
Signature
getTimerInterval():int
Returns
intCurrent timer interval (milliseconds)

 
 top of page
Method isApplicationActive
Query whether the application windows is currently in the foreground.
Signature
isApplicationActive():boolean
Returns
boolean

 
 top of page
Method reportJoystickEvent
Configure whether joystick events shall be reported
Signature
reportJoystickEvent(booleanbEnable)
Arguments
booleanbEnable
Description

This is a wrapper for the SDL_JoystickEventState() native function.

 
 top of page
Method sendEvent
Post event message to event queue
Signature
sendEvent(Stringev)
Arguments
Stringev
Description

Useful for asynchronous thread communication.
This method is usually called from a thread different to the main/UI thread.

 
 top of page
Method setEventPolling
Configure whether blocking waits shall be used when retrieving the next SDL message
Signature
setEventPolling(booleanbEnabled)
Arguments
booleanbEnabledIf true, enable event polling (CPU intensive). It is recommended to set this to false and use the onTimer() callback instead of onIdle(). If event polling is disabled, onIdle() will only be called when a window event occurs.

 
 top of page
Method setRedrawFlag
Control redraw behaviour
Signature
setRedrawFlag(intflags)
Arguments
intflagsREDRAW_ALL = redraw everytime REDRAW_DIRTY = only redraw if Viewport.needRedraw()() was called

 
 top of page
Method setTimerInterval
Set timer interval for onTimer() signal/callback.
Signature
setTimerInterval(intintervalMillisec)
Arguments
intintervalMillisecTimer interval (milliseconds). 0 disables the timer.
Description

The timer is started when eventLoop()() is called and stops when exitEventLoop()() is called.
Warning: The timer callback runs in its own thread.

 
 top of page
Method triggerEvent
Deprecated:  Call your event handler directly instead
Immediately send user event
Signature
triggerEvent(Stringev)
Arguments
Stringev
See also:  


 
 top of page
Method updateJoysticks
Update joystick state
Signature
updateJoysticks()
Description

This is a wrapper for the SDL_JoystickUpdate() native function.

 
 top of page
Constant DEFAULT_KEYBOARD_REPEAT_DELAY (int)
Constant DEFAULT_KEYBOARD_REPEAT_INTERVAL (int)
Constant MOUSE_LBUTTON (int)
Constant MOUSE_MBUTTON (int)
Constant MOUSE_POINTER_ENTER (int)
Constant MOUSE_POINTER_MANUAL (int)
Constant MOUSE_POINTER_MOVE (int)
Constant MOUSE_RBUTTON (int)
Constant MOUSE_WHEELDOWN (int)
Constant MOUSE_WHEELUP (int)
Constant REDRAW_ALL (int)
Constant REDRAW_DIRTY (int)
Constant SDL_NOFRAME (int)
Constant SDL_RESIZABLE (int)

 

Project Modules:tksdl 
Project Classes:AudioDevice , AudioSample , Cursor , FPS , Joystick , Key , Mouse , SamplePlayer , SDL , Viewport 
Project Functions:MIDINoteToFrequency 
All Namespaces:default , ui 
All Projects:core , debugtext , tkfreetype2 , tkmath , tkmidi , tkopengl , tkportaudio , tksdl , tkui , tkunit 


auto-generated by "DOG", the TkScript document generator. Mon, 28/Dec/2015 13:15:54