Commit e7f21e59 authored by Nikolay Igotti's avatar Nikolay Igotti

Fix samples

parent 0f799c3e
...@@ -10,10 +10,11 @@ import org.w3c.dom.HTMLCanvasElement ...@@ -10,10 +10,11 @@ import org.w3c.dom.HTMLCanvasElement
fun main() { fun main() {
onWasmReady { onWasmReady {
val paint = Paint() val paint = Paint().apply {
paint.setColor4f(Color4f(0f, 1f, 0f, 1.0f)) color4f = Color4f(0f, 1f, 0f, 1.0f)
paint.setMode(PaintMode.FILL) mode = PaintMode.FILL
paint.setAntiAlias(true) isAntiAlias = true
}
val canvas = document.getElementById("c") as HTMLCanvasElement val canvas = document.getElementById("c") as HTMLCanvasElement
canvas.getContext("webgl") canvas.getContext("webgl")
...@@ -34,7 +35,7 @@ fun main() { ...@@ -34,7 +35,7 @@ fun main() {
fun draw() { fun draw() {
surface.canvas.drawCircle(50f, 50f, 25f, paint) surface.canvas.drawCircle(50f, 50f, 25f, paint)
paint.setColor4f(Color4f(1f, 1f, 0f, 1.0f)) paint.color4f = Color4f(1f, 1f, 0f, 1.0f)
surface.canvas.drawCircle(100f, 100f, 10f, paint) surface.canvas.drawCircle(100f, 100f, 10f, paint)
surface.canvas.drawCircle(200f, 200f, 30f, paint) surface.canvas.drawCircle(200f, 200f, 30f, paint)
window.requestAnimationFrame { draw() } window.requestAnimationFrame { draw() }
......
...@@ -49,8 +49,7 @@ class Renderer( ...@@ -49,8 +49,7 @@ class Renderer(
fun displayScene(renderer: Renderer, nanoTime: Long) { fun displayScene(renderer: Renderer, nanoTime: Long) {
val canvas = renderer.canvas!! val canvas = renderer.canvas!!
val paint = Paint() val paint = Paint().apply { color = Color.GREEN}
paint.setColor(Color.GREEN)
canvas.clear(Color.RED) canvas.clear(Color.RED)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment