mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
compiler: fix -live compilation of bounce example with gcc-9 & clang
This commit is contained in:
@@ -79,11 +79,12 @@ const (
|
||||
[live]
|
||||
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, 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]
|
||||
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.dx = 3 game.dy = 3
|
||||
speed := 2
|
||||
@@ -97,7 +98,7 @@ fn (game mut Game) update_model() {
|
||||
}
|
||||
}
|
||||
|
||||
fn (game mut Game) run() {
|
||||
fn (mut game Game) run() {
|
||||
for {
|
||||
game.update_model()
|
||||
glfw.post_empty_event() // Refresh
|
||||
|
@@ -101,7 +101,7 @@ fn (mut g Gen) gen_fn_decl(it ast.FnDecl) {
|
||||
}
|
||||
g.definitions.writeln(');')
|
||||
g.writeln(') {')
|
||||
if is_livemain {
|
||||
if is_live_wrap {
|
||||
// The live function just calls its implementation dual, while ensuring
|
||||
// that the call is wrapped by the mutex lock & unlock calls.
|
||||
// Adding the mutex lock/unlock inside the body of the implementation
|
||||
|
Reference in New Issue
Block a user