dsekai
World engine for retrocomputers.
Loading...
Searching...
No Matches
graphics.h File Reference

Platform-general abstractions for graphics. More...

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  GRAPHICS_RECT
 Struct representing a graphical rectangle. More...
 
struct  GRAPHICS_BITMAP_BASE
 Struct representing a bitmap. Should be overridden by platform. More...
 

Macros

#define GRAPHICS_ERROR_NOT_FOUND   -1
 
#define GRAPHICS_INSTANCE_NONE   -1
 
#define GRAPHICS_INSTANCE_WINDOW   -2
 
#define GRAPHICS_INSTANCE_TILEMAP   -3
 
#define GRAPHICS_STRING_FLAG_1X   0x01
 Draw string at 1x scale.
 
#define GRAPHICS_STRING_FLAG_ALL_CAPS   0x10
 Display the string on-screen as ALL CAPITAL LETTERS.
 
#define GRAPHICS_STRING_FLAG_FONT_SCRIPT   0x20
 Use a script-style (cursive-style) font to display the string.
 
#define GRAPHICS_STRING_FLAG_OUTLINE   0x80
 Draw a black outline around each character in the string.
 
#define GRAPHICS_FLAG_SHAKING_MASK   0x03
 
#define GRAPHICS_FLAG_ZOOM_MASK   0x0c
 
#define GRAPHICS_TXP_R   0xff
 Red value for transparency color in VGA DEPTH.
 
#define GRAPHICS_TXP_G   0x55
 Green value for transparency color in VGA DEPTH.
 
#define GRAPHICS_TXP_B   0xff
 Blue value for transparency color in VGA DEPTH.
 
#define graphics_char_is_printable(c)
 
#define graphics_draw_char_outline(x, y, flags)
 
#define graphics_set_screen_shake(shake)
 
#define graphics_set_screen_zoom(zoom)
 
#define graphics_clear_screen()
 
#define graphics_clear_block(x, y, w, h)
 Erase a portion of the screen to black.
 
#define GRAPHICS_BMP_FLAG_TYPE_TILE   0x0004
 
#define GRAPHICS_BMP_FLAG_TYPE_SPRITE   0x0002
 
#define GRAPHICS_BMP_FLAG_TYPE_MASK   0x0006
 
#define GRAPHICS_BMP_FLAG_INIT   0x0001
 

Functions

int16_t graphics_init () SECTION_SETUP
 
void graphics_shutdown () SECTION_SETUP
 
void graphics_lock ()
 
void graphics_release ()
 Draw the current graphics buffer on-screen.
 
uint32_t graphics_get_ms ()
 Get the number of ticks since the program started.
 
void graphics_loop_start ()
 Mark the beginning of rendering the current graphical frame.
 
void graphics_loop_end ()
 Mark the end of rendering the current graphical frame.
 
void graphics_draw_px (uint16_t x, uint16_t y, const GRAPHICS_COLOR color)
 Plot a discrete point on screen.
 
void graphics_draw_block (uint16_t x_orig, uint16_t y_orig, uint16_t w, uint16_t h, const GRAPHICS_COLOR color)
 Draw a filled rectangle on screen.
 
void graphics_draw_rect (uint16_t x_orig, uint16_t y_orig, uint16_t w, uint16_t h, uint16_t thickness, const GRAPHICS_COLOR color)
 Draw a hollowed rectangle on screen.
 
void graphics_draw_line (uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2, uint16_t thickness, const GRAPHICS_COLOR color)
 Draw a line on screen.
 
void graphics_char_at (char c, uint16_t x_orig, uint16_t y_orig, GRAPHICS_COLOR color, uint8_t flags)
 Draw a text character at the specified coordinates.
 
void graphics_string_at (const char *str, uint16_t str_sz, uint16_t x_orig, uint16_t y_orig, GRAPHICS_COLOR color, uint8_t flags)
 Draw a text string on screen.
 
void graphics_string_sz (const char *str, uint16_t str_sz, uint8_t flags, struct GRAPHICS_RECT *sz_out)
 Get width and height of a text string in pixels if drawn on screen.
 
int16_t graphics_cache_blit_at (uint16_t bitmap_idx, int16_t instance_id, uint16_t s_x, uint16_t s_y, uint16_t d_x, uint16_t d_y, uint16_t w, uint16_t h)
 Copy part or all of a GRAPHICS_BITMAP image to the screen.
 
void graphics_clear_cache () SECTION_SETUP
 Free up graphics and resources used by loaded assets. Should only be called as part of cleanup (i.e. between maps).
 
int16_t graphics_cache_load_bitmap (RESOURCE_ID id, uint8_t type_flag)
 
int16_t graphics_get_random (int16_t start, int16_t range)
 Get a random integer.
 
void graphics_on_resize (int16_t new_w, int16_t new_h)
 

Variables

uint16_t g_screen_real_w
 
uint16_t g_screen_real_h
 
uint8_t g_screen_flags
 

Detailed Description

Platform-general abstractions for graphics.