Skip to content

Commit

Permalink
fix wrongly reinitializing properties on every frame
Browse files Browse the repository at this point in the history
  • Loading branch information
ericoporto committed Nov 24, 2019
1 parent 7a2e0cc commit 58d42a9
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions agsbox2d/agsbox2d.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}

/*
Expand Down

0 comments on commit 58d42a9

Please sign in to comment.