Get drawable background pixel

This commit is contained in:
CTurt 2014-11-02 13:37:08 +00:00
parent 701232d410
commit d08db41d23
2 changed files with 8 additions and 0 deletions

View File

@ -23,6 +23,9 @@ inline void DSGM_ClearDrawableBackgroundFull(DSGM_Room *room, u8 screen);
#define DSGM_DrawPixelToBackground(screen, x, y, color) DSGM_DrawPixelToBackgroundFull(&DSGM_Rooms[DSGM_currentRoom], screen, x, y, color)
inline void DSGM_DrawPixelToBackgroundFull(DSGM_Room *room, u8 screen, int x, int y, u16 color);
#define DSGM_GetDrawablePixel(screen, x, y) DSGM_GetDrawablePixelFull(&DSGM_Rooms[DSGM_currentRoom], screen, x, y)
inline u16 DSGM_GetDrawablePixelFull(DSGM_Room *room, u8 screen, int x, int y);
#define DSGM_DrawRectangleToBackground(screen, x, y, width, height, thickness, color) DSGM_DrawRectangleToBackgroundFull(&DSGM_Rooms[DSGM_currentRoom], screen, x, y, width, height, thickness, color)
inline void DSGM_DrawRectangleToBackgroundFull(DSGM_Room *room, u8 screen, int x, int y, int width, int height, int thickness, u16 color);

View File

@ -22,6 +22,11 @@ inline void DSGM_DrawPixelToBackgroundFull(DSGM_Room *room, u8 screen, int x, in
bgGetGfxPtr(room->layers[screen][3].vramId)[x + (y << 8)] = color;
}
inline u16 DSGM_GetDrawablePixelFull(DSGM_Room *room, u8 screen, int x, int y) {
if(x >= 0 && y >= 0 && x < 256 && y < 192) return bgGetGfxPtr(room->layers[screen][3].vramId)[x + (y << 8)];
else return ARGB16(0, 0, 0, 0);
}
inline void DSGM_DrawRectangleToBackgroundFull(DSGM_Room *room, u8 screen, int x, int y, int width, int height, int thickness, u16 color) {
DSGM_DrawLineToBackgroundFull(room, screen, x, y, x + width, y, thickness, color);
DSGM_DrawLineToBackgroundFull(room, screen, x + width, y, x + width, y + height, thickness, color);