Primitive input support for floats
This commit is contained in:
parent
2d58afe627
commit
8c3ce9a937
4
draw.go
4
draw.go
@ -72,7 +72,7 @@ func drawNumberReadouts () {
|
||||
indicatorY := height - 12
|
||||
application.SetDot(0, indicatorY)
|
||||
fmt.Fprint(application, "sel fin | int float")
|
||||
fillColor(0, indicatorY, 10, 1, stone.ColorDim)
|
||||
fillColor(0, indicatorY, 19, 1, stone.ColorDim)
|
||||
|
||||
if showEndResult {
|
||||
fillColor(4, indicatorY, 3, 1, stone.ColorBlue)
|
||||
@ -83,7 +83,7 @@ func drawNumberReadouts () {
|
||||
clear(0, height - 10, 25, 10)
|
||||
|
||||
if showFloat {
|
||||
fillColor(14, indicatorY, 3, 1, stone.ColorBlue)
|
||||
fillColor(14, indicatorY, 5, 1, stone.ColorBlue)
|
||||
drawNumberReadoutsFloat()
|
||||
} else {
|
||||
fillColor(10, indicatorY, 3, 1, stone.ColorBlue)
|
||||
|
11
main.go
11
main.go
@ -71,7 +71,7 @@ func onPress (button stone.Button, modifiers stone.Modifiers) {
|
||||
application.Draw()
|
||||
|
||||
case '[':
|
||||
insertGeneric(&Operation { }, modifiers.Alt)
|
||||
insertGeneric(&Operation { floating: showFloat }, modifiers.Alt)
|
||||
redraw()
|
||||
application.Draw()
|
||||
|
||||
@ -228,10 +228,15 @@ func onPress (button stone.Button, modifiers stone.Modifiers) {
|
||||
redraw()
|
||||
application.Draw()
|
||||
|
||||
case stone.KeyTab:
|
||||
case 'R':
|
||||
showEndResult = !showEndResult
|
||||
redraw()
|
||||
application.Draw()
|
||||
|
||||
case 'F':
|
||||
showFloat = !showFloat
|
||||
redraw()
|
||||
application.Draw()
|
||||
}
|
||||
}
|
||||
|
||||
@ -262,7 +267,7 @@ func insertOperation (symbol rune, swap bool) {
|
||||
}
|
||||
}
|
||||
|
||||
newExpression := &Operation { opcode: opcode }
|
||||
newExpression := &Operation { opcode: opcode, floating: showFloat }
|
||||
insertGeneric(newExpression, swap)
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user