Press tab to view the end result in the readout instead!
This commit is contained in:
		
							parent
							
								
									fec0f3372e
								
							
						
					
					
						commit
						a47445f494
					
				
							
								
								
									
										24
									
								
								draw.go
									
									
									
									
									
								
							
							
						
						
									
										24
									
								
								draw.go
									
									
									
									
									
								
							| @ -11,6 +11,13 @@ func clear (x, y, width, height int) { | ||||
| 	}} | ||||
| } | ||||
| 
 | ||||
| func fillColor (x, y, width, height int, color stone.Color) { | ||||
| 	for yy := 0; yy < height; yy ++ { | ||||
| 	for xx := 0; xx < width;  xx ++ { | ||||
| 		application.SetColor(xx + x, yy + y, color) | ||||
| 	}} | ||||
| } | ||||
| 
 | ||||
| func redraw () { | ||||
| 	width, _ := application.Size() | ||||
| 	showLeftColumn = width > 44 | ||||
| @ -61,13 +68,30 @@ func drawInput () { | ||||
| func drawNumberReadouts () { | ||||
| 	_, height := application.Size() | ||||
| 
 | ||||
| 	indicatorY := height - 12 | ||||
| 	application.SetDot(0, indicatorY) | ||||
| 	fmt.Fprint(application, "sel fin") | ||||
| 	fillColor(0, indicatorY, 10, 1, stone.ColorDim) | ||||
| 
 | ||||
| 	if showEndResult { | ||||
| 		fillColor(4, indicatorY, 3, 1, stone.ColorBlue) | ||||
| 	} else { | ||||
| 		fillColor(0, indicatorY, 3, 1, stone.ColorBlue) | ||||
| 	} | ||||
| 	 | ||||
| 	clear(0, height - 10, 25, 10) | ||||
| 		 | ||||
| 	var number int64 | ||||
| 	var err error | ||||
| 	if showEndResult { | ||||
| 		if expressionRoot != nil { | ||||
| 			number, err = expressionRoot.Solution() | ||||
| 		} | ||||
| 	} else { | ||||
| 		if selectedExpression != nil { | ||||
| 			number, err = selectedExpression.Solution() | ||||
| 		} | ||||
| 	} | ||||
| 
 | ||||
| 	if err != nil { | ||||
| 		application.SetDot((25 - len(err.Error())) / 2, height - 6) | ||||
|  | ||||
							
								
								
									
										8
									
								
								main.go
									
									
									
									
									
								
							
							
						
						
									
										8
									
								
								main.go
									
									
									
									
									
								
							| @ -15,10 +15,11 @@ var application = &stone.Application { } | ||||
| var expressionRoot Expression | ||||
| var inputBuffer stone.DamageBuffer | ||||
| var showLeftColumn bool | ||||
| var showEndResult  bool | ||||
| 
 | ||||
| func main () { | ||||
| 	application.SetTitle("MathPan") | ||||
| 	application.SetSize(64, 10) | ||||
| 	application.SetSize(64, 12) | ||||
| 
 | ||||
| 	icon, _, err := image.Decode(bytes.NewReader(iconBytes)) | ||||
| 	if err != nil { panic(err) } | ||||
| @ -80,6 +81,11 @@ func onPress (button stone.Button, modifiers stone.Modifiers) { | ||||
| 		redraw() | ||||
| 		application.Draw() | ||||
| 
 | ||||
| 	case stone.KeyTab: | ||||
| 		showEndResult = !showEndResult | ||||
| 		redraw() | ||||
| 		application.Draw() | ||||
| 
 | ||||
| 	case stone.KeyDelete: | ||||
| 		if selectedExpression == nil { break } | ||||
| 		parent := selectedExpression.Parent() | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user