mirror of
https://github.com/Kindelia/Kind2.git
synced 2024-09-11 07:15:45 +03:00
fix apps with new syntax
This commit is contained in:
parent
40fbd7d4a1
commit
d5f75b47a7
@ -242,7 +242,10 @@ App.Nya.when: App.When<App.Nya.State>
|
||||
mouse_move: IO {
|
||||
let x = U32.to_f64(event.mouse_pos@fst)
|
||||
let y = U32.to_f64(event.mouse_pos@snd)
|
||||
App.set_local!(state.local@pos <- V2.new(x,y))
|
||||
let pos = V2.new(x, y)
|
||||
App.set_local!(state.local@pos <- pos)
|
||||
// TODO verify bug
|
||||
// App.set_local!(state.local@pos <- V2.new(x,y))
|
||||
}
|
||||
} default App.pass!
|
||||
|
||||
|
@ -39,13 +39,13 @@ App.Seta.when: App.When<App.Seta.State>
|
||||
input:
|
||||
switch String.eql(event.id) {
|
||||
"0":
|
||||
App.set_local!(state.local@fst <- state.local@fst@fst <- I32.read(event.text))
|
||||
App.set_local!(state.local@fst@fst <- I32.read(event.text))
|
||||
"1":
|
||||
App.set_local!(state.local@fst <- state.local@fst@snd <- I32.read(event.text))
|
||||
App.set_local!(state.local@fst@snd <- I32.read(event.text))
|
||||
"2":
|
||||
App.set_local!(state.local@snd <- state.local@snd@fst <- I32.read(event.text))
|
||||
App.set_local!(state.local@snd@fst <- I32.read(event.text))
|
||||
"3":
|
||||
App.set_local!(state.local@snd <- state.local@snd@snd <- I32.read(event.text))
|
||||
App.set_local!(state.local@snd@snd <- I32.read(event.text))
|
||||
} default App.pass!
|
||||
} default App.pass!
|
||||
|
||||
|
@ -7,17 +7,17 @@ Hexagonal.Axial.line(
|
||||
open start
|
||||
open goal
|
||||
|
||||
{si, sj} = {I32.to_f64(start.i), I32.to_f64(start.j)}
|
||||
{gi, gj} = {I32.to_f64(goal.i), I32.to_f64(goal.j)}
|
||||
let {si, sj} = {I32.to_f64(start.i), I32.to_f64(start.j)}
|
||||
let {gi, gj} = {I32.to_f64(goal.i), I32.to_f64(goal.j)}
|
||||
|
||||
coords = []
|
||||
distance = I32.to_nat(Hexagonal.Axial.distance(start, goal))
|
||||
let coords = []
|
||||
let distance = I32.to_nat(Hexagonal.Axial.distance(start, goal))
|
||||
for i from 0 to distance with coords:
|
||||
i = F64.from_nat(i + 1)
|
||||
distance = F64.from_nat(distance)
|
||||
ratio = i/distance
|
||||
inter_x = F64.lerp(si, gi, ratio)
|
||||
inter_y = F64.lerp(sj, gj, ratio)
|
||||
{new_i, new_j} = Hexagonal.Axial.round(inter_x, inter_y)
|
||||
let i = F64.from_nat(i + 1)
|
||||
let distance = F64.from_nat(distance)
|
||||
let ratio = i/distance
|
||||
let inter_x = F64.lerp(si, gi, ratio)
|
||||
let inter_y = F64.lerp(sj, gj, ratio)
|
||||
let {new_i, new_j} = Hexagonal.Axial.round(inter_x, inter_y)
|
||||
Hexagonal.Axial.new(new_i, new_j) & coords
|
||||
coords
|
||||
|
@ -1,5 +1,5 @@
|
||||
Int.div(n: Int, d: Int): Int
|
||||
{neg, d_nat} = Int.to_nat_signed(d)
|
||||
let {neg, d_nat} = Int.to_nat_signed(d)
|
||||
if neg then
|
||||
Int.neg(Int.div_nat(n, d_nat))
|
||||
else
|
||||
|
Loading…
Reference in New Issue
Block a user