From f416816883545433ea33ca410983371e657dba18 Mon Sep 17 00:00:00 2001 From: XaviDCR92 Date: Thu, 9 Mar 2017 23:59:53 +0100 Subject: * Nearest unit and/or building is found (no sqrt method used). * Preliminar unit/building selection algorithm. * Added cursor onscreen. - Removed old Peasant sprites. Only 2 sprites needed! --- Gfx.cpp | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'Gfx.cpp') diff --git a/Gfx.cpp b/Gfx.cpp index 469ddd7..e291213 100644 --- a/Gfx.cpp +++ b/Gfx.cpp @@ -28,12 +28,16 @@ void GfxDrawSprite(TYPE_SPRITE * ptrSprite) { if(GfxIsSpriteInsideScreenArea(ptrSprite) == true) { + int8_t orig_color = gb.display.getColor(); + gb.display.setColor(ptrSprite->color, GFX_WHITE); gb.display.drawBitmap( ptrSprite->x, ptrSprite->y, ptrSprite->Data, ptrSprite->rotation, ptrSprite->flip ); + + gb.display.setColor(orig_color); } } @@ -170,6 +174,26 @@ void GfxPrintText(const char * str, uint8_t x, uint8_t y) GfxPrintTextFont(str, font3x5, x, y); } +void GfxDrawCircle(uint16_t x, uint16_t y, uint8_t radius, int8_t color) +{ + if(GfxIsInsideScreenArea(x, y, radius, radius) == true) + { + int8_t orig_color = gb.display.getColor(); + gb.display.setColor(color); + gb.display.drawCircle(x, y, radius); + gb.display.setColor(orig_color); + } +} + +void GfxDrawRectangle(uint8_t x, uint8_t y, uint8_t w, uint8_t h, int8_t color) +{ + int8_t orig_color = gb.display.getColor(); + + gb.display.setColor(color); + gb.display.fillRect(x, y, w, h); + gb.display.setColor(orig_color); +} + void GfxShowResources(TYPE_RESOURCES * ptrResources) { char str[8]; -- cgit v1.2.3