From 58d42a97c5a5f637b1dbbf9d9920f3709759b9c6 Mon Sep 17 00:00:00 2001 From: ericoporto Date: Sun, 24 Nov 2019 20:42:42 -0300 Subject: [PATCH] fix wrongly reinitializing properties on every frame --- agsbox2d/agsbox2d.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/agsbox2d/agsbox2d.cpp b/agsbox2d/agsbox2d.cpp index 1659949..f6b9a65 100644 --- a/agsbox2d/agsbox2d.cpp +++ b/agsbox2d/agsbox2d.cpp @@ -1460,14 +1460,18 @@ void AGS_EngineShutdown() //------------------------------------------------------------------------------ +bool do_only_once = false; int AGS_EngineOnEvent(int event, int data) //*** optional *** { if(event==AGSE_PRESCREENDRAW){ //initialize debug - int screenWidth, screenHeight, colDepth; - engine->GetScreenDimensions(&screenWidth, &screenHeight, &colDepth); - debugDraw.InitializeAgsDebugDraw(engine, screenWidth, screenHeight, colDepth); - printf("\nagsbox2d 0.2.0\n"); + if(!do_only_once) { + int screenWidth, screenHeight, colDepth; + engine->GetScreenDimensions(&screenWidth, &screenHeight, &colDepth); + debugDraw.InitializeAgsDebugDraw(engine, screenWidth, screenHeight, colDepth); + printf("\nagsbox2d 0.2.0\n"); + do_only_once = true; + } } /*