maug
Quick and dirty C mini-augmentation library.
|
The viewport data struct. More...
#include <retroflt.h>
Data Fields | |
int16_t | screen_x |
X position of the viewport in real screen memory in pixels. Should only be retrieved through retroflat_viewport_screen_x() and set through retroflat_viewport_set_pos_size(). | |
int16_t | screen_y |
Y position of the viewport in real screen memory in pixels. Should only be retrieved through retroflat_viewport_screen_y() and set through retroflat_viewport_set_pos_size() | |
int16_t | world_x |
The X offset, in pixels, of the viewport on the world tilemap. Should only be retrieved through retroflat_viewport_world_x() and set through retroflat_viewport_set_world_pos(). | |
int16_t | world_y |
The Y offset, in pixels, of the viewport on the world tilemap. Should only be retrieved through retroflat_viewport_world_y() and set through retroflat_viewport_set_world_pos(). | |
int16_t | world_w |
The width of the entire world tilemap in pixels. Should only be retrieved through retroflat_viewport_world_w() and set through retroflat_viewport_set_world(). | |
int16_t | world_h |
The height of the entire world tilemap in pixels. Should only be retrieved through retroflat_viewport_world_h() and set through retroflat_viewport_set_world(). | |
uint16_t | screen_w |
Viewport width in pixels. Should only be retrieved through retroflat_viewport_screen_w() and set through retroflat_viewport_set_pos_size(). | |
uint16_t | screen_h |
Viewport height in pixels. Should only be retrieved through retroflat_viewport_screen_w() and set through retroflat_viewport_set_pos_size(). | |
uint16_t | screen_w_remainder |
Difference between viewport width and screen width in pixels. Should only be retrieved through retroflat_viewport_screen_w_remainder() and calculated through retroflat_viewport_set_pos_size(). | |
uint16_t | screen_h_remainder |
Difference between viewport height and screen height in pixels. Should only be retrieved through retroflat_viewport_screen_h_remainder() and calculated through retroflat_viewport_set_pos_size(). | |
int16_t | screen_tile_w |
The number of tiles across that fit in the viewport. Should only be retrieved through retroflat_viewport_screen_tile_w() and calculated through retroflat_viewport_set_pos_size(). | |
int16_t | screen_tile_h |
The number of tiles high that fit in the viewport. Should only be retrieved through retroflat_viewport_screen_tile_h() and calculated through retroflat_viewport_set_pos_size(). | |
int16_t | world_tile_x |
int16_t | world_tile_y |
MAUG_MHANDLE | refresh_grid_h |
retroflat_tile_t * | refresh_grid |
A grid of tile values representing the last-drawn values on-screen. | |
Related Symbols | |
(Note that these are not member symbols.) | |
#define | retroflat_viewport_world_x() |
Return the current viewport X position in the world in pixels. | |
#define | retroflat_viewport_world_y() |
Return the current viewport Y position in the world in pixels. | |
#define | retroflat_viewport_world_w() |
Return the current width of the world in pixels. | |
#define | retroflat_viewport_world_h() |
Return the current height of the world in pixels. | |
#define | retroflat_viewport_screen_tile_w() |
Return the current width of the world in tiles. | |
#define | retroflat_viewport_screen_tile_h() |
Return the current height of the world in tiles. | |
#define | retroflat_viewport_screen_w() |
Return the width of the viewport in pixels. | |
#define | retroflat_viewport_screen_h() |
Return the height of the viewport in pixels. | |
#define | retroflat_viewport_screen_w_remainder() |
Return the difference in pixels between the viewport X + width and the screen width. | |
#define | retroflat_viewport_screen_h_remainder() |
Return the difference in pixels between the viewport Y + height and the screen height. | |
#define | retroflat_viewport_set_world(w, h) |
Set the pixel width and height of the world so the viewport knows how far it may scroll. | |
#define | retroflat_viewport_set_world_pos(x, y) |
Set the position of the viewport in the world in pixels. | |
#define | retroflat_viewport_set_pos_size(x_px, y_px, w_px, h_px) |
Set the pixel width and height of the viewport, as well as some other dependent values frequently used in screen updates. | |
#define | retroflat_viewport_lock_refresh() |
Lock access to RETROFLAT_VIEWPORT::refresh_grid in memory. | |
#define | retroflat_viewport_unlock_refresh() |
Unlock access to RETROFLAT_VIEWPORT::refresh_grid in memory. | |
#define | retroflat_viewport_set_refresh(x, y, tid) |
Set the tile at the given screen pixel coordinates to the given tile ID. | |
The viewport data struct.
retroflat_tile_t* RETROFLAT_VIEWPORT::refresh_grid |
A grid of tile values representing the last-drawn values on-screen.
If the value for a tile in this grid matches the value about to be drawn, the draw will be skipped. This increases performance a LOT on systems with slow video memory access.
This functionality may be disabled by defining the macro RETROFLAT_NO_VIEWPORT_REFRESH on build.