mirror of
https://github.com/celisej567/mcpe.git
synced 2026-09-17 20:10:23 +03:00
* Add F3 debug text.
This commit is contained in:
@@ -52,6 +52,8 @@ void Options::initDefaultValues()
|
||||
field_1C = "Default";
|
||||
m_playerName = "Steve";
|
||||
m_bServerVisibleDefault = true;
|
||||
m_bDebugText = false;
|
||||
|
||||
m_keyBinds[0] = { "key.forward", 'W' };
|
||||
m_keyBinds[1] = { "key.left", 'A' };
|
||||
m_keyBinds[2] = { "key.back", 'S' };
|
||||
|
||||
@@ -110,5 +110,6 @@ public:
|
||||
std::string m_playerName;
|
||||
bool m_bServerVisibleDefault;
|
||||
bool m_bAutoJump;
|
||||
bool m_bDebugText;
|
||||
};
|
||||
|
||||
|
||||
@@ -49,6 +49,9 @@ void GameRenderer::_init()
|
||||
field_7C = 0.0f;
|
||||
field_80 = 0.0f;
|
||||
field_84 = 0.0f;
|
||||
m_lastUpdatedMS = 0;
|
||||
m_shownFPS = 0;
|
||||
m_shownChunkUpdates = 0;
|
||||
}
|
||||
|
||||
GameRenderer::GameRenderer(Minecraft* pMinecraft) :
|
||||
@@ -622,6 +625,34 @@ void GameRenderer::render(float f)
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
std::stringstream debugText;
|
||||
debugText << "ReMinecraftPE " << m_pMinecraft->getVersionString();
|
||||
debugText << "\n" << m_shownFPS << " fps, " << m_shownChunkUpdates << " chunk updates";
|
||||
|
||||
if (m_pMinecraft->m_options.m_bDebugText)
|
||||
{
|
||||
if (m_pMinecraft->m_pLocalPlayer)
|
||||
{
|
||||
char posStr[64];
|
||||
Vec3 pos = m_pMinecraft->m_pLocalPlayer->getPos(f);
|
||||
snprintf(posStr, sizeof posStr, "%.2f, %.2f, %.2f", pos.x, pos.y, pos.z);
|
||||
|
||||
debugText << "\npos: " << posStr;
|
||||
debugText << "\n" << m_pMinecraft->m_pLevelRenderer->gatherStats1();
|
||||
}
|
||||
|
||||
m_pMinecraft->m_pFont->drawShadow(debugText.str(), 2, 2, 0xFFFFFF);
|
||||
}
|
||||
|
||||
int timeMs = getTimeMs();
|
||||
if (timeMs - m_lastUpdatedMS >= 1000)
|
||||
{
|
||||
m_lastUpdatedMS = timeMs;
|
||||
m_shownFPS = m_pMinecraft->getFpsIntlCounter();
|
||||
m_shownChunkUpdates = Chunk::updates;
|
||||
Chunk::updates = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void GameRenderer::tick()
|
||||
|
||||
@@ -84,5 +84,7 @@ public:
|
||||
|
||||
float m_matrix_projection[16];
|
||||
float m_matrix_model_view[16];
|
||||
|
||||
int m_shownFPS, m_shownChunkUpdates, m_lastUpdatedMS;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user