Skip to content
chrisd1100 edited this page May 13, 2023 · 6 revisions

Application, window, and input management.

Use these function to create a "libmatoya app", which handles window creation and input event handling via an MTY_EventFunc. This module wrangles many different dependencies under the hood responsible for input handling, graphics API context creation, window creation, and event loop processing.

Functions

Name Brief
MTY_AppCreate Create an MTY_App that handles input and window creation.
MTY_AppDestroy Destroy an MTY_App.
MTY_AppRun Run the app and begin executing its MTY_AppFunc and MTY_EventFunc.
MTY_AppSetTimeout Set the frequency of an app's MTY_AppFunc if it is not blocked by other means.
MTY_AppIsActive Check if an app is currently focused and in the foreground.
MTY_AppActivate Activate or deactivate the app.
MTY_AppSetTray Set a system tray icon for the app.
MTY_AppRemoveTray Remove the tray icon associated with the app.
MTY_AppSendNotification Send a system-wide notification (toast).
MTY_AppGetClipboard Get the current text content of the clipboard.
MTY_AppSetClipboard Set the current text content of the clipboard.
MTY_AppStayAwake Keep the system from going to sleep.
MTY_AppGetDetachState Get the app's current detach state.
MTY_AppSetDetachState Detach mouse/keyboard grab or relative mouse behavior temporarily.
MTY_AppIsMouseGrabbed Check if the mouse is grabbed.
MTY_AppGrabMouse Grab the mouse, preventing the cursor from exiting the current window.
MTY_AppGetRelativeMouse Check if relative mouse mode is set.
MTY_AppSetRelativeMouse Set relative mouse mode on or off.
MTY_AppSetRGBACursor Set the app's cursor to an RGBA image.
MTY_AppSetPNGCursor Set the app's cursor to a PNG image.
MTY_AppSetCursor Use a cursor predefined by the OS.
MTY_AppShowCursor Show or hide the cursor.
MTY_AppCanWarpCursor Check if the app is able to warp the cursor.
MTY_AppIsKeyboardGrabbed Check if the keyboard is currently grabbed.
MTY_AppGrabKeyboard Grab the keyboard, capturing certain keys usually handled by the OS.
MTY_AppGetHotkey Get a previously set hotkey's id.
MTY_AppSetHotkey Set a hotkey combination.
MTY_AppRemoveHotkeys Remove all hotkeys.
MTY_AppEnableGlobalHotkeys Temporarily enable or disable the currently set globally scoped hotkeys.
MTY_AppIsSoftKeyboardShowing Check if the software keyboard is showing.
MTY_AppShowSoftKeyboard Show or hide the software keyboard.
MTY_AppGetOrientation Get the device's orientation.
MTY_AppSetOrientation Set the devices orientation.
MTY_AppRumbleController Set the rumble state on a controller.
MTY_AppGetControllerDeviceName Get the device name of a controller.
MTY_AppGetControllerType Get the type of controller.
MTY_AppSubmitHIDReport Submit an HID output report to a controller.
MTY_AppIsPenEnabled Check if pen events are enabled.
MTY_AppEnablePen Enable or disable pen events.
MTY_AppGetInputMode Get the app's current mobile input mode.
MTY_AppSetInputMode Set the app's current mobile input mode.
MTY_AppSetWMsgFunc Set a custom window message handler for the app.
MTY_WindowCreate Create an MTY_Window, the primary interactive view of an application.
MTY_WindowDestroy Destroy an MTY_Window.
MTY_WindowGetSize Get a window's current client area width and height.
MTY_WindowGetFrame Get a window's normalized size and position.
MTY_WindowSetFrame Set a window's size and position.
MTY_WindowSetMinSize Set a window's minimum size.
MTY_WindowGetScreenSize Get the width and height of the screen where the window currently resides.
MTY_WindowGetScreenScale Get the scaling factor of the screen where the window currently resides.
MTY_WindowSetTitle Set the window's title.
MTY_WindowIsVisible Check if the window is at least partially visible.
MTY_WindowIsActive Check if the window is currently in the foreground and focused.
MTY_WindowActivate Activate or deactivate a window.
MTY_WindowExists Check if the window exists.
MTY_WindowIsFullscreen Check if the window is in fullscreen mode.
MTY_WindowSetFullscreen Put a window into or out of fullscreen mode.
MTY_WindowWarpCursor Move the cursor to a specified location within a window.
MTY_WindowDrawQuad Draw a quad with a raw image and MTY_RenderDesc.
MTY_WindowClear Clear the window surface to a solid color.
MTY_WindowDrawUI Draw a UI with MTY_DrawData.
MTY_WindowHasUITexture Check if a texture with id has been set.
MTY_WindowSetUITexture Set an RGBA texture image for use in MTY_DrawData.
MTY_WindowPresent Present all pending draw operations.
MTY_WindowGetGFX Get the current graphics API in use by the window.
MTY_WindowSetGFX Set the window's graphics API.
MTY_GetAvailableGFX Get a list of available graphics APIs on the current OS.
MTY_GetDefaultGFX Get the default graphics API for the current OS.
MTY_WindowGetContextState Get the graphics context's current state.
MTY_WindowGetNative Get the OS's native window.
MTY_WindowSetWebView Set a WebView overlaying a native window.
MTY_WindowRemoveWebView Remove the WebView from a window.
MTY_WebViewNavigate Navigate the WebView to a given URL or HTML string.
MTY_WebViewExists Check if a WebView exists on a window.
MTY_WebViewShow Show or hide the WebView.
MTY_WebViewIsVisible Check if the WebView is visible.
MTY_WebViewSendText Send text to the WebView's JavaScript environment.
MTY_WebViewReload Reload the WebView.
MTY_WebViewSetInputPassthrough Enable or disable input passthrough from the WebView.
MTY_WebViewIsSteam Check if libmatoya is using the Steam API for its WebView implementation.
MTY_MakeDefaultFrame Fill an MTY_Frame taking the current display settings into account.
MTY_HotkeyToString Get the string representation of a key combination.
MTY_SetAppID Set the app's id.
MTY_PrintEvent Print an MTY_Event to stdout.
MTY_GLGetProcAddress If using MTY_GFX_GL, retrieve a GL function by its name.
MTY_RunAndYield Runs a loop while also allowing the OS's event loop to continue to run.
MTY_WaitPtr Wait until signaled by the main JavaScript thread. Web only.

Structures

Name Brief
MTY_RenderDesc Description of a render operation.
MTY_Point A point with an x and y coordinate.
MTY_Rect A rectangle with left, top, right, and bottom coordinates.
MTY_Vtx UI vertex.
MTY_Cmd UI draw command.
MTY_CmdList UI draw command list.
MTY_DrawData UI draw data.
MTY_KeyEvent Key event.
MTY_ScrollEvent Scroll event.
MTY_ButtonEvent Button event.
MTY_MotionEvent Motion event.
MTY_DropEvent File drop event.
MTY_Axis Controller axis.
MTY_ControllerEvent Controller state event.
MTY_HIDEvent HID input report from certain controllers.
MTY_PenEvent Pen event.
MTY_Event App event encapsulating all event types.
MTY_MenuItem Menu item on a tray's menu.
MTY_Size Size struct containing width and height.
MTY_Frame Window size and position.

Enumerations

Name Brief
MTY_GFX 3D graphics APIs.
MTY_ColorFormat Raw image color formats.
MTY_Filter Quad texture filtering.
MTY_Effect Quad texture effects.
MTY_Rotation Quad rotation.
MTY_Chroma Chroma subsampling for planar color formats.
MTY_AppFlag Alternative MTY_App behaviors.
MTY_EventType App events.
MTY_Key Keyboard keys.
MTY_Mod Key modifiers.
MTY_Button Mouse buttons.
MTY_CType Controller types.
MTY_CButton Standardized controller buttons.
MTY_CAxis Standardized controller axes.
MTY_PenFlag Pen attributes.
MTY_DetachState Window keyboard/mouse detach states.
MTY_Orientation Mobile device orientations.
MTY_Scope Scope of an operation.
MTY_InputMode Mobile input modes.
MTY_ContextState State of a window's graphics context.
MTY_WindowType Window modes and behaviors.
MTY_Cursor Predefined cursors set via MTY_AppSetCursor.

Function Typedefs

Name Brief
MTY_IterFunc Function called in a loop by MTY_RunAndYield until it returns false.
MTY_AppFunc Function called once per message cycle.
MTY_MenuItemCheckedFunc Function called to test if a tray menu item should be checked.
MTY_WMsgFunc Function called to add custom processing to window messages.
MTY_EventFunc Function called for each event sent to the app.

Basic Typedefs

Name Type
MTY_Window int8_t

Literals

Name Value Details
MTY_WINDOW_MAX 8 Maximum number of windows that can be created.
MTY_SCREEN_MAX 32 Maximum size of a screen identifier.
Clone this wiki locally