This is the set of functions made available by the library. Their use is bound to the loading of the midres library. Some of these features are available for all platforms (some require the overlay to be enabled). Others, however, are only available for those configurations that have enough contiguous memory.
These functions take care of initializing and deinitializing the graphics subsystem for the various platforms. The mr_init
function must always be called, before each call. The call to mr_cleanup
is optional, and only necessary if you want to leave the system “clean” after execution.
mr_init
- initialize the graphics subsystemmr_cleanup
- release the graphics subsystemThese functions are only needed if you want to ensure support from the overlay system. They must be used before calling those certain functions.
mr_use_screen
- enable screen management functions and loadingmr_use_screen2
- enable screen management functions and savingmr_use_drawing
- enable primitive drawing functions (v1.0)mr_use_drawing2
- enable primitive drawing functions (v1.1)mr_use_bitblit
- enable bit blitting functions (v1.2)These functions are required for manipulating entire midres screens. They take care of loading, saving, compressing and decompressing images from files to certain screens. They also allow you to indicate which screen should be shown and which to write to (where the hardware has more than one screen).
mr_clear
- clear the midres screenmr_show
- show a midres screen mr_enable
- set a midres screen as outputmr_load
- load a midres screen (luminance/mixels only)mr_save
- save a midres screen (luminance/mixels only) mr_load_color
- load a midres screen (color only)mr_save_color
- save a midres screen (color only) mr_compress
- compress a midres screenmr_uncompress
- uncompress a midres screenmr_pack
- pack a midres screenmr_unpack
- unpack a midres screen
These functions take care of drawing and coloring mixels on the screen. Version 1.0 is suitable for systems with low memory and for integration with other enviroments (i.e. img2midres utility). The two versions are compatible, in the sense that they act on the same midres screens and can therefore be mixed.
mr_psetop
- set/clear/invert a mixel at given coordinatesmr_pcolorop
- set color at given coordinatesmr_ink
- set implicit color for a given screenmr_pset
- set a mixel at given coordinatesmr_pclear
- clear a mixel at given coordinatesmr_pinvert
- invert a mixel at given coordinatesmr_pcolor
- set color at given coordinatesmr_psetc
- set a mixel at given coordinates with implicit colormr_clear_bitmap
- clear the bitmap to BLACKmr_clear_to_color
- fill the bitmap to a given colormr_putpixel
- set a pixel with the given colormr_getpixel
- get the color for a pixelmr_vline
- draw a vertical line with the given colormr_hline
- draw an horizontal line with the given colormr_line
- draw a line with the given colormr_triangle
- draw a triangle with the given colormr_polygon
- draw a polygon with the given colormr_rect
- draw a rectangle with the given colormr_circle
- draw a circle with the given colorThese functions deal with copying operations of rectangular screen areas of the same size. The areas can be two screens or a memory area towards one screen. Copying can also take place with the application of a logical operation (AND, OR or XOR) or with the effect of transparency (“off” mixels are considered transparent). These functions can be used to implement a rudimentary form of software sprite.
mr_copy
- generic copy of two areas (mixels and colors)mr_blit_from_screen
- copy (blit) an area from the screen to memorymr_blit_to_screen
- copy (blit) an area from memory to screenThese functions implement a double buffering mechanism: this is a way to avoid flickering during animations, and consists of drawing on one screen while the other is shown to the user. The screens are exchanged with each other only when the frame needs to be updated.
mr_doublebuffer_init
- enable support for double bufferingmr_doublebuffer_switch
- swap the visible screen with the enabled screenThese functions deal with defining, drawing and modifying the “tiles”.
mr_tileset_visible
- set the actual visibile tilesetmr_tileset_load
- load a tilesetmr_tileset_copy
- copy a tileset over anothermr_tile_redefine
- redefine a single tile using the given datamr_tile_prepare_horizontal
- redefine a set of tiles to allow horizontal movementmr_tile_moveto_horizontal
- put a tile precisely on the screen (eventually) moving horizontallymr_tile_prepare_vertical
- redefine a set of tiles to allow vertical movementmr_tile_moveto_vertical
- put a tile precisely on the screen (eventually) moving verticallymr_puttile
- put a tile on the screenmr_cleartile
- clear a tile on the screenmr_gettile
- get a tile from the screen