Skip to content

Commit

Permalink
Cache showPolygonRamCount
Browse files Browse the repository at this point in the history
  • Loading branch information
IAmMoltony committed Feb 3, 2024
1 parent f17aa2d commit d960ada
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 7 deletions.
2 changes: 1 addition & 1 deletion concepts/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
# DS-Craft concepts

This directory is where I think about how stuff in the game should be implemented
and write it down.
and write (or draw) it down.
5 changes: 5 additions & 0 deletions include/game.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,11 @@ class Game
*/
bool showFavorites;

/**
* @brief Whether or not to show polygon count
*/
bool showPolygonRamCount;

/**
* @brief Quit the game
*
Expand Down
12 changes: 6 additions & 6 deletions source/game.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -383,8 +383,10 @@ void Game::init(int argc, char **argv)
hang();
}

// init game version
gamever::InitStatus gvis = gamever::init(mtnconfigGet("gameVersionFile"));
showPolygonRamCount = mtnconfigGetBool("showPolygonRamCount")

// init game version
gamever::InitStatus gvis = gamever::init(mtnconfigGet("gameVersionFile"));
if (gvis == gamever::InitStatus::FileOpenError)
{
mtnlogMessageTagC(MTNLOG_ERROR, "init", "Error opening game version file '%s': %s", mtnconfigGet("gameVersionFile"), strerror(errno));
Expand Down Expand Up @@ -1617,13 +1619,11 @@ void Game::draw(void)
break;
}

// TODO cache this
if (mtnconfigGetBool("showPolygonRamCount"))
if (showPolygonRamCount)
{
// for debug purposes
int vc = 0;
glGetInt(GL_GET_POLYGON_RAM_COUNT, &vc);
printf("polygon ram count %d\n", vc);
printf("Polygon count: %d\n", vc);
}
}

Expand Down

0 comments on commit d960ada

Please sign in to comment.