Mercurial > games > semicongine
diff examples/E01_hello_triangle.nim @ 1140:5934c5615f13
did: update all examples to work with latest refactoring
author | sam <sam@basx.dev> |
---|---|
date | Sat, 08 Jun 2024 15:16:17 +0700 |
parents | 114f395b9144 |
children |
line wrap: on
line diff
--- a/examples/E01_hello_triangle.nim Sat Jun 08 14:58:25 2024 +0700 +++ b/examples/E01_hello_triangle.nim Sat Jun 08 15:16:17 2024 +0700 @@ -4,14 +4,14 @@ # shader setup const - shaderConfiguration = createShaderConfiguration( + shaderConfiguration = CreateShaderConfiguration( name = "default shader", inputs = [ - attr[Vec3f]("position"), - attr[Vec4f]("color"), + Attr[Vec3f]("position"), + Attr[Vec4f]("color"), ], - intermediates = [attr[Vec4f]("outcolor")], - outputs = [attr[Vec4f]("color")], + intermediates = [Attr[Vec4f]("outcolor")], + outputs = [Attr[Vec4f]("color")], vertexCode = "gl_Position = vec4(position, 1.0); outcolor = color;", fragmentCode = "color = outcolor;", ) @@ -19,19 +19,19 @@ # scene setup var scene = Scene(name: "scene", - meshes: @[newMesh( + meshes: @[NewMesh( positions = [NewVec3f(-0.5, 0.5), NewVec3f(0, -0.5), NewVec3f(0.5, 0.5)], colors = [NewVec4f(1, 0, 0, 1), NewVec4f(0, 1, 0, 1), NewVec4f(0, 0, 1, 1)], material = VERTEX_COLORED_MATERIAL.InitMaterialData() )] ) - myengine = initEngine("Hello triangle", showFps = true) + myengine = InitEngine("Hello triangle", showFps = true) -myengine.initRenderer({VERTEX_COLORED_MATERIAL: shaderConfiguration}, inFlightFrames = 2) -myengine.loadScene(scene) +myengine.InitRenderer({VERTEX_COLORED_MATERIAL: shaderConfiguration}, inFlightFrames = 2) +myengine.LoadScene(scene) while myengine.UpdateInputs() and not KeyWasPressed(Escape): - transform[Vec3f](scene.meshes[0][], "position", scale(1.001, 1.001)) - myengine.renderScene(scene) + Transform[Vec3f](scene.meshes[0][], "position", Scale(1.001, 1.001)) + myengine.RenderScene(scene) -myengine.destroy() +myengine.Destroy()