/* ************************************************************************** */ /* */ /* monochrome.h */ /* | Project : libmonochrome */ /* */ /* By: Pierre "PierrotLL" Le Gall */ /* Last updated: 2011/11/22 */ /* */ /* ************************************************************************** */ #ifndef MONOCHROME_H # define MONOCHROME_H # ifdef __cplusplus extern "C" { # endif /* ** Constants */ # define ML_SCREEN_WIDTH 128 # define ML_SCREEN_HEIGHT 64 # define ML_CONTRAST_MIN 130 # define ML_CONTRAST_NORMAL 168 # define ML_CONTRAST_MAX 190 /* ** Custom types */ typedef enum { ML_TRANSPARENT = -1, ML_WHITE, ML_BLACK, ML_XOR, ML_CHECKER } ML_Color; typedef enum { ML_MOR, ML_MAND, ML_MXOR } ML_Mode; /* ** Function prototypes */ # define ML_vram_adress() ML_vram_address() // those damn youth mistakes void* ML_vram_address(); void ML_clear_vram(); void ML_clear_screen(); void ML_display_vram(); void ML_set_contrast(unsigned char contrast); unsigned char ML_get_contrast(); void ML_pixel(int x, int y, ML_Color color); void ML_point(int x, int y, int width, ML_Color color); ML_Color ML_pixel_test(int x, int y); void ML_line(int x1, int y1, int x2, int y2, ML_Color color); void ML_horizontal_line(int y, int x1, int x2, ML_Color color); void ML_vertical_line(int x, int y1, int y2, ML_Color color); void ML_rectangle(int x1, int y1, int x2, int y2, int border_width, ML_Color border_color, ML_Color fill_color); void ML_polygon(const int *x, const int *y, int nb_vertices, ML_Color color); void ML_filled_polygon(const int *x, const int *y, int nb_vertices, ML_Color color); void ML_circle(int x, int y, int radius, ML_Color color); void ML_filled_circle(int x, int y, int radius, ML_Color color); void ML_ellipse(int x, int y, int radius1, int radius2, ML_Color color); void ML_ellipse_in_rect(int x1, int y1, int x2, int y2, ML_Color color); void ML_filled_ellipse(int x, int y, int radius1, int radius2, ML_Color color); void ML_filled_ellipse_in_rect(int x1, int y1, int x2, int y2, ML_Color color); void ML_horizontal_scroll(int scroll); void ML_vertical_scroll(int scroll); # define ML_bmp_or(B, X, Y, W, H) \ ML_bmp((B), (X), (Y), (W), (H), ML_MOR) # define ML_bmp_and(B, X, Y, W, H) \ ML_bmp((B), (X), (Y), (W), (H), ML_MAND) # define ML_bmp_xor(B, X, Y, W, H) \ ML_bmp((B), (X), (Y), (W), (H), ML_MXOR) # define ML_bmp_or_cl(B, X, Y, W, H) \ ML_bmp((B), (X), (Y), (W), (H), ML_MOR) # define ML_bmp_and_cl(B, X, Y, W, H) \ ML_bmp((B), (X), (Y), (W), (H), ML_MAND) # define ML_bmp_xor_cl(B, X, Y, W, H) \ ML_bmp((B), (X), (Y), (W), (H), ML_MXOR) void ML_bmp(const void *bmp, int x, int y, int width, int height, ML_Mode mode); # define ML_bmp_8_or(B, X, Y) \ ML_bmp_8((B), (X), (Y), ML_MOR) # define ML_bmp_8_and(B, X, Y) \ ML_bmp_8((B), (X), (Y), ML_MAND) # define ML_bmp_8_xor(B, X, Y) \ ML_bmp_8((B), (X), (Y), ML_MXOR) # define ML_bmp_8_or_cl(B, X, Y) \ ML_bmp_8((B), (X), (Y), ML_MOR) # define ML_bmp_8_and_cl(B, X, Y) \ ML_bmp_8((B), (X), (Y), ML_MAND) # define ML_bmp_8_xor_cl(B, X, Y) \ ML_bmp_8((B), (X), (Y), ML_MXOR) # define ML_bmp_8(B, X, Y, M) \ ML_bmp((B), (X), (Y), 8, 8, (M)) //void ML_bmp_8(const unsigned char *bmp, int x, int y, ML_Mode mode); # define ML_bmp_16_or(B, X, Y) \ ML_bmp_16((B), (X), (Y), ML_MOR) # define ML_bmp_16_and(B, X, Y) \ ML_bmp_16((B), (X), (Y), ML_MAND) # define ML_bmp_16_xor(B, X, Y) \ ML_bmp_16((B), (X), (Y), ML_MXOR) # define ML_bmp_16_or_cl(B, X, Y) \ ML_bmp_16((B), (X), (Y), ML_MOR) # define ML_bmp_16_and_cl(B, X, Y) \ ML_bmp_16((B), (X), (Y), ML_MAND) # define ML_bmp_16_xor_cl(B, X, Y) \ ML_bmp_16((B), (X), (Y), ML_MXOR) # define ML_bmp_16(B, X, Y, M) \ ML_bmp((B), (X), (Y), 16, 16, (M)) //void ML_bmp_16(const unsigned char *bmp, int x, int y, ML_Mode mode); # define ML_background_or(B) \ ML_background((B), ML_MOR) # define ML_background_and(B) \ ML_background((B), ML_MAND) # define ML_background_xor(B) \ ML_background((B), ML_MXOR) void ML_background(const void *bmp, ML_Mode mode); # ifdef __cplusplus } # endif #endif