#ifndef GRX_H
#define GRX_H


#include <stdint.h>

#include "grx20.h"
#include "grxkeys.h"


typedef GrColor      ColorT;
typedef GrContext    SurfaceT;
typedef GrMouseEvent EventT;


#define EVENT_FLAG_KEYPRESS      GR_M_KEYPRESS
#define EVENT_FLAG_LEFT_DOWN     GR_M_LEFT_DOWN
#define EVENT_FLAG_LEFT_UP       GR_M_LEFT_UP
#define EVENT_FLAG_RIGHT_DOWN    GR_M_RIGHT_DOWN
#define EVENT_FLAG_RIGHT_UP      GR_M_RIGHT_UP

#define BUTTON_LEFT              GR_M_LEFT
#define BUTTON_RIGHT             GR_M_RIGHT

#define META_ALT                 GR_KB_ALT
#define META_CTRL                GR_KB_CTRL
#define META_SHIFT               GR_KB_SHIFT

#define KEY_ESC                  GrKey_Escape


#define platformEventGet(p)      GrMouseGetEventT(GR_M_EVENT, p, 0)

#define videoDisplayHeightGet    GrScreenY
#define videoDisplayWidthGet     GrScreenX
#define videoSurfaceClear        GrClearContext
#define videoSurfaceCreate(w,h)  GrCreateContext(w,h,0,0)
#define videoSurfaceDestroy      GrDestroyContext
#define videoSurfaceBox          GrBox
#define videoSurfaceBoxFilled    GrFilledBox
#define videoSurfaceLineH        GrHLine
#define videoSurfaceLineV        GrVLine
#define videoSurfacePixelGet     GrPixelC
#define videoSurfacePixelSet     GrPlot
#define videoSurfaceSet          GrSetContext
#define videoSurfaceScreenGet    GrScreenContext


SurfaceT *imageLoad(char *filename);

void      videoSurfaceBlit(SurfaceT *target, int16_t targetX, int16_t targetY, SurfaceT *source);
void      videoSurfaceBlitWithTransparency(SurfaceT *target, int16_t targetX, int16_t targetY, SurfaceT *source, ColorT transparent);
int16_t   videoSurfaceHeightGet(SurfaceT *surface);
int16_t   videoSurfaceWidthGet(SurfaceT *surface);


#endif // GRX_H
