From 2abc159923fd4400f6c42b1957bdee60e5d33756 Mon Sep 17 00:00:00 2001 From: Javidx9 Date: Sun, 21 Jan 2018 14:34:14 +0000 Subject: [PATCH] Update --- olcConsoleGameEngine.h | 33 +++++++++++++++++++++++++++++++-- 1 file changed, 31 insertions(+), 2 deletions(-) diff --git a/olcConsoleGameEngine.h b/olcConsoleGameEngine.h index fa2982d..889cfc7 100644 --- a/olcConsoleGameEngine.h +++ b/olcConsoleGameEngine.h @@ -90,8 +90,7 @@ http://www.twitch.tv/javidx9 #ifndef UNICODE #error Please enable UNICODE for your compiler! VS: Project Properties -> General -> \ -Character Set -> Use Unicode. In Code::Blocks, include 'UNICODE' and '_UNICODE' as \ -pre-processor directives. Thanks! - Javidx9 +Character Set -> Use Unicode. Thanks! - Javidx9 #endif #include @@ -105,6 +104,7 @@ using namespace std; #include + enum COLOUR { FG_BLACK = 0x0000, @@ -500,6 +500,28 @@ public: } } + void DrawCircle(int xc, int yc, int r, wchar_t c = 0x2588, short col = 0x000F) + { + int x = 0; + int y = r; + int p = 3 - 2 * r; + if (!r) return; + + while (y >= x) // only formulate 1/8 of circle + { + Draw(xc - x, yc - y, c, col);//upper left left + Draw(xc - y, yc - x, c, col);//upper upper left + Draw(xc + y, yc - x, c, col);//upper upper right + Draw(xc + x, yc - y, c, col);//upper right right + Draw(xc - x, yc + y, c, col);//lower left left + Draw(xc - y, yc + x, c, col);//lower lower left + Draw(xc + y, yc + x, c, col);//lower lower right + Draw(xc + x, yc + y, c, col);//lower right right + if (p < 0) p += 4 * x++ + 6; + else p += 4 * (x++ - y--) + 10; + } + } + void DrawSprite(int x, int y, olcSprite *sprite) { if (sprite == nullptr) @@ -752,6 +774,13 @@ protected: int m_mousePosX; int m_mousePosY; +public: + sKeyState GetKey(int nKeyID) + { + return m_keys[nKeyID]; + } + + protected: int Error(const wchar_t *msg)