compiler: fix -live compilation of bounce example with gcc-9 & clang
parent
7a51d4d796
commit
aa9bb6f71a
|
@ -79,11 +79,12 @@ const (
|
||||||
[live]
|
[live]
|
||||||
fn (game &Game) draw() {
|
fn (game &Game) draw() {
|
||||||
game.gg.draw_rect(game.x, game.y, width, width, blue)
|
game.gg.draw_rect(game.x, game.y, width, width, blue)
|
||||||
// game.gg.draw_rect(game.x, game.y, width, width, gx.rgb(128,10,255))
|
game.gg.draw_rect(550 - game.x + 10, 200 - game.y + 50, width, width, gx.rgb(128, 10, 255))
|
||||||
|
game.gg.draw_rect(game.x - 20, 250 - game.y, width, width, gx.rgb(128, 240, 155))
|
||||||
}
|
}
|
||||||
|
|
||||||
[live]
|
[live]
|
||||||
fn (game mut Game) update_model() {
|
fn (mut game Game) update_model() {
|
||||||
// game.x = 0 game.y = 0 game.dx = 1 game.dy = 1
|
// game.x = 0 game.y = 0 game.dx = 1 game.dy = 1
|
||||||
// game.dx = 3 game.dy = 3
|
// game.dx = 3 game.dy = 3
|
||||||
speed := 2
|
speed := 2
|
||||||
|
@ -97,7 +98,7 @@ fn (game mut Game) update_model() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn (game mut Game) run() {
|
fn (mut game Game) run() {
|
||||||
for {
|
for {
|
||||||
game.update_model()
|
game.update_model()
|
||||||
glfw.post_empty_event() // Refresh
|
glfw.post_empty_event() // Refresh
|
||||||
|
|
|
@ -101,7 +101,7 @@ fn (mut g Gen) gen_fn_decl(it ast.FnDecl) {
|
||||||
}
|
}
|
||||||
g.definitions.writeln(');')
|
g.definitions.writeln(');')
|
||||||
g.writeln(') {')
|
g.writeln(') {')
|
||||||
if is_livemain {
|
if is_live_wrap {
|
||||||
// The live function just calls its implementation dual, while ensuring
|
// The live function just calls its implementation dual, while ensuring
|
||||||
// that the call is wrapped by the mutex lock & unlock calls.
|
// that the call is wrapped by the mutex lock & unlock calls.
|
||||||
// Adding the mutex lock/unlock inside the body of the implementation
|
// Adding the mutex lock/unlock inside the body of the implementation
|
||||||
|
|
Loading…
Reference in New Issue