Exposes functions for drawing to the screen.
More...
#include "media_output_handler.h"
#include <notcurses/notcurses.h>
#include <stdbool.h>
Go to the source code of this file.
|
bool | display_image_at (const char *filename, int x, int y, int height, int width, scale_type_t scale_type) |
| Display an image file at specified coordinates with scaling.
|
bool | display_image_background (const char *filename) |
| Fill the background with an image file scaled to terminal size.
|
bool | display_image_cell (const char *filename, int x, int y) |
| Fill a single terminal cell with an image.
|
bool | display_gif_at (const char *filename, int x, int y, int height, int width, scale_type_t scale_type, float fps, bool loop) |
| Display an animation file at specified coordinates with scaling.
|
bool | display_gif_background (const char *filename, float fps, bool loop) |
| Fill the background with an animation file scaled to terminal size.
|
bool | display_video_at (const char *filename, int x, int y, int width, int height, scale_type_t scale) |
| Display a video file at specified coordinates with scaling.
|
bool | display_video_background (const char *filename, float fps, bool loop) |
| Fill the background with a video file scaled to terminal size.
|
void | media_output_play (loaded_visual_t *media) |
| Start playback of an animation or video Note: This does not handle actual timing, which must be done in the game loop.
|
void | media_output_pause (loaded_visual_t *media) |
| Pause playback of an animation or video.
|
void | media_output_reset (loaded_visual_t *media) |
| Reset animation or video to the beginning.
|
Exposes functions for drawing to the screen.
Definition in file media_output.h.
◆ display_gif_at()
bool display_gif_at |
( |
const char * | filename, |
|
|
int | x, |
|
|
int | y, |
|
|
int | height, |
|
|
int | width, |
|
|
scale_type_t | scale_type, |
|
|
float | fps, |
|
|
bool | loop ) |
Display an animation file at specified coordinates with scaling.
- Parameters
-
filename | Animation file name (GIF supported, loaded from src/art/gif/) |
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) |
scaling | Scaling mode to use |
fps | Frames per second |
loop | Whether to loop the animation |
- Returns
- true on success, false on failure
◆ display_gif_background()
bool display_gif_background |
( |
const char * | filename, |
|
|
float | fps, |
|
|
bool | loop ) |
Fill the background with an animation file scaled to terminal size.
- Parameters
-
filename | Animation file name (GIF supported, loaded from src/art/gif/) |
fps | Frames per second |
loop | Whether to loop the animation |
- Returns
- true on success, false on failure
◆ display_image_at()
bool display_image_at |
( |
const char * | filename, |
|
|
int | x, |
|
|
int | y, |
|
|
int | height, |
|
|
int | width, |
|
|
scale_type_t | scale_type ) |
Display an image file at specified coordinates with scaling.
- Parameters
-
filename | Image file name (PNG supported, loaded from src/art/png/) |
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 mode to use |
- Returns
- true on success, false on failure
Definition at line 32 of file media_output.c.
32 {
33
34 if (!filename || height < 0) {
35
36 log_msg(ERROR,
"media_output",
"Invalid parameters for display_png_at");
37 return false;
38 }
40 if (!resource) {
41 log_msg(ERROR,
"media_output",
"Failed to load image for display");
42 return false;
43 }
44 return display_image(resource);
45}
void log_msg(const log_level_t level, const char *module, const char *format,...)
Logs a formatted message with a specified log level and module.
◆ display_image_background()
bool display_image_background |
( |
const char * | filename | ) |
|
Fill the background with an image file scaled to terminal size.
- Parameters
-
filename | Image file name (PNG supported, loaded from src/art/png/) |
- Returns
- true on success, false on failure
◆ display_image_cell()
bool display_image_cell |
( |
const char * | filename, |
|
|
int | x, |
|
|
int | y ) |
Fill a single terminal cell with an image.
- Parameters
-
filename | Image file name (PNG supported, loaded from src/art/png/) |
x | X coordinate in terminal cells |
y | Y coordinate in terminal cells |
- Returns
- true on success, false on failure
Definition at line 54 of file media_output.c.
54 {
55
56 if (!filename) {
57 log_msg(ERROR,
"media_output",
"Invalid filename for fill_cell_with_png");
58 return false;
59 }
61 if (!resource) {
62 log_msg(ERROR,
"media_output",
"Failed to load image for cell");
63 return false;
64 }
65 return display_image(resource);
66}
◆ display_video_at()
bool display_video_at |
( |
const char * | filename, |
|
|
int | x, |
|
|
int | y, |
|
|
int | width, |
|
|
int | height, |
|
|
scale_type_t | scale ) |
Display a video file at specified coordinates with scaling.
- Parameters
-
filename | Video file name (MP4 supported, loaded from src/art/mp4/) |
x | X coordinate in terminal cells |
y | Y coordinate in terminal cells |
width | Width in terminal cells |
height | Height in terminal cells |
scale | Scaling mode to use |
- Returns
- true on success, false on failure
◆ display_video_background()
bool display_video_background |
( |
const char * | filename, |
|
|
float | fps, |
|
|
bool | loop ) |
Fill the background with a video file scaled to terminal size.
- Parameters
-
filename | Video file name (MP4 supported, loaded from src/art/mp4/) |
fps | Frames per second |
loop | Whether to loop the video |
- Returns
- true on success, false on failure
◆ media_output_pause()
Pause playback of an animation or video.
- Parameters
-
media | Pointer to a loaded media instance |
◆ media_output_play()
Start playback of an animation or video Note: This does not handle actual timing, which must be done in the game loop.
- Parameters
-
media | Pointer to a loaded media instance |
◆ media_output_reset()
Reset animation or video to the beginning.
- Parameters
-
media | Pointer to a loaded media instance |