DungeonCrawl
|
Exposes functions for the media output handler. More...
#include <notcurses/notcurses.h>
#include <stdbool.h>
Go to the source code of this file.
Data Structures | |
struct | loaded_visual_s |
Structure to represent a loaded visual. More... |
Typedefs | |
typedef enum media_blitter | media_blitter_t |
Media blitter options (rendering method) | |
typedef struct loaded_visual_s | loaded_visual_t |
Structure to represent a loaded visual. |
Enumerations | |
enum | scale_type_t { SCALE_NONE , SCALE_PRESERVE , SCALE_STRETCH , SCALE_CELL , SCALE_FULLSCREEN } |
enum | media_type_t { MEDIA_PNG , MEDIA_GIF , MEDIA_MP4 , MEDIA_UNSUPPORTED } |
enum | media_blitter { MEDIA_BLITTER_DEFAULT = NCBLIT_DEFAULT , MEDIA_BLITTER_ASCII = NCBLIT_1x1 , MEDIA_BLITTER_HALF = NCBLIT_2x1 , MEDIA_BLITTER_QUAD = NCBLIT_2x2 , MEDIA_BLITTER_BRAILLE = NCBLIT_BRAILLE , MEDIA_BLITTER_PIXEL = NCBLIT_PIXEL } |
Media blitter options (rendering method) More... |
Functions | |
bool | init_media_output (void) |
Initialize the media output handler. | |
void | shutdown_media_output (void) |
Shutdown the media output handler. | |
void | media_cleanup (void) |
void | destroy_media (loaded_visual_t *media) |
Frees the memory associated with a loaded media resource. | |
bool | refresh_media_display (void) |
Force a refresh of the media display. | |
loaded_visual_t * | load_media (const char *filename) |
load a media resource from file they can be different types (PNG, GIF, MP4) | |
loaded_visual_t * | ready_media (const char *filename, int x, int y, int height, int width, scale_type_t scale_type) |
Prepares a media resource for display. | |
bool | unload_media (const char *filename) |
Unload a specific media resource. | |
bool | preload_media (const char *filename) |
Preload a media file into memory. | |
bool | reload_media_after_resize (void) |
Reload media after terminal resize. | |
bool | media_output_render (loaded_visual_t *media) |
Display a loaded media file on its assigned plane. | |
bool | media_output_render_next_frame (loaded_visual_t *media) |
Display the next frame of an animation or video. | |
bool | media_output_can_display_images (void) |
Check if the notcurses implementation supports image loading. | |
bool | media_output_can_display_videos (void) |
Check if the notcurses implementation supports video loading. | |
void | setup_scaling_options (loaded_visual_t *visual, scale_type_t scale_type, int target_width, int target_height) |
Enable different scaling options for the loaded visual. | |
bool | directory_exists (const char *path) |
checks if a directory exists | |
media_type_t | get_file_type (const char *filename) |
Get the media type based on the file extension. | |
bool | is_file_extension (const char *filename, const char *extension) |
Check if a filename has a specific extension. | |
char * | build_filepath (const char *filename, media_type_t media_type) |
Build a file path for the specified media type. |
Exposes functions for the media output handler.
Definition in file media_output_handler.h.
typedef struct loaded_visual_s loaded_visual_t |
Structure to represent a loaded visual.
This is an opaque structure that encapsulates a Notcurses visual.
enum media_blitter |
Media blitter options (rendering method)
Definition at line 31 of file media_output_handler.h.
enum media_type_t |
Definition at line 21 of file media_output_handler.h.
enum scale_type_t |
Definition at line 12 of file media_output_handler.h.
char * build_filepath | ( | const char * | filename, |
media_type_t | media_type ) |
Build a file path for the specified media type.
filename | File name to build the path for |
media_type | Type of media (PNG, GIF, MP4) |
Definition at line 433 of file media_output_handler.c.
void destroy_media | ( | loaded_visual_t * | media | ) |
Frees the memory associated with a loaded media resource.
media | Pointer to the loaded media instance to destroy |
Definition at line 76 of file media_output_handler.c.
bool directory_exists | ( | const char * | path | ) |
checks if a directory exists
path | Path to the directory |
media_type_t get_file_type | ( | const char * | filename | ) |
Get the media type based on the file extension.
filename | File name to check |
Definition at line 403 of file media_output_handler.c.
bool init_media_output | ( | void | ) |
Initialize the media output handler.
Must be called after the common output handler is initialized.
Definition at line 37 of file media_output_handler.c.
bool is_file_extension | ( | const char * | filename, |
const char * | extension ) |
Check if a filename has a specific extension.
filename | File name to check |
extension | Extension to check for |
Definition at line 417 of file media_output_handler.c.
loaded_visual_t * load_media | ( | const char * | filename | ) |
load a media resource from file they can be different types (PNG, GIF, MP4)
filename | File name to load |
Definition at line 99 of file media_output_handler.c.
void media_cleanup | ( | void | ) |
Definition at line 66 of file media_output_handler.c.
bool media_output_can_display_images | ( | void | ) |
Check if the notcurses implementation supports image loading.
bool media_output_can_display_videos | ( | void | ) |
Check if the notcurses implementation supports video loading.
bool media_output_render | ( | loaded_visual_t * | media | ) |
Display a loaded media file on its assigned plane.
media | Pointer to a loaded media instance |
bool media_output_render_next_frame | ( | loaded_visual_t * | media | ) |
Display the next frame of an animation or video.
media | Pointer to a loaded media instance |
bool preload_media | ( | const char * | filename | ) |
Preload a media file into memory.
filename | File name to preload |
loaded_visual_t * ready_media | ( | const char * | filename, |
int | x, | ||
int | y, | ||
int | height, | ||
int | width, | ||
scale_type_t | scale_type ) |
Prepares a media resource for display.
filename | File name to load |
x | X coordinate in terminal cells |
y | Y coordinate in terminal cells |
height | Height in terminal cells |
width | Width in terminal cells (0 for auto) |
scale_type | Scaling type to apply |
Definition at line 226 of file media_output_handler.c.
bool refresh_media_display | ( | void | ) |
Force a refresh of the media display.
Definition at line 81 of file media_output_handler.c.
bool reload_media_after_resize | ( | void | ) |
Reload media after terminal resize.
void setup_scaling_options | ( | loaded_visual_t * | visual, |
scale_type_t | scale_type, | ||
int | target_width, | ||
int | target_height ) |
Enable different scaling options for the loaded visual.
visual | Pointer to the loaded visual instance |
scale_type | Scaling type to apply |
target_width | Width to scale to |
target_height | Height to scale to |
Definition at line 333 of file media_output_handler.c.
void shutdown_media_output | ( | void | ) |
Shutdown the media output handler.
Cleans up resources used by the media output handler.
Definition at line 62 of file media_output_handler.c.
bool unload_media | ( | const char * | filename | ) |
Unload a specific media resource.
filename | File name to unload |
Definition at line 269 of file media_output_handler.c.