VMUPro SDK v1.0.0
Application Development SDK for the VMUPro
Loading...
Searching...
No Matches
vmupro_display.h
Go to the documentation of this file.
1
37#pragma once
38
39#include <stdint.h>
40#include <stdbool.h>
41
42#ifdef __cplusplus
43extern "C"
44{
45#endif
46
70
80
89
98
117
149 void vmupro_set_global_brightness(uint8_t brightness);
150
161
172
183
192
199
213
225
234
247 void vmupro_draw_rect(int x1, int y1, int x2, int y2, vmupro_color_t color);
248
261 void vmupro_draw_fill_rect(int x1, int y1, int x2, int y2, vmupro_color_t color);
262
279 void vmupro_blit_buffer_at(uint8_t *buffer, int x, int y, int width, int height);
280
295 void vmupro_blit_buffer_with_palette(uint8_t *buffer, int16_t *palette);
296
314 void vmupro_blit_buffer_transparent(uint8_t *buffer, int x, int y, int width, int height, vmupro_color_t transparent_color, vmupro_drawflags_t flags);
315
334 void vmupro_blit_buffer_blended(uint8_t *buffer, int x, int y, int width, int height, uint8_t alpha_level);
335
355 void vmupro_blit_buffer_dithered(uint8_t *buffer, int x, int y, int width, int height, int dither_strength);
356
372 void vmupro_blit_buffer_flip_h(uint8_t *buffer, int x, int y, int width, int height);
373
389 void vmupro_blit_buffer_flipped(uint8_t *buffer, int x, int y, int width, int height, vmupro_drawflags_t flags);
390
412 void vmupro_blit_buffer_scaled(uint8_t* buffer, int buffer_width, int src_x, int src_y, int src_width, int src_height,
413 int dest_x, int dest_y, int dest_width, int dest_height);
414
433 void vmupro_blit_buffer_rotated_90(uint8_t* buffer, int x, int y, int width, int height, int rotation);
434
453 void vmupro_blit_buffer_rotated_precise(uint8_t* buffer, int x, int y, int width, int height, int rotation_degrees);
454
472 void vmupro_blit_tile_pattern(uint8_t *tile_buffer, int tile_width, int tile_height,
473 int dest_x, int dest_y, int dest_width, int dest_height);
474
498 void vmupro_blit_buffer_advanced(uint8_t *buffer, int buffer_width, int src_x, int src_y, int src_width, int src_height,
499 int dest_x, int dest_y, int dest_width, int dest_height,
500 int flip_h, int flip_v, int transparent_color);
501
513 void vmupro_draw_line(int x1, int y1, int x2, int y2, vmupro_color_t color);
514
525 void vmupro_draw_circle(int cx, int cy, int radius, vmupro_color_t color);
526
537 void vmupro_draw_circle_filled(int cx, int cy, int radius, vmupro_color_t color);
538
550 void vmupro_draw_ellipse(int cx, int cy, int rx, int ry, vmupro_color_t color);
551
563 void vmupro_draw_ellipse_filled(int cx, int cy, int rx, int ry, vmupro_color_t color);
564
577 void vmupro_draw_polygon(int *points, int num_points, vmupro_color_t color);
578
591 void vmupro_draw_polygon_filled(int *points, int num_points, vmupro_color_t color);
592
607 void vmupro_flood_fill(int x, int y, vmupro_color_t fill_color, vmupro_color_t boundary_color);
608
623 void vmupro_flood_fill_tolerance(int x, int y, vmupro_color_t fill_color, int tolerance);
624
625 // Background Scrolling Functions
639 void vmupro_blit_scrolling_background(uint8_t *bg_buffer, int bg_width, int bg_height,
640 int scroll_x, int scroll_y, int dest_width, int dest_height);
641
655 void vmupro_blit_infinite_scrolling_background(uint8_t *tile_buffer, int tile_width, int tile_height,
656 int scroll_x, int scroll_y, int dest_width, int dest_height);
657
671 void vmupro_blit_parallax_background(uint8_t *bg_buffer, int bg_width, int bg_height,
672 int scroll_x, int scroll_y, int parallax_factor_x, int parallax_factor_y);
673
688 void vmupro_blit_multi_parallax(uint8_t **bg_layers, int *layer_widths, int *layer_heights, int num_layers,
689 int *parallax_factors_x, int *parallax_factors_y, int scroll_x, int scroll_y);
690
702 void vmupro_blit_line_scroll_background(uint8_t *bg_buffer, int bg_width, int bg_height,
703 int *scroll_x_per_line, int *scroll_y_per_line);
704
716 void vmupro_blit_column_scroll_background(uint8_t *bg_buffer, int bg_width, int bg_height,
717 int *scroll_x_per_column, int *scroll_y_per_column);
718
719 // Visual Effects Functions
732 void vmupro_blit_buffer_mosaic(uint8_t *buffer, int x, int y, int width, int height, int mosaic_size);
733
750 void vmupro_blit_buffer_blurred(uint8_t *buffer, int x, int y, int width, int height, int blur_radius);
751
763 void vmupro_apply_mosaic_to_screen(int x, int y, int width, int height, int mosaic_size);
764
777 void vmupro_blit_buffer_shadow_highlight(uint8_t *buffer, int x, int y, int width, int height, int mode);
778
793 void vmupro_blit_buffer_color_multiply(uint8_t *buffer, int x, int y, int width, int height, vmupro_color_t color_filter);
794
809 void vmupro_blit_buffer_color_add(uint8_t *buffer, int x, int y, int width, int height, vmupro_color_t color_offset);
810
811 // Collision Detection Functions
827 int vmupro_sprite_collision_check(int sprite1_x, int sprite1_y, int sprite1_w, int sprite1_h,
828 int sprite2_x, int sprite2_y, int sprite2_w, int sprite2_h);
829
847 int vmupro_sprite_pixel_collision(uint8_t *sprite1, uint8_t *sprite2, int x1, int y1, int x2, int y2,
848 int width1, int height1, int width2, int height2);
849
850 // Enhanced Blending Functions
863 void vmupro_blit_buffer_fixed_alpha(uint8_t *buffer, int x, int y, int width, int height, int alpha_mode);
864
875 void vmupro_blend_layers_additive(uint8_t *layer1, uint8_t *layer2, int width, int height);
876
887 void vmupro_blend_layers_multiply(uint8_t *layer1, uint8_t *layer2, int width, int height);
888
899 void vmupro_blend_layers_screen(uint8_t *layer1, uint8_t *layer2, int width, int height);
900
901 // Windowing & Masking Functions
913 void vmupro_set_color_window(int x1, int y1, int x2, int y2, vmupro_color_t mask_color);
914
928 void vmupro_blit_buffer_masked(uint8_t *buffer, uint8_t *mask, int x, int y, int width, int height, vmupro_drawflags_t flags);
929
936
937 // Palette Operations
952 void vmupro_blit_buffer_palette_swap(uint8_t *buffer, int x, int y, int width, int height,
953 uint16_t *old_palette, uint16_t *new_palette, int palette_size);
954
965 void vmupro_animate_palette_range(uint16_t *palette, int start_index, int end_index, int shift_amount);
966
978 void vmupro_interpolate_palette(uint16_t *palette1, uint16_t *palette2, uint16_t *result, int size, int factor_256);
979
980 // Sprite System
984 typedef struct {
985 uint8_t *buffer;
986 int x, y;
987 int width, height;
988 int flip_h, flip_v;
989 uint8_t alpha;
993
1002 void vmupro_sprite_batch_render(vmupro_sprite_t *sprites, int num_sprites);
1003
1004 // Multi-Layer System
1005 #define VMUPRO_MAX_LAYERS 8
1006
1010 typedef struct {
1011 bool active;
1012 uint8_t *buffer;
1013 int width, height;
1014 int scroll_x, scroll_y;
1016 uint8_t alpha;
1018
1028 void vmupro_layer_create(int layer_id, int width, int height);
1029
1037 void vmupro_layer_destroy(int layer_id);
1038
1048 void vmupro_layer_set_scroll(int layer_id, int scroll_x, int scroll_y);
1049
1058 void vmupro_layer_set_priority(int layer_id, int priority);
1059
1068 void vmupro_layer_set_alpha(int layer_id, uint8_t alpha);
1069
1080 void vmupro_layer_blit_background(int layer_id, uint8_t *bg_buffer, int bg_width, int bg_height);
1081
1088
1109 void vmupro_blit_tile(uint8_t *buffer, int x, int y, int src_x, int src_y, int width, int height, int tilemap_width);
1110
1111 // todo: add description from firmware
1112 void vmupro_blit_tile_advanced(uint8_t* buffer, int x, int y, int atlas_src_x, int atlas_src_y, int width, int height, int tilemap_width, vmupro_color_t transparent_color, vmupro_drawflags_t flags);
1113
1114 // return whether the last buffer sent to the GPU was
1115 // fb_side == 0, or fb_side == 1
1116 // so we don't throw new frames at it before it finishes
1118
1119#ifdef __cplusplus
1120}
1121#endif
Layer structure for multi-layer rendering.
Sprite structure for batch rendering.
vmupro_color_t transparent_color
uint8_t vmupro_get_global_brightness(void)
uint8_t * vmupro_get_front_fb()
Get pointer to the front framebuffer.
void vmupro_blit_buffer_color_multiply(uint8_t *buffer, int x, int y, int width, int height, vmupro_color_t color_filter)
Apply color multiplication filter.
void vmupro_render_all_layers(void)
Render all active layers.
void vmupro_animate_palette_range(uint16_t *palette, int start_index, int end_index, int shift_amount)
Animate palette color cycling.
void vmupro_blit_buffer_flipped(uint8_t *buffer, int x, int y, int width, int height, vmupro_drawflags_t flags)
Blit a buffer with vertical flipping.
void vmupro_set_global_brightness(uint8_t brightness)
void vmupro_layer_set_priority(int layer_id, int priority)
Set layer rendering priority.
void vmupro_draw_fill_rect(int x1, int y1, int x2, int y2, vmupro_color_t color)
Draw a filled rectangle.
void vmupro_blit_buffer_blended(uint8_t *buffer, int x, int y, int width, int height, uint8_t alpha_level)
Blit a buffer with alpha blending.
void vmupro_flood_fill(int x, int y, vmupro_color_t fill_color, vmupro_color_t boundary_color)
Flood fill an area with color.
void vmupro_blit_buffer_palette_swap(uint8_t *buffer, int x, int y, int width, int height, uint16_t *old_palette, uint16_t *new_palette, int palette_size)
Swap palette colors in buffer.
void vmupro_stop_double_buffer_renderer()
Stop the double buffer renderer.
void vmupro_blit_tile_advanced(uint8_t *buffer, int x, int y, int atlas_src_x, int atlas_src_y, int width, int height, int tilemap_width, vmupro_color_t transparent_color, vmupro_drawflags_t flags)
void vmupro_blit_line_scroll_background(uint8_t *bg_buffer, int bg_width, int bg_height, int *scroll_x_per_line, int *scroll_y_per_line)
Blit background with per-line scrolling (Mega Drive style)
void vmupro_blit_tile_pattern(uint8_t *tile_buffer, int tile_width, int tile_height, int dest_x, int dest_y, int dest_width, int dest_height)
Blit a tiled pattern to fill an area.
void vmupro_interpolate_palette(uint16_t *palette1, uint16_t *palette2, uint16_t *result, int size, int factor_256)
Interpolate between two palettes.
void vmupro_blit_buffer_fixed_alpha(uint8_t *buffer, int x, int y, int width, int height, int alpha_mode)
Apply fixed alpha blending.
void vmupro_blit_multi_parallax(uint8_t **bg_layers, int *layer_widths, int *layer_heights, int num_layers, int *parallax_factors_x, int *parallax_factors_y, int scroll_x, int scroll_y)
Blit multiple parallax layers.
vmupro_color_t
Predefined color values for VMUPro display.
@ VMUPRO_COLOR_BLUE
@ VMUPRO_COLOR_RED
@ VMUPRO_COLOR_NAVY
@ VMUPRO_COLOR_ORANGE
@ VMUPRO_COLOR_GREY
@ VMUPRO_COLOR_VIOLET
@ VMUPRO_COLOR_YELLOW
@ VMUPRO_COLOR_WHITE
@ VMUPRO_COLOR_YELLOWGREEN
@ VMUPRO_COLOR_VMUINK
@ VMUPRO_COLOR_GREEN
@ VMUPRO_COLOR_MAGENTA
@ VMUPRO_COLOR_BLACK
@ VMUPRO_COLOR_VMUGREEN
int vmupro_sprite_pixel_collision(uint8_t *sprite1, uint8_t *sprite2, int x1, int y1, int x2, int y2, int width1, int height1, int width2, int height2)
Check pixel-perfect sprite collision.
void vmupro_blit_buffer_transparent(uint8_t *buffer, int x, int y, int width, int height, vmupro_color_t transparent_color, vmupro_drawflags_t flags)
Blit a buffer with transparency support.
void vmupro_blit_infinite_scrolling_background(uint8_t *tile_buffer, int tile_width, int tile_height, int scroll_x, int scroll_y, int dest_width, int dest_height)
Blit an infinitely scrolling tiled background.
void vmupro_blend_layers_additive(uint8_t *layer1, uint8_t *layer2, int width, int height)
Blend two layers additively.
uint8_t * vmupro_get_back_fb()
Get pointer to the back framebuffer.
void vmupro_blit_buffer_with_palette(uint8_t *buffer, int16_t *palette)
Blit a paletted buffer to the display.
void vmupro_pause_double_buffer_renderer()
Pause the double buffer renderer.
uint8_t vmupro_get_last_blitted_fb_side()
int vmupro_sprite_collision_check(int sprite1_x, int sprite1_y, int sprite1_w, int sprite1_h, int sprite2_x, int sprite2_y, int sprite2_w, int sprite2_h)
Check rectangular sprite collision.
void vmupro_blit_column_scroll_background(uint8_t *bg_buffer, int bg_width, int bg_height, int *scroll_x_per_column, int *scroll_y_per_column)
Blit background with per-column scrolling.
void vmupro_layer_destroy(int layer_id)
Destroy a layer.
void vmupro_display_clear(vmupro_color_t color)
Clear the display with a solid color.
void vmupro_blit_buffer_color_add(uint8_t *buffer, int x, int y, int width, int height, vmupro_color_t color_offset)
Apply color addition filter.
void vmupro_draw_polygon(int *points, int num_points, vmupro_color_t color)
Draw a polygon outline.
void vmupro_resume_double_buffer_renderer()
Resume the double buffer renderer.
void vmupro_clear_color_window(void)
Clear the color window.
void vmupro_blit_buffer_masked(uint8_t *buffer, uint8_t *mask, int x, int y, int width, int height, vmupro_drawflags_t flags)
Blit buffer using mask.
void vmupro_blit_buffer_shadow_highlight(uint8_t *buffer, int x, int y, int width, int height, int mode)
Apply shadow/highlight effect to buffer.
void vmupro_blend_layers_screen(uint8_t *layer1, uint8_t *layer2, int width, int height)
Blend two layers using screen mode.
void vmupro_blit_buffer_blurred(uint8_t *buffer, int x, int y, int width, int height, int blur_radius)
Apply blur effect to buffer.
void vmupro_display_refresh()
Refresh the display.
void vmupro_layer_blit_background(int layer_id, uint8_t *bg_buffer, int bg_width, int bg_height)
Blit background to layer.
void vmupro_start_double_buffer_renderer()
Start the double buffer renderer.
void vmupro_draw_ellipse_filled(int cx, int cy, int rx, int ry, vmupro_color_t color)
Draw a filled ellipse.
void vmupro_blit_scrolling_background(uint8_t *bg_buffer, int bg_width, int bg_height, int scroll_x, int scroll_y, int dest_width, int dest_height)
Blit a scrolling background.
void vmupro_blit_buffer_mosaic(uint8_t *buffer, int x, int y, int width, int height, int mosaic_size)
Apply mosaic effect to buffer.
void vmupro_blit_buffer_dithered(uint8_t *buffer, int x, int y, int width, int height, int dither_strength)
Blit a buffer with dithering effect.
vmupro_drawflags_t
Flip flags for various draw functions Combine as e.g. VMUPRO_DRAWFLAGS_FLIP_H | VMUPRO_DRAWFLAGS_FLIP...
@ VMUPRO_DRAWFLAGS_FLIP_H
@ VMUPRO_DRAWFLAGS_FLIP_V
@ VMUPRO_DRAWFLAGS_NORMAL
void vmupro_blit_buffer_advanced(uint8_t *buffer, int buffer_width, int src_x, int src_y, int src_width, int src_height, int dest_x, int dest_y, int dest_width, int dest_height, int flip_h, int flip_v, int transparent_color)
Advanced blit with multiple effects combined.
void vmupro_blit_buffer_at(uint8_t *buffer, int x, int y, int width, int height)
Blit a buffer to the display at specified coordinates.
void vmupro_blit_buffer_flip_h(uint8_t *buffer, int x, int y, int width, int height)
Blit a buffer with horizontal flipping.
uint8_t * vmupro_get_back_buffer()
Get pointer to the back buffer.
void vmupro_blit_tile(uint8_t *buffer, int x, int y, int src_x, int src_y, int width, int height, int tilemap_width)
Blit a single tile from a tilemap/tileset.
void vmupro_apply_mosaic_to_screen(int x, int y, int width, int height, int mosaic_size)
Apply mosaic effect directly to screen.
void vmupro_push_double_buffer_frame()
Swap and display the current framebuffer.
void vmupro_layer_create(int layer_id, int width, int height)
Create a new layer.
void vmupro_draw_circle_filled(int cx, int cy, int radius, vmupro_color_t color)
Draw a filled circle.
void vmupro_layer_set_alpha(int layer_id, uint8_t alpha)
Set layer alpha transparency.
void vmupro_layer_set_scroll(int layer_id, int scroll_x, int scroll_y)
Set layer scroll position.
void vmupro_sprite_batch_render(vmupro_sprite_t *sprites, int num_sprites)
Render multiple sprites in priority order.
void vmupro_draw_rect(int x1, int y1, int x2, int y2, vmupro_color_t color)
Draw a rectangle outline.
void vmupro_blit_parallax_background(uint8_t *bg_buffer, int bg_width, int bg_height, int scroll_x, int scroll_y, int parallax_factor_x, int parallax_factor_y)
Blit background with parallax effect.
void vmupro_draw_circle(int cx, int cy, int radius, vmupro_color_t color)
Draw a circle outline.
void vmupro_blit_buffer_scaled(uint8_t *buffer, int buffer_width, int src_x, int src_y, int src_width, int src_height, int dest_x, int dest_y, int dest_width, int dest_height)
Blit a buffer with scaling support.
void vmupro_blit_buffer_rotated_90(uint8_t *buffer, int x, int y, int width, int height, int rotation)
Blit a buffer with 90-degree rotation increments.
void vmupro_set_color_window(int x1, int y1, int x2, int y2, vmupro_color_t mask_color)
Set a color window for masking.
void vmupro_draw_line(int x1, int y1, int x2, int y2, vmupro_color_t color)
Draw a line between two points.
void vmupro_draw_ellipse(int cx, int cy, int rx, int ry, vmupro_color_t color)
Draw an ellipse outline.
void vmupro_flood_fill_tolerance(int x, int y, vmupro_color_t fill_color, int tolerance)
Flood fill with color tolerance.
void vmupro_blend_layers_multiply(uint8_t *layer1, uint8_t *layer2, int width, int height)
Blend two layers multiplicatively.
void vmupro_draw_polygon_filled(int *points, int num_points, vmupro_color_t color)
Draw a filled polygon.
void vmupro_blit_buffer_rotated_precise(uint8_t *buffer, int x, int y, int width, int height, int rotation_degrees)
Blit a buffer with precise rotation (1-degree increments)