From d08e9f107863bca0ee99f9c47360a2506b9c325e Mon Sep 17 00:00:00 2001 From: Elipzer Date: Mon, 19 Nov 2018 16:38:33 -0500 Subject: [PATCH] Added 2 new fonts (personally made) and now text looks much nicer. --- Example/MyTestTextScene.cpp | 34 +++++++++++++++++++++++----- images/charcoal-thin-16px.png | Bin 0 -> 3744 bytes images/charcoal-thin-curve-16px.png | Bin 0 -> 3816 bytes 3 files changed, 28 insertions(+), 6 deletions(-) create mode 100644 images/charcoal-thin-16px.png create mode 100644 images/charcoal-thin-curve-16px.png 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 0000000000000000000000000000000000000000..470a087bbe5d7b93f2d63255574afdfc983f0eef GIT binary patch literal 3744 zcmV;R4qx$!P) zaB^>EX>4U6ba`-PAZ2)IW&i+q+O3yuk|eDSg#U929|4d+;y8Rp_y#_{AF69-y|eqi z5q7w1rmKghgveB;n6Ur#&lCQ^D|xO#i+OFeMqb*q<<19>pV#M}qCW4>t5}qG^q2AQ z-eb%R-6@}GvF^`3b;irj2Tb4b@#}c7`Nr`#(2vM(K)EYtKD_h%4J7$9p5DJhd!Ot2 zAKQ6<#hwsflfVD11{kX_C^_UUNh0s}!7OATE}i%EytjNuDxdT7{z>!?*oCi;-@uFd zXY68sXUMNmgjnAR^&3X-cq)I!?m_4qYw2D2moEVK#}dC`ch2&2_GfopD@fJwZYsVZ zo=;31>`k7>DwpwF_-xPBxSTCcKwm64xMoN#WzarJ(@H&^w4eJ-lN2@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*+}e>paV)7boegdjn}P`2&|o zK>%UEJ#-ic#rSVxW9&jnXKYAQv#XgBTgGi7h+)Cj!|g~KTkaw5V{>$@{K#l@c9y4_ zQArOyvpUUHMlrGi^OV*8)z0o|;}dkOe+>N#3bF&ZE^`_DtxLRe_d}~K;A&D`dDoK% z0%**}Ow$xd4tLM`yeO_bSGM;3ow3&_9d|6SM_+16aaW)s6}7O4c*uXnBPi&_L1Wwz z2nq^XImd>-;p0+JcCjg-;))H)NIF`_WMh2wJQCn4t$#L71o1(4>R?b%!(d*n0000< KMNUMnLSTXyqbg(o literal 0 HcmV?d00001 diff --git a/images/charcoal-thin-curve-16px.png b/images/charcoal-thin-curve-16px.png new file mode 100644 index 0000000000000000000000000000000000000000..76c1834309c7632e10a56216ece71137589f4210 GIT binary patch literal 3816 zcmVP) zaB^>EX>4U6ba`-PAZ2)IW&i+q+O3ysk|e7QM*p)4F98rpVmUk`yaO-ahpe0)PtV*N zVTUWbE2}9|2z?LHVgKu&C;Wp~@~oj$b8V`TS81i?&Iga5*XN#MdETE_wJ7iCFXQ38 z$Cw$qQ$Ew8?$14S#_P`qti0pn*YRNUjpJ{iACcdHa#zlLc<1>WNb+Yqy?=-HKG(~C zZ0G$IdqR9o{{D9{im@t#l0)8-B=UYA%t8j@(s@tMd&_r3`7C_Ggk z+Qt6PkY7s?qP`RKTaDiFRR3JNr$XOQOYh3Rd_i%4Eb&|I&RKrW{_L(7rBWK+O~p6F z^NERry~*>Kav8ss&-Pr6%h}?j=!*ph*9@tpOtnucX{DY{+RuHaNs1-!Y}|96S)MT$ z%Pr3blya|hvPqK_z$nWEHDNe^<&vIt+q2$G&dMt>Gbe&2p7`wwe;WK>uCGAnT@#59h z&E1>#mYZN7K@XO5wu~rh2DMZ#I4fPmK(OqT>q%eO{Y36> zaSOHlSGeWBLM~kB{vXJN3*C#{@3{Q|wbdWflLw%y!dufQ2V>hhCVo`gTs!%YGpe@1 zZcCZI=Uli9<1KD{Y+7$;Y$GJiQra>dX_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