Built-in window and input management. More...
Built-in window and input management.
Functions | |
bool | TLN_CreateWindow (const char *overlay, int flags) |
Creates a window for rendering. More... | |
bool | TLN_CreateWindowThread (const char *overlay, int flags) |
Creates a multithreaded window for rendering. More... | |
void | TLN_SetWindowTitle (const char *title) |
Sets window title. More... | |
bool | TLN_ProcessWindow (void) |
Does basic window housekeeping in signgle-threaded window. More... | |
bool | TLN_IsWindowActive (void) |
Checks window state. More... | |
bool | TLN_GetInput (TLN_Input id) |
Returns the state of a given input. More... | |
void | TLN_EnableInput (TLN_Player player, bool enable) |
Enables or disables input for specified player. More... | |
void | TLN_AssignInputJoystick (TLN_Player player, int index) |
Assigns a joystick index to the specified player. More... | |
void | TLN_DefineInputKey (TLN_Player player, TLN_Input input, uint32_t keycode) |
Assigns a keyboard input to a player. More... | |
void | TLN_DefineInputButton (TLN_Player player, TLN_Input input, uint8_t joybutton) |
Assigns a button joystick input to a player. More... | |
void | TLN_DrawFrame (int frame) |
Draws a frame to the window. More... | |
void | TLN_WaitRedraw (void) |
Thread synchronization for multithreaded window. Waits until the current frame has ended rendering. More... | |
void | TLN_DeleteWindow (void) |
Deletes the window previoulsy created with TLN_CreateWindow() or TLN_CreateWindowThread() More... | |
void | TLN_EnableBlur (bool mode) |
void | TLN_ConfigCRTEffect (TLN_CRT type, bool blur) |
Enables CRT simulation post-processing effect to give true retro appeareance. More... | |
void | TLN_EnableCRTEffect (int overlay, uint8_t overlay_factor, uint8_t threshold, uint8_t v0, uint8_t v1, uint8_t v2, uint8_t v3, bool blur, uint8_t glow_factor) |
Enables CRT simulation post-processing effect to give true retro appeareance. More... | |
void | TLN_DisableCRTEffect (void) |
Disables the CRT post-processing effect. More... | |
void | TLN_SetSDLCallback (TLN_SDLCallback) |
Registers a user-defined callback to capture internal SDL2 events. More... | |
void | TLN_Delay (uint32_t msecs) |
Suspends execition for a fixed time. More... | |
uint32_t | TLN_GetTicks (void) |
Returns the number of milliseconds since application start. | |
uint32_t | TLN_GetAverageFps (void) |
Returns averaged fps being rendered on the built-in window, updated each 500 ms. | |
int | TLN_GetWindowWidth (void) |
Returns horizontal dimension of window after scaling. | |
int | TLN_GetWindowHeight (void) |
Returns vertical dimension of window after scaling. | |
int | TLN_GetWindowScaleFactor (void) |
Returns current window scaling factor. More... | |
void | TLN_SetWindowScaleFactor (int) |
Sets current window scaling factor. | |
bool TLN_CreateWindow | ( | const char * | overlay, |
int | flags | ||
) |
Creates a window for rendering.
overlay | Deprecated parameter in 2.10, kept for compatibility. Set to NULL |
flags | Mask of the possible creation flags: CWF_FULLSCREEN, CWF_VSYNC, CWF_S1 - CWF_S5 (scaling factor, none = auto max) |
Creates a host window with basic user input for tilengine. If fullscreen, it uses the desktop resolution and stretches the output resolution with aspect correction, letterboxing or pillarboxing as needed. If windowed, it creates a centered window that is the maximum possible integer multiply of the resolution configured at TLN_Init()
bool TLN_CreateWindowThread | ( | const char * | overlay, |
int | flags | ||
) |
Creates a multithreaded window for rendering.
overlay | Deprecated parameter in 2.10, kept for compatibility. Set to NULL |
flags | Mask of the possible creation flags: CWF_FULLSCREEN, CWF_VSYNC, CWF_S1 - CWF_S5 (scaling factor, none = auto max) |
Creates a host window with basic user input for tilengine. If fullscreen, it uses the desktop resolution and stretches the output resolution with aspect correction, letterboxing or pillarboxing as needed. If windowed, it creates a centered window that is the maximum possible integer multiply of the resolution configured at TLN_Init()
void TLN_SetWindowTitle | ( | const char * | title | ) |
Sets window title.
title | Text with the title to set |
bool TLN_ProcessWindow | ( | void | ) |
Does basic window housekeeping in signgle-threaded window.
If a window has been created with TLN_CreateWindow, this function must be called periodically (call it inside the main loop so it gets called regularly). If the window was created with TLN_CreateWindowThread, do not use it
bool TLN_IsWindowActive | ( | void | ) |
Checks window state.
bool TLN_GetInput | ( | TLN_Input | input | ) |
Returns the state of a given input.
input | Input to check state. It can be one of the following values:
|
If a window has been created with TLN_CreateWindow, it provides basic user input. It simulates a classic arcade setup, with 4 directional buttons (INPUT_UP to INPUT_RIGHT), 6 action buttons (INPUT_BUTTON1 to INPUT_BUTTON6) and a start button (INPUT_START). By default directional buttons are mapped to keyboard cursors and joystick 1 D-PAD, and the first four action buttons are the keys Z,X,C,V and joystick buttons 1 to 4.
void TLN_EnableInput | ( | TLN_Player | player, |
bool | enable | ||
) |
Enables or disables input for specified player.
player | Player number to enable (PLAYER1 - PLAYER4) |
enable | Set true to enable, false to disable |
void TLN_AssignInputJoystick | ( | TLN_Player | player, |
int | index | ||
) |
Assigns a joystick index to the specified player.
player | Player number to configure (PLAYER1 - PLAYER4) |
index | Joystick index to assign, 0-based index. -1 = disable |
void TLN_DefineInputKey | ( | TLN_Player | player, |
TLN_Input | input, | ||
uint32_t | keycode | ||
) |
Assigns a keyboard input to a player.
player | Player number to configure (PLAYER1 - PLAYER4) |
input | Input to associate to the given key |
keycode | ASCII key value or scancode as defined in SDL.h |
void TLN_DefineInputButton | ( | TLN_Player | player, |
TLN_Input | input, | ||
uint8_t | joybutton | ||
) |
Assigns a button joystick input to a player.
player | Player number to configure (PLAYER1 - PLAYER4) |
input | Input to associate to the given button |
joybutton | Button index |
void TLN_DrawFrame | ( | int | frame | ) |
Draws a frame to the window.
frame | Optional frame number. Set to 0 to autoincrement from previous value |
Draws a frame to the window
void TLN_WaitRedraw | ( | void | ) |
Thread synchronization for multithreaded window. Waits until the current frame has ended rendering.
void TLN_DeleteWindow | ( | void | ) |
Deletes the window previoulsy created with TLN_CreateWindow() or TLN_CreateWindowThread()
void TLN_EnableBlur | ( | bool | mode | ) |
void TLN_ConfigCRTEffect | ( | TLN_CRT | type, |
bool | blur | ||
) |
Enables CRT simulation post-processing effect to give true retro appeareance.
type | One possible value of TLN_CRT enumeration |
blur | Optional RF (horizontal) blur, increases CPU usage |
void TLN_EnableCRTEffect | ( | int | overlay, |
uint8_t | overlay_factor, | ||
uint8_t | threshold, | ||
uint8_t | v0, | ||
uint8_t | v1, | ||
uint8_t | v2, | ||
uint8_t | v3, | ||
bool | blur, | ||
uint8_t | glow_factor | ||
) |
Enables CRT simulation post-processing effect to give true retro appeareance.
void TLN_DisableCRTEffect | ( | void | ) |
Disables the CRT post-processing effect.
void TLN_SetSDLCallback | ( | TLN_SDLCallback | callback | ) |
Registers a user-defined callback to capture internal SDL2 events.
callback | pointer to user funcion with signature void (SDL_Event*) |
void TLN_Delay | ( | uint32_t | time | ) |
Suspends execition for a fixed time.
time | Number of milliseconds to wait |
int TLN_GetWindowScaleFactor | ( | void | ) |
Returns current window scaling factor.
Last update on Tue Aug 29 2023 for Tilengine 2.15.1