diff options
author | rom <romangraef@gmail.com> | 2021-04-24 03:19:22 +0200 |
---|---|---|
committer | rom <romangraef@gmail.com> | 2021-04-24 11:08:22 +0200 |
commit | ec934bf2f0f3536c1b4d31b4ca002f6f38ada9fe (patch) | |
tree | 21e44e889c91eeecc1537e69eae7d0b50d25804a /txtgameengine/__main__.py | |
parent | a0a40e9259b9e8be4e677c8c29dfdfb89eb81ce8 (diff) | |
download | txtgameengine-ec934bf2f0f3536c1b4d31b4ca002f6f38ada9fe.tar.gz txtgameengine-ec934bf2f0f3536c1b4d31b4ca002f6f38ada9fe.tar.bz2 txtgameengine-ec934bf2f0f3536c1b4d31b4ca002f6f38ada9fe.zip |
font rendering
Diffstat (limited to 'txtgameengine/__main__.py')
-rw-r--r-- | txtgameengine/__main__.py | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/txtgameengine/__main__.py b/txtgameengine/__main__.py index 71085e1..7aaa64f 100644 --- a/txtgameengine/__main__.py +++ b/txtgameengine/__main__.py @@ -1,5 +1,6 @@ import numpy as np +from .fonts import TextRenderer, BitmapFont from .scenes import SceneTxtGameApp, Scene from pathlib import Path from .shaders import TextureShader @@ -54,20 +55,23 @@ class TextureScene(Scene): -1.0, 1.0, 1.0, 1.0, -1.0, -1.0, + 1.0, -1.0, ], np.float32)) self.uvs = self.app.render.setup_buffer( np.array([ 0, 0, 1, 0, 0, 1, + 1, 1, ], np.float32)) + self.text_renderer = TextRenderer(self.app) + self.text_renderer.use_font(BitmapFont.fira_mono(self.app)) def update(self, delta: float): - print(self.app.coords.from_pixels_to_screen(0, 0)) - print(self.app.coords.from_screen_to_pixels(0, 0)) with self.texture_shaders: - self.app.render.textured_triangle(self.texture_shaders.textureSampler, self.texture, self.triangle, - self.uvs) + self.app.render.bind_texture(self.texture_shaders.textureSampler, self.texture) + self.app.render.textured_triangle(self.triangle, self.uvs, 4) + self.text_renderer.render_text(0, 0, "HEE") class TestApp(SceneTxtGameApp): |