Mercurial > games > semicongine
comparison tests/test_collision.nim @ 1138:02e1d2658ff5
did: more renaming
author | sam <sam@basx.dev> |
---|---|
date | Tue, 04 Jun 2024 22:08:48 +0700 |
parents | a4aa9f374d44 |
children | 114f395b9144 |
comparison
equal
deleted
inserted
replaced
1137:a4aa9f374d44 | 1138:02e1d2658ff5 |
---|---|
26 outputs = [Attr[Vec4f]("fragcolor")], | 26 outputs = [Attr[Vec4f]("fragcolor")], |
27 vertexCode = """gl_Position = vec4(position, 1.0) * (transform * Uniforms.perspective); colorout = color;""", | 27 vertexCode = """gl_Position = vec4(position, 1.0) * (transform * Uniforms.perspective); colorout = color;""", |
28 fragmentCode = """fragcolor = colorout;""", | 28 fragmentCode = """fragcolor = colorout;""", |
29 ) | 29 ) |
30 | 30 |
31 var engine = initEngine("Test collisions") | 31 var engine = InitEngine("Test collisions") |
32 | 32 |
33 engine.initRenderer({VERTEX_COLORED_MATERIAL: shaderConfiguration}) | 33 engine.InitRenderer({VERTEX_COLORED_MATERIAL: shaderConfiguration}) |
34 engine.loadScene(scene) | 34 engine.LoadScene(scene) |
35 | 35 |
36 while engine.UpdateInputs() and not KeyIsDown(Escape): | 36 while engine.UpdateInputs() and not KeyIsDown(Escape): |
37 if WindowWasResized(): | 37 if WindowWasResized(): |
38 var winSize = engine.GetWindow().size | 38 var winSize = engine.GetWindow().size |
39 scene.setShaderGlobal("perspective", OrthoWindowAspect(winSize[0] / winSize[1])) | 39 scene.setShaderGlobal("perspective", OrthoWindowAspect(winSize[0] / winSize[1])) |
49 if KeyIsDown(Key.C): scene.meshes[1].transform = scene.meshes[1].transform * Translate(0, -0.001, 0) | 49 if KeyIsDown(Key.C): scene.meshes[1].transform = scene.meshes[1].transform * Translate(0, -0.001, 0) |
50 if KeyIsDown(Key.V): scene.meshes[1].transform = scene.meshes[1].transform * Translate(0, 0.001, 0) | 50 if KeyIsDown(Key.V): scene.meshes[1].transform = scene.meshes[1].transform * Translate(0, 0.001, 0) |
51 let hitbox = Collider(theType: Box, transform: scene.meshes[0].transform * Translate(-0.5, -0.5)) | 51 let hitbox = Collider(theType: Box, transform: scene.meshes[0].transform * Translate(-0.5, -0.5)) |
52 let hitsphere = Collider(theType: Sphere, transform: scene.meshes[2].transform, radius: 0.5) | 52 let hitsphere = Collider(theType: Sphere, transform: scene.meshes[2].transform, radius: 0.5) |
53 echo intersects(hitbox, hitsphere) | 53 echo intersects(hitbox, hitsphere) |
54 engine.renderScene(scene) | 54 engine.RenderScene(scene) |
55 engine.destroy() | 55 engine.Destroy() |
56 | 56 |
57 | 57 |
58 when isMainModule: | 58 when isMainModule: |
59 main() | 59 main() |