Нема описа
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

olcPixelGameEngine.h 19KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490
  1. /*
  2. olcPixelGameEngine.h
  3. +-------------------------------------------------------------+
  4. | OneLoneCoder Pixel Game Engine v1.17 |
  5. | "Like the command prompt console one, but not..." - javidx9 |
  6. +-------------------------------------------------------------+
  7. What is this?
  8. ~~~~~~~~~~~~~
  9. The olcConsoleGameEngine has been a surprising and wonderful success for me,
  10. and I'm delighted how people have reacted so positively towards it, so thanks
  11. for that.
  12. However, there are limitations that I simply cannot avoid. Firstly, I need to
  13. maintain several different versions of it to accommodate users on Windows7,
  14. 8, 10, Linux, Mac, Visual Studio & Code::Blocks. Secondly, this year I've been
  15. pushing the console to the limits of its graphical capabilities and the effect
  16. is becoming underwhelming. The engine itself is not slow at all, but the process
  17. that Windows uses to draw the command prompt to the screen is, and worse still,
  18. it's dynamic based upon the variation of character colours and glyphs. Sadly
  19. I have no control over this, and recent videos that are extremely graphical
  20. (for a command prompt :P ) have been dipping to unacceptable framerates. As
  21. the channel has been popular with aspiring game developers, I'm concerned that
  22. the visual appeal of the command prompt is perhaps limited to us oldies, and I
  23. dont want to alienate younger learners. Finally, I'd like to demonstrate many
  24. more algorithms and image processing that exist in the graphical domain, for
  25. which the console is insufficient.
  26. For this reason, I have created olcPixelGameEngine! The look and feel to the
  27. programmer is almost identical, so all of my existing code from the videos is
  28. easily portable, and the programmer uses this file in exactly the same way. But
  29. I've decided that rather than just build a command prompt emulator, that I
  30. would at least harness some modern(ish) portable technologies.
  31. As a result, the olcPixelGameEngine supports 32-bit colour, is written in a
  32. cross-platform style, uses modern(ish) C++ conventions and most importantly,
  33. renders much much faster. I will use this version when my applications are
  34. predominantly graphics based, but use the console version when they are
  35. predominantly text based - Don't worry, loads more command prompt silliness to
  36. come yet, but evolution is important!!
  37. License (OLC-3)
  38. ~~~~~~~~~~~~~~~
  39. Copyright 2018 - 2019 OneLoneCoder.com
  40. Redistribution and use in source and binary forms, with or without modification,
  41. are permitted provided that the following conditions are met:
  42. 1. Redistributions or derivations of source code must retain the above copyright
  43. notice, this list of conditions and the following disclaimer.
  44. 2. Redistributions or derivative works in binary form must reproduce the above
  45. copyright notice. This list of conditions and the following disclaimer must be
  46. reproduced in the documentation and/or other materials provided with the distribution.
  47. 3. Neither the name of the copyright holder nor the names of its contributors may
  48. be used to endorse or promote products derived from this software without specific
  49. prior written permission.
  50. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
  51. EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
  52. OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
  53. SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
  54. INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
  55. TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
  56. BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
  57. CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
  58. ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  59. SUCH DAMAGE.
  60. Links
  61. ~~~~~
  62. YouTube: https://www.youtube.com/javidx9
  63. https://www.youtube.com/javidx9extra
  64. Discord: https://discord.gg/WhwHUMV
  65. Twitter: https://www.twitter.com/javidx9
  66. Twitch: https://www.twitch.tv/javidx9
  67. GitHub: https://www.github.com/onelonecoder
  68. Homepage: https://www.onelonecoder.com
  69. Patreon: https://www.patreon.com/javidx9
  70. Relevant Videos
  71. ~~~~~~~~~~~~~~~
  72. https://youtu.be/kRH6oJLFYxY Introducing olcPixelGameEngine
  73. Compiling in Linux
  74. ~~~~~~~~~~~~~~~~~~
  75. You will need a modern C++ compiler, so update yours!
  76. To compile use the command:
  77. g++ -o YourProgName YourSource.cpp -lX11 -lGL -lpthread -lpng
  78. On some Linux configurations, the frame rate is locked to the refresh
  79. rate of the monitor. This engine tries to unlock it but may not be
  80. able to, in which case try launching your program like this:
  81. vblank_mode=0 ./YourProgName
  82. Compiling in Code::Blocks on Windows
  83. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  84. Well I wont judge you, but make sure your Code::Blocks installation
  85. is really up to date - you may even consider updating your C++ toolchain
  86. to use MinGW32-W64, so google this. You will also need to enable C++14
  87. in your build options, and add to your linker the following libraries:
  88. user32 gdi32 opengl32 gdiplus
  89. Ports
  90. ~~~~~
  91. olc::PixelGameEngine has been ported and tested with varying degrees of
  92. success to: WinXP, Win7, Win8, Win10, Various Linux, Rapberry Pi,
  93. Chromebook, Playstation Portable (PSP) and Nintendo Switch. If you are
  94. interested in the details of these ports, come and visit the Discord!
  95. Thanks
  96. ~~~~~~
  97. I'd like to extend thanks to Eremiell, slavka, gurkanctn, Phantim,
  98. JackOJC, KrossX, Huhlig, Dragoneye, Appa, JustinRichardsMusic, SliceNDice
  99. Ralakus, Gorbit99, raoul, joshinils, benedani & MagetzUb for advice, ideas and
  100. testing, and I'd like to extend my appreciation to the 40K YouTube followers,
  101. 22 Patreons and 2.6K Discord server members who give me the motivation to keep
  102. going with all this :D
  103. Special thanks to those who bring gifts!
  104. GnarGnarHead.......Domina
  105. Gorbit99...........Bastion, Ori & The Blind Forest
  106. Marti Morta........Gris
  107. Special thanks to my Patreons too - I wont name you on here, but I've
  108. certainly enjoyed my tea and flapjacks :D
  109. Author
  110. ~~~~~~
  111. David Barr, aka javidx9, ©OneLoneCoder 2018, 2019
  112. */
  113. //////////////////////////////////////////////////////////////////////////////////////////
  114. /* Example Usage (main.cpp)
  115. #define OLC_PGE_APPLICATION
  116. #include "olcPixelGameEngine.h"
  117. // Override base class with your custom functionality
  118. class Example : public olc::PixelGameEngine
  119. {
  120. public:
  121. Example()
  122. {
  123. sAppName = "Example";
  124. }
  125. public:
  126. bool OnUserCreate() override
  127. {
  128. // Called once at the start, so create things here
  129. return true;
  130. }
  131. bool OnUserUpdate(float fElapsedTime) override
  132. {
  133. // called once per frame, draws random coloured pixels
  134. for (int x = 0; x < ScreenWidth(); x++)
  135. for (int y = 0; y < ScreenHeight(); y++)
  136. Draw(x, y, olc::Pixel(rand() % 255, rand() % 255, rand()% 255));
  137. return true;
  138. }
  139. };
  140. int main()
  141. {
  142. Example demo;
  143. if (demo.Construct(256, 240, 4, 4))
  144. demo.Start();
  145. return 0;
  146. }
  147. */
  148. #ifndef OLC_PGE_DEF
  149. #define OLC_PGE_DEF
  150. #ifdef _WIN32
  151. // Link to libraries
  152. #ifndef __MINGW32__
  153. #pragma comment(lib, "user32.lib") // Visual Studio Only
  154. #pragma comment(lib, "gdi32.lib") // For other Windows Compilers please add
  155. #pragma comment(lib, "opengl32.lib") // these libs to your linker input
  156. #pragma comment(lib, "gdiplus.lib")
  157. #else
  158. // In Code::Blocks, Select C++14 in your build options, and add the
  159. // following libs to your linker: user32 gdi32 opengl32 gdiplus
  160. #if !defined _WIN32_WINNT
  161. #ifdef HAVE_MSMF
  162. #define _WIN32_WINNT 0x0600 // Windows Vista
  163. #else
  164. #define _WIN32_WINNT 0x0500 // Windows 2000
  165. #endif
  166. #endif
  167. #endif
  168. // Include WinAPI
  169. #include <windows.h>
  170. #include <gdiplus.h>
  171. // OpenGL Extension
  172. #include <GL/gl.h>
  173. typedef BOOL(WINAPI wglSwapInterval_t) (int interval);
  174. #else
  175. #include <GL/gl.h>
  176. #include <GL/glx.h>
  177. #include <X11/X.h>
  178. #include <X11/Xlib.h>
  179. typedef int(glSwapInterval_t) (Display *dpy, GLXDrawable drawable, int interval);
  180. #endif
  181. // Standard includes
  182. #include <cmath>
  183. #include <cstdint>
  184. #include <string>
  185. #include <iostream>
  186. #include <streambuf>
  187. #include <chrono>
  188. #include <vector>
  189. #include <list>
  190. #include <thread>
  191. #include <atomic>
  192. #include <condition_variable>
  193. #include <fstream>
  194. #include <map>
  195. #include <functional>
  196. #include <algorithm>
  197. #include "olcPGE_Common.h"
  198. #include "olcPGE_Sprite.h"
  199. #include "olcPGE_ResourcePack.h"
  200. #undef min
  201. #undef max
  202. namespace olc // All OneLoneCoder stuff will now exist in the "olc" namespace
  203. {
  204. template <class T>
  205. struct v2d_generic
  206. {
  207. T x = 0;
  208. T y = 0;
  209. inline v2d_generic() : x(0), y(0) { }
  210. inline v2d_generic(T _x, T _y) : x(_x), y(_y) { }
  211. inline v2d_generic(const v2d_generic& v) : x(v.x), y(v.y){ }
  212. inline T mag() { return sqrt(x * x + y * y); }
  213. inline v2d_generic norm() { T r = 1 / mag(); return v2d_generic(x*r, y*r); }
  214. inline v2d_generic perp() { return v2d_generic(-y, x); }
  215. inline T dot(const v2d_generic& rhs) { return this->x * rhs.x + this->y * rhs.y; }
  216. inline T cross(const v2d_generic& rhs) { return this->x * rhs.y - this->y * rhs.x; }
  217. inline v2d_generic operator + (const v2d_generic& rhs) const { return v2d_generic(this->x + rhs.x, this->y + rhs.y);}
  218. inline v2d_generic operator - (const v2d_generic& rhs) const { return v2d_generic(this->x - rhs.x, this->y - rhs.y);}
  219. inline v2d_generic operator * (const T& rhs) const { return v2d_generic(this->x * rhs, this->y * rhs); }
  220. inline v2d_generic operator / (const T& rhs) const { return v2d_generic(this->x / rhs, this->y / rhs); }
  221. inline v2d_generic& operator += (const v2d_generic& rhs) { this->x += rhs.x; this->y += rhs.y; return *this; }
  222. inline v2d_generic& operator -= (const v2d_generic& rhs) { this->x -= rhs.x; this->y -= rhs.y; return *this; }
  223. inline v2d_generic& operator *= (const T& rhs) { this->x *= rhs; this->y *= rhs; return *this; }
  224. inline v2d_generic& operator /= (const T& rhs) { this->x /= rhs; this->y /= rhs; return *this; }
  225. inline T& operator [] (std::size_t i) { return *((T*)this + i); /* <-- D'oh :( */ }
  226. };
  227. template<class T> inline v2d_generic<T> operator * (const float& lhs, const v2d_generic<T>& rhs) { return v2d_generic<T>(lhs * rhs.x, lhs * rhs.y); }
  228. template<class T> inline v2d_generic<T> operator * (const double& lhs, const v2d_generic<T>& rhs){ return v2d_generic<T>(lhs * rhs.x, lhs * rhs.y); }
  229. template<class T> inline v2d_generic<T> operator * (const int& lhs, const v2d_generic<T>& rhs) { return v2d_generic<T>(lhs * rhs.x, lhs * rhs.y); }
  230. template<class T> inline v2d_generic<T> operator / (const float& lhs, const v2d_generic<T>& rhs) { return v2d_generic<T>(lhs / rhs.x, lhs / rhs.y); }
  231. template<class T> inline v2d_generic<T> operator / (const double& lhs, const v2d_generic<T>& rhs){ return v2d_generic<T>(lhs / rhs.x, lhs / rhs.y); }
  232. template<class T> inline v2d_generic<T> operator / (const int& lhs, const v2d_generic<T>& rhs) { return v2d_generic<T>(lhs / rhs.x, lhs / rhs.y); }
  233. typedef v2d_generic<int> vi2d;
  234. typedef v2d_generic<float> vf2d;
  235. typedef v2d_generic<double> vd2d;
  236. //=============================================================
  237. struct HWButton
  238. {
  239. bool bPressed = false; // Set once during the frame the event occurs
  240. bool bReleased = false; // Set once during the frame the event occurs
  241. bool bHeld = false; // Set true for all frames between pressed and released events
  242. };
  243. //=============================================================
  244. enum Key
  245. {
  246. NONE,
  247. A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V, W, X, Y, Z,
  248. K0, K1, K2, K3, K4, K5, K6, K7, K8, K9,
  249. F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12,
  250. UP, DOWN, LEFT, RIGHT,
  251. SPACE, TAB, SHIFT, CTRL, INS, DEL, HOME, END, PGUP, PGDN,
  252. BACK, ESCAPE, RETURN, ENTER, PAUSE, SCROLL,
  253. NP0, NP1, NP2, NP3, NP4, NP5, NP6, NP7, NP8, NP9,
  254. NP_MUL, NP_DIV, NP_ADD, NP_SUB, NP_DECIMAL,
  255. };
  256. //=============================================================
  257. class PixelGameEngine
  258. {
  259. public:
  260. PixelGameEngine();
  261. public:
  262. olc::rcode Construct(uint32_t screen_w, uint32_t screen_h, uint32_t pixel_w, uint32_t pixel_h, bool full_screen = false);
  263. // Selects maximum pixel size to fit in the display resolution
  264. olc::rcode ConstructAuto(uint32_t screen_w, uint32_t screen_h, bool full_screen = false);
  265. olc::rcode Start();
  266. public: // Override Interfaces
  267. // Called once on application startup, use to load your resources
  268. virtual bool OnUserCreate();
  269. // Called every frame, and provides you with a time per frame value
  270. virtual bool OnUserUpdate(float fElapsedTime);
  271. // Called once on application termination, so you can be a clean coder
  272. virtual bool OnUserDestroy();
  273. public: // Hardware Interfaces
  274. // Returns true if window is currently in focus
  275. bool IsFocused();
  276. // Get the state of a specific keyboard button
  277. HWButton GetKey(Key k);
  278. // Get the state of a specific mouse button
  279. HWButton GetMouse(uint32_t b);
  280. // Get Mouse X coordinate in "pixel" space
  281. int32_t GetMouseX();
  282. // Get Mouse Y coordinate in "pixel" space
  283. int32_t GetMouseY();
  284. // Get Mouse Wheel Delta
  285. int32_t GetMouseWheel();
  286. public: // Utility
  287. // Returns the width of the screen in "pixels"
  288. int32_t ScreenWidth();
  289. // Returns the height of the screen in "pixels"
  290. int32_t ScreenHeight();
  291. // Returns the width of the currently selected drawing target in "pixels"
  292. int32_t GetDrawTargetWidth();
  293. // Returns the height of the currently selected drawing target in "pixels"
  294. int32_t GetDrawTargetHeight();
  295. // Returns the currently active draw target
  296. Sprite* GetDrawTarget();
  297. public: // Draw Routines
  298. // Specify which Sprite should be the target of drawing functions, use nullptr
  299. // to specify the primary screen
  300. void SetDrawTarget(Sprite *target);
  301. // Change the pixel mode for different optimisations
  302. // olc::Pixel::NORMAL = No transparency
  303. // olc::Pixel::MASK = Transparent if alpha is < 255
  304. // olc::Pixel::ALPHA = Full transparency
  305. void SetPixelMode(Pixel::Mode m);
  306. Pixel::Mode GetPixelMode();
  307. // Use a custom blend function
  308. void SetPixelMode(std::function<olc::Pixel(const int x, const int y, const olc::Pixel& pSource, const olc::Pixel& pDest)> pixelMode);
  309. // Change the blend factor form between 0.0f to 1.0f;
  310. void SetPixelBlend(float fBlend);
  311. // Offset texels by sub-pixel amount (advanced, do not use)
  312. void SetSubPixelOffset(float ox, float oy);
  313. // Draws a single Pixel
  314. virtual bool Draw(int32_t x, int32_t y, Pixel p = olc::WHITE);
  315. // Draws a line from (x1,y1) to (x2,y2)
  316. void DrawLine(int32_t x1, int32_t y1, int32_t x2, int32_t y2, Pixel p = olc::WHITE, uint32_t pattern = 0xFFFFFFFF);
  317. // Draws a circle located at (x,y) with radius
  318. void DrawCircle(int32_t x, int32_t y, int32_t radius, Pixel p = olc::WHITE, uint8_t mask = 0xFF);
  319. // Fills a circle located at (x,y) with radius
  320. void FillCircle(int32_t x, int32_t y, int32_t radius, Pixel p = olc::WHITE);
  321. // Draws a rectangle at (x,y) to (x+w,y+h)
  322. void DrawRect(int32_t x, int32_t y, int32_t w, int32_t h, Pixel p = olc::WHITE);
  323. // Fills a rectangle at (x,y) to (x+w,y+h)
  324. void FillRect(int32_t x, int32_t y, int32_t w, int32_t h, Pixel p = olc::WHITE);
  325. // Draws a triangle between points (x1,y1), (x2,y2) and (x3,y3)
  326. void DrawTriangle(int32_t x1, int32_t y1, int32_t x2, int32_t y2, int32_t x3, int32_t y3, Pixel p = olc::WHITE);
  327. // Flat fills a triangle between points (x1,y1), (x2,y2) and (x3,y3)
  328. void FillTriangle(int32_t x1, int32_t y1, int32_t x2, int32_t y2, int32_t x3, int32_t y3, Pixel p = olc::WHITE);
  329. // Draws an entire sprite at location (x,y)
  330. void DrawSprite(int32_t x, int32_t y, Sprite *sprite, uint32_t scale = 1);
  331. // Draws an area of a sprite at location (x,y), where the
  332. // selected area is (ox,oy) to (ox+w,oy+h)
  333. void DrawPartialSprite(int32_t x, int32_t y, Sprite *sprite, int32_t ox, int32_t oy, int32_t w, int32_t h, uint32_t scale = 1);
  334. // Draws a single line of text
  335. void DrawString(int32_t x, int32_t y, std::string sText, Pixel col = olc::WHITE, uint32_t scale = 1);
  336. // Clears entire draw target to Pixel
  337. void Clear(Pixel p);
  338. public: // Branding
  339. std::string sAppName;
  340. private: // Inner mysterious workings
  341. Sprite *pDefaultDrawTarget = nullptr;
  342. Sprite *pDrawTarget = nullptr;
  343. Pixel::Mode nPixelMode = Pixel::NORMAL;
  344. float fBlendFactor = 1.0f;
  345. uint32_t nScreenWidth = 256;
  346. uint32_t nScreenHeight = 240;
  347. uint32_t nPixelWidth = 4;
  348. uint32_t nPixelHeight = 4;
  349. int32_t nMousePosX = 0;
  350. int32_t nMousePosY = 0;
  351. int32_t nMouseWheelDelta = 0;
  352. int32_t nMousePosXcache = 0;
  353. int32_t nMousePosYcache = 0;
  354. int32_t nMouseWheelDeltaCache = 0;
  355. int32_t nWindowWidth = 0;
  356. int32_t nWindowHeight = 0;
  357. int32_t nViewX = 0;
  358. int32_t nViewY = 0;
  359. int32_t nViewW = 0;
  360. int32_t nViewH = 0;
  361. bool bFullScreen = false;
  362. float fPixelX = 1.0f;
  363. float fPixelY = 1.0f;
  364. float fSubPixelOffsetX = 0.0f;
  365. float fSubPixelOffsetY = 0.0f;
  366. bool bHasInputFocus = false;
  367. bool bHasMouseFocus = false;
  368. float fFrameTimer = 1.0f;
  369. int nFrameCount = 0;
  370. Sprite *fontSprite = nullptr;
  371. std::function<olc::Pixel(const int x, const int y, const olc::Pixel&, const olc::Pixel&)> funcPixelMode;
  372. static std::map<uint16_t, uint8_t> mapKeys;
  373. bool pKeyNewState[256]{ 0 };
  374. bool pKeyOldState[256]{ 0 };
  375. HWButton pKeyboardState[256];
  376. bool pMouseNewState[5]{ 0 };
  377. bool pMouseOldState[5]{ 0 };
  378. HWButton pMouseState[5];
  379. #ifdef _WIN32
  380. HDC glDeviceContext = nullptr;
  381. HGLRC glRenderContext = nullptr;
  382. #else
  383. GLXContext glDeviceContext = nullptr;
  384. GLXContext glRenderContext = nullptr;
  385. #endif
  386. GLuint glBuffer;
  387. void EngineThread();
  388. // If anything sets this flag to false, the engine
  389. // "should" shut down gracefully
  390. static std::atomic<bool> bAtomActive;
  391. // Common initialisation functions
  392. void olc_UpdateMouse(int32_t x, int32_t y);
  393. void olc_UpdateMouseWheel(int32_t delta);
  394. void olc_UpdateWindowSize(int32_t x, int32_t y);
  395. void olc_UpdateViewport();
  396. bool olc_OpenGLCreate();
  397. void olc_ConstructFontSheet();
  398. uint32_t olc_GetMaximumPixelSize(uint32_t w, uint32_t h);
  399. #ifdef _WIN32
  400. // Windows specific window handling
  401. HWND olc_hWnd = nullptr;
  402. HWND olc_WindowCreate();
  403. std::wstring wsAppName;
  404. static LRESULT CALLBACK olc_WindowEvent(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
  405. #else
  406. // Non-Windows specific window handling
  407. Display* olc_Display = nullptr;
  408. Window olc_WindowRoot;
  409. Window olc_Window;
  410. XVisualInfo* olc_VisualInfo;
  411. Colormap olc_ColourMap;
  412. XSetWindowAttributes olc_SetWindowAttribs;
  413. XSizeHints olc_SizeHints;
  414. Display* olc_WindowCreate();
  415. #endif
  416. };
  417. class PGEX
  418. {
  419. friend class olc::PixelGameEngine;
  420. protected:
  421. static PixelGameEngine* pge;
  422. };
  423. //=============================================================
  424. }
  425. #endif // OLC_PGE_DEF