From 2cf2d608af862e812e7fd3ac580f869141a96fa7 Mon Sep 17 00:00:00 2001 From: XaviDCR92 Date: Sun, 5 Nov 2017 04:16:32 +0100 Subject: + Added copy of BitmapEncoder + New sprite and unit "Town center" * Provisional collision checking. * Many other modifications. --- Gfx.cpp | 53 +++++++---------------------------------------------- 1 file changed, 7 insertions(+), 46 deletions(-) (limited to 'Gfx.cpp') diff --git a/Gfx.cpp b/Gfx.cpp index 77664b4..45ad6a4 100644 --- a/Gfx.cpp +++ b/Gfx.cpp @@ -24,8 +24,13 @@ void GfxInit(void) gb.display.setFont(font3x5); } -void GfxDrawSprite(TYPE_SPRITE * ptrSprite) +void GfxDrawSprite(TYPE_SPRITE* ptrSprite) { + if (ptrSprite == NULL) + { + return; + } + if (GfxIsSpriteInsideScreenArea(ptrSprite) == true) { int8_t orig_color = gb.display.getColor(); @@ -84,7 +89,7 @@ bool GfxIsInsideScreenArea(int8_t x, int8_t y, uint8_t w, uint8_t h) return false; } -bool GfxIsSpriteInsideScreenArea(TYPE_SPRITE * spr) +bool GfxIsSpriteInsideScreenArea(TYPE_SPRITE* spr) { return GfxIsInsideScreenArea(spr->x, spr->y, spr->w, spr->h); } @@ -125,50 +130,6 @@ void GfxPrintTextFont(const char* str, const uint8_t* font, uint8_t x, uint8_t y } } -void GfxRenderTiles(TYPE_CAMERA* ptrCamera) -{ - gb.display.setColor(GFX_GRAY); - - if (ptrCamera == NULL) - { - return; - } - - for (int i = 0; i < Y_SCREEN_RESOLUTION; i+=8) - { - for (int j = 0; j < X_SCREEN_RESOLUTION; j++) - { - //if (j & 1) - //{ - int x = j + ptrCamera->X_Offset; - int y = i + ptrCamera->Y_Offset; - - if ((x >= 0) && (y >= 0)) - { - gb.display.drawPixel(j + ptrCamera->X_Offset, i + ptrCamera->Y_Offset); - } - //} - } - } - - for (int i = 0; i < X_SCREEN_RESOLUTION; i+=8) - { - for (int j = 0; j < Y_SCREEN_RESOLUTION; j++) - { - //if (j & 1) - //{ - int x = j + ptrCamera->X_Offset; - int y = i + ptrCamera->Y_Offset; - - if ((x >= 0) && (y >= 0)) - { - gb.display.drawPixel(i + ptrCamera->X_Offset, j + ptrCamera->Y_Offset); - } - //} - } - } -} - void GfxPrintText(const char* str, uint8_t x, uint8_t y) { GfxPrintTextFont(str, font3x5, x, y); -- cgit v1.2.3