Skip to content

Commit

Permalink
Fix text render in higher resolution
Browse files Browse the repository at this point in the history
  • Loading branch information
JakubPrzystasz committed Jan 14, 2021
1 parent 438651f commit 7cd9a63
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
10 changes: 5 additions & 5 deletions Engine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ void Engine::updateWindow()
void Engine::renderFrame()
{
if (!world->worldGenerated) {
text.RenderText("Generating world...", static_cast<float>(320), static_cast<float>(300), 0.4f, glm::vec3(0.f, 0.f, 0.f));
text.RenderText("Generating world...", static_cast<float>((screenWidth/2) - 80), static_cast<float>(screenHeight/2), 0.4f, glm::vec3(0.f, 0.f, 0.f));
GLuint x = world->GetChunksCount();
if (world->GetChunksCount() >= SectionSize) {
world->BuildMesh();
Expand All @@ -262,15 +262,15 @@ void Engine::renderFrame()
if (showDebugData) {
int line = 0;
for (std::string& str : DebugData) {
text.RenderText(str, static_cast<float>(5), static_cast<float>(585 - (line++ * 25)), 0.4f, glm::vec3(0.f, 0.f, 0.f));
text.RenderText(str, static_cast<float>(5), static_cast<float>(screenHeight - 15 - (line++ * 25)), 0.4f, glm::vec3(0.f, 0.f, 0.f));
}
}

if (flyMode) {
std::stringstream STRING;
STRING << "Speed: " << camera.MovementSpeed;
text.RenderText("Fly mode", static_cast<float>(700), static_cast<float>(580), 0.4f, glm::vec3(0.f, 0.f, 0.f));
text.RenderText(STRING.str(), static_cast<float>(700), static_cast<float>(550), 0.4f, glm::vec3(0.f, 0.f, 0.f));
text.RenderText("Fly mode", static_cast<float>(screenWidth-100), static_cast<float>(screenHeight-20), 0.4f, glm::vec3(0.f, 0.f, 0.f));
text.RenderText(STRING.str(), static_cast<float>(screenWidth - 100), static_cast<float>(screenHeight - 40), 0.4f, glm::vec3(0.f, 0.f, 0.f));
}

std::stringstream STRING;
Expand All @@ -291,7 +291,7 @@ Engine::Engine()
screenHeight = 600;
screenWidth = 800;
crossHairSize = 8;
RenderDistance = 3;
RenderDistance = 8;
ChunkSize = 8;
ChunkOffset = 2;
RayRange = 7;
Expand Down
2 changes: 1 addition & 1 deletion main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
int main() {

Engine engine = Engine();
engine.InitializeWindow(800, 600, "Minecraft");
engine.InitializeWindow(1240, 700, "Minecraft ++");
engine.WindowLoop();

return 0;
Expand Down

0 comments on commit 7cd9a63

Please sign in to comment.