maug
Quick and dirty C mini-augmentation library.
Data Structures | Macros
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
 The viewport data struct. More...
 

Macros

#define retroflat_screen_colors()   (g_retroflat_state->screen_colors)
 
#define retroflat_viewport_world_tile_x()    retroflat_viewport_world_tile_x_generic()
 
#define retroflat_viewport_world_tile_y()    retroflat_viewport_world_tile_y_generic()
 
#define retroflat_viewport_focus(x1, y1, range, speed)    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. More...
 
#define retroflat_viewport_screen_x(world_x)    retroflat_viewport_screen_x_generic( 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)    retroflat_viewport_screen_y_generic( world_y )
 Return the screenspace Y coordinate at which something at the given world coordinate should be drawn.
 
#define retroflat_viewport_move_x(x)    retroflat_viewport_move_x_generic( x )
 
#define retroflat_viewport_move_y(y)    retroflat_viewport_move_y_generic( y )
 

Detailed Description

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

If no hardware acceleration is available on the platform, then the platform API header should define RETROFLAT_SOFT_VIEWPORT to enable the _generic functions and suffixes for this functionality.

Macro Definition Documentation

◆ retroflat_viewport_focus

#define retroflat_viewport_focus (   x1,
  y1,
  range,
  speed 
)     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!