maug
Quick and dirty C mini-augmentation library.
Loading...
Searching...
No Matches
RetroFlat Viewport API

A flexible API to facilitate tile-based views using hardware acceleration where available. More...

Collaboration diagram for RetroFlat Viewport API:

Data Structures

struct  RETROFLAT_VIEWPORT
 

Macros

#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()
 
#define retroflat_viewport_screen_tile_h()
 
#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)
 
#define retroflat_viewport_lock_refresh()
 
#define retroflat_viewport_unlock_refresh()
 
#define retroflat_viewport_set_refresh(x, y, tid)
 
#define retroflat_viewport_focus(x1, y1, range, speed)
 Move the viewport in a direction or combination thereof so that it's focusing the given x1/y1 within the given range.
 
#define retroflat_viewport_screen_x(world_x)
 Return the screenspace X coordinate at which something at the given world coordinate should be drawn.
 
#define retroflat_viewport_screen_y(world_y)
 Return the screenspace Y coordinate at which something at the given world coordinate should be drawn.
 
#define retroflat_viewport_move_x(x)
 
#define retroflat_viewport_move_y(y)
 

Typedefs

typedef int16_t retroflat_tile_t
 

Detailed Description

A flexible API to facilitate tile-based views using hardware acceleration where available.

Macro Definition Documentation

◆ retroflat_viewport_focus

#define retroflat_viewport_focus ( x1,
y1,
range,
speed )
Value:
retroflat_viewport_focus_generic( x1, y1, range, speed )

Move the viewport in a direction or combination thereof so that it's focusing the given x1/y1 within the given range.

Parameters
x1The X coordinate to focus on.
y1The Y coordinate to focus on.
rangeThe number of pixels from the center of the screen to keep the given X and Y inside.
speedThe increment by which to move the viewport if the given X and Y are not in focus.
Warning
The speed parameter should always divide evenly into the tile size, or problems may occur!

◆ retroflat_viewport_lock_refresh

#define retroflat_viewport_lock_refresh ( )
Value:
retroflat_viewport_lock_refresh_generic()

◆ retroflat_viewport_move_x

#define retroflat_viewport_move_x ( x)
Value:
retroflat_viewport_move_x_generic( x )

◆ retroflat_viewport_move_y

#define retroflat_viewport_move_y ( y)
Value:
retroflat_viewport_move_y_generic( y )

◆ retroflat_viewport_screen_tile_h

#define retroflat_viewport_screen_tile_h ( )
Value:
retroflat_viewport_screen_tile_h_generic()

◆ retroflat_viewport_screen_tile_w

#define retroflat_viewport_screen_tile_w ( )
Value:
retroflat_viewport_screen_tile_w_generic()

◆ retroflat_viewport_screen_x

#define retroflat_viewport_screen_x ( world_x)
Value:
retroflat_viewport_screen_x_generic( world_x )

Return the screenspace X coordinate at which something at the given world coordinate should be drawn.

◆ retroflat_viewport_screen_y

#define retroflat_viewport_screen_y ( world_y)
Value:
retroflat_viewport_screen_y_generic( world_y )

Return the screenspace Y coordinate at which something at the given world coordinate should be drawn.

◆ retroflat_viewport_set_refresh

#define retroflat_viewport_set_refresh ( x,
y,
tid )
Value:
retroflat_viewport_set_refresh_generic( x, y, tid )

◆ retroflat_viewport_set_world

#define retroflat_viewport_set_world ( w,
h )
Value:
retroflat_viewport_set_world_generic( w, h )

Set the pixel width and height of the world so the viewport knows how far it may scroll.

Parameters
wThe width of the world in pixels (tile_width * map_tile_width).
hThe height of the world in pixels (tile_height * map_tile_height).

◆ retroflat_viewport_set_world_pos

#define retroflat_viewport_set_world_pos ( x,
y )
Value:
retroflat_viewport_set_world_pos_generic( x, y )

◆ retroflat_viewport_unlock_refresh

#define retroflat_viewport_unlock_refresh ( )
Value:
retroflat_viewport_unlock_refresh_generic()

◆ retroflat_viewport_world_h

#define retroflat_viewport_world_h ( )
Value:
retroflat_viewport_world_h_generic()

Return the current height of the world in pixels.

◆ retroflat_viewport_world_w

#define retroflat_viewport_world_w ( )
Value:
retroflat_viewport_world_w_generic()

Return the current width of the world in pixels.

◆ retroflat_viewport_world_x

#define retroflat_viewport_world_x ( )
Value:
retroflat_viewport_world_x_generic()

Return the current viewport X position in the world in pixels.

◆ retroflat_viewport_world_y

#define retroflat_viewport_world_y ( )
Value:
retroflat_viewport_world_y_generic()

Return the current viewport Y position in the world in pixels.