diff options
Diffstat (limited to 'txtgameengine/__main__.py')
-rw-r--r-- | txtgameengine/__main__.py | 37 |
1 files changed, 17 insertions, 20 deletions
diff --git a/txtgameengine/__main__.py b/txtgameengine/__main__.py index bed2972..84d71ca 100644 --- a/txtgameengine/__main__.py +++ b/txtgameengine/__main__.py @@ -1,34 +1,31 @@ -import glfw -from glfw.GLFW import * +import numpy as np from .app import TxtGameApp - - -def main(): - glfw.init() - glfw.window_hint(GLFW_CLIENT_API, GLFW_NO_API) - window = glfw.create_window(640, 480, "Vulkan window", None, None) - if not window: - glfw.terminate() - return - glfw.swap_interval(1) - while not glfw.window_should_close(window): - glfw.swap_buffers(window) - glfw.poll_events() - glfw.destroy_window(window) - glfw.terminate() +from OpenGL.GL import * class TestApp(TxtGameApp): def __init__(self): - super().__init__((640, 480), "Vulkan window") - self.requested_validation_layers += ["VK_LAYER_KHRONOS_validation"] + super().__init__((640, 480), "OpenGL window") + + def init(self): + self.render.setup_vertex_arrays() + #self.platform.check_debug() + self.default_shaders = self.shaders.load_shaders( + 'base_shaders/vertex.glsl', 'base_shaders/fragment.glsl') + self.tri_buffer = self.render.setup_triangle(np.array([ + -1.0, -1.0, 0.0, + 1.0, -1.0, 0.0, + 0.0, 1.0, 0.0, + ], np.float32)) def update(self, delta: float): super().update(delta) + with self.default_shaders: + self.render.triangle(self.tri_buffer) + if __name__ == '__main__': - # main() a = TestApp() a.start() |