package stk
Install
dune-project
Dependency
Authors
Maintainers
Sources
md5=84927cce2b859a484df176163a68a21c
sha512=7d79d0b18c1550d59932ec27e5162f5ec5cfeb6560de32224cc7915f392e11d2c2fd94c44128b4b828b6ed700c2f079d120b2423874d71544e71bbab9253e870
doc/stk/Stk/App/index.html
Module Stk.AppSource
STK application.
The way SDL events are handled.
`Detachedmeans that events are handled in a detached Lwt thread,`Lwt_enginewill register event handling in Lwt loop.
The application.
val init :
?force_mouse_focus_clickthrough:bool ->
?window_flags:Tsdl.Sdl.Window.flags ->
?renderer_flags:Tsdl.Sdl.Renderer.flags option ->
?event_delay:int ->
?sdl_events_mode:sdl_events_mode ->
unit ->
unit Lwt.tInitializing the application. Optional arguments:
force_mouse_focus_clickthroughwill set the MOUSE_FOCUS_CLICKTHROUGH hint. Default istrue.window_flagssets the default flags used when creating windows. Default is no flag.renderer_flagssets the default flags used when creating windows. If not provided, the content of theSTK_APP_RENDERER_FLAGSenvironment variable is used to retrieve comma-separatd list of flags (among "software", "accelerated", "presentvsync" and "targettexture"). For example, to use the accelerated renderer by default, you can run your application with$ STK_APP_RENDERER_FLAGS=accelerated,presentvsync ./my_app
event_delayindicates the timeout delay (in ms) when polling events (in`Detachedmode) or the timer delay (in`Lwt_enginemode).sdl_events_modesets the way to handle sdl events. Default is`Lwt_engine.
Note that when the application is initialized, it is not run yet and run must be called to handle events.
Returns the application. Raises Failure if application is not initialized.
val create_window :
?modal_for:Window.window ->
?flags:Tsdl.Sdl.Window.flags ->
?rflags:Tsdl.Sdl.Renderer.flags ->
?resizable:bool ->
?show:bool ->
?x:int ->
?y:int ->
?w:int ->
?h:int ->
string ->
Window.windowcreate_window title creates a new window with the given title. Application must have been initialized.
Windows should be created with this function rather than directly using function and classes of the Window module, because they must be registered in the application, so that events are correctly propagated.
Optional arguments:
modal_forcan be used to block a given window while the new window is not closed.flagsare passed to SDL to create the window. Default flags are the application window flags.rflagsare passed to SDL to create the window renderer. Default flags are the application renderer flags.resizablespecifies whether to add the resizable flag to windows flags.showspecifies whether to show the window after its creation (default istrue).xsets the initial x position of the window.ysets the initial y position of the window.wsets the initial width of the window.hsets the initial height of the window.
Note that when the window is not resizable, then it will have automatic width if no width is specified and automatic height if no height is specified. Automatic means depending of the contents required min width and height.
val create_scrolled_window :
?modal_for:Window.window ->
?flags:Tsdl.Sdl.Window.flags ->
?rflags:Tsdl.Sdl.Renderer.flags ->
?resizable:bool ->
?show:bool ->
?x:int ->
?y:int ->
w:int ->
h:int ->
?hpolicy:Bin.PScrollbar_policy.t ->
?vpolicy:Bin.PScrollbar_policy.t ->
string ->
Window.window * Bin.scrollboxSame as create_window but creates also a Bin.scrollbox, which is has child of the window and returned. The child of the window being a Bin.scrollbox, it has no minimum width and height, so w and h arguments are mandatory when creating the window. Additional optional arguments:
hpolicypolicy to display horizontal scrollbar.vpolicypolicy to display vertical scrollbar.
close_windows () closes all the windows of the application.
quit () closes all windows and stop the application.
window_from_sdl window_id returns the Window.window having the SDL window with id window_id, if it exists. The function also returns a flag indicating whether the window is a menu window.
popup_menu widget creates and display a menu window, i.e. e window with no decoration. Menu windows are handled specially, being all closed usually when a menu item is activated. Optional arguments:
x: initial x position of the window.y: initial y position of the window.on_close: callback called when the window is closed. the boolean argument indicates whether this is the last menu window to be closed.
close_menu_windows () closes all menu windows.