diff --git a/Example/MyTestTextScene.cpp b/Example/MyTestTextScene.cpp index 22a5f39..265dc75 100644 --- a/Example/MyTestTextScene.cpp +++ b/Example/MyTestTextScene.cpp @@ -13,7 +13,7 @@ std::map> gen_font_stuff(const image_loader::Imag { std::map> ret; std::string alpha = " abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ`1234567890-=[]\\;',./~!@#$%^&*()_+{}|:\"<>?"; - unsigned int delta_x = 9; + unsigned int delta_x = image.width / alpha.size(); unsigned int height = image.height; for (unsigned int i = 0; i < alpha.size(); ++i) { @@ -24,7 +24,7 @@ std::map> gen_font_stuff(const image_loader::Imag MyTextTestScene::MyTextTestScene(Application& application) : Scene(application), - m_font_image(image_loader::load_file(IMAGE_PATH "consolas-16px.png")), + m_font_image(image_loader::load_file(IMAGE_PATH "charcoal-thin-curve-16px.png")), m_font(m_font_image, gen_font_stuff(m_font_image)), m_text_image(m_font.get_text_image(TEST_TEXT)), m_text( @@ -51,14 +51,36 @@ void MyTextTestScene::init() m_text_batch.reset_rendered(); m_text_batch.add_rendered(m_text_pose); - - m_text_pipeline.reset_text(); - m_text_pipeline.add_text(vec3(0.0f, -30.0f, 0.0f), TEST_TEXT, RelativePosition::CENTER_CENTER); } void MyTextTestScene::update(float delta_time, clock_t clock) { - // Do Nothing + glm::vec3 translation(0.0f, 0.0f, 0.0f); + if (m_input_manager.is_key_down(GLFW_KEY_W)) + { + translation.y += 1; + } + if (m_input_manager.is_key_down(GLFW_KEY_S)) + { + translation.y -= 1; + } + if (m_input_manager.is_key_down(GLFW_KEY_A)) + { + translation.x -= 1; + } + if (m_input_manager.is_key_down(GLFW_KEY_D)) + { + translation.x += 1; + } + + m_camera.translate(translation); + + m_text_pipeline.reset_text(); + m_text_pipeline.add_text(vec3(0.0f, -30.0f, 0.0f), TEST_TEXT, RelativePosition::TOP_CENTER); + m_text_pipeline.add_text(vec3(0.0f, -60.0f, 0.0f), "Delta Time: " + std::to_string(delta_time), RelativePosition::TOP_LEFT); + m_text_pipeline.add_text(vec3(0.0f, -90.0f, 0.0f), "Clock: " + std::to_string(clock), RelativePosition::TOP_LEFT); + m_text_pipeline.add_text(vec3(0.0f, -120.0f, 0.0f), "the quick brown fox jumps over the lazy dog.", RelativePosition::TOP_LEFT); + m_text_pipeline.add_text(vec3(0.0f, -150.0f, 0.0f), "THE QUICK BROWN FOX JUMPS OVER THE LAZY DOG.", RelativePosition::TOP_LEFT); } void MyTextTestScene::prerender() diff --git a/images/charcoal-thin-16px.png b/images/charcoal-thin-16px.png new file mode 100644 index 0000000..470a087 Binary files /dev/null and b/images/charcoal-thin-16px.png differ diff --git a/images/charcoal-thin-curve-16px.png b/images/charcoal-thin-curve-16px.png new file mode 100644 index 0000000..76c1834 Binary files /dev/null and b/images/charcoal-thin-curve-16px.png differ