diff options
| author | XaviDCR92 <xavi.dcr@gmail.com> | 2017-11-05 04:16:32 +0100 |
|---|---|---|
| committer | XaviDCR92 <xavi.dcr@gmail.com> | 2017-11-05 04:16:32 +0100 |
| commit | 2cf2d608af862e812e7fd3ac580f869141a96fa7 (patch) | |
| tree | 29a356a46635e4bc14e9e7342eb5a41defcab899 /Gfx.cpp | |
| parent | b764612a79100271270012053bdb1e4302cd93b7 (diff) | |
+ Added copy of BitmapEncoder
+ New sprite and unit "Town center"
* Provisional collision checking.
* Many other modifications.
Diffstat (limited to 'Gfx.cpp')
| -rw-r--r-- | Gfx.cpp | 53 |
1 files changed, 7 insertions, 46 deletions
@@ -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); |
