rename app.width to app.diameter
This commit is contained in:
@@ -16,7 +16,7 @@ type appOption func(a *app)
|
|||||||
|
|
||||||
type app struct {
|
type app struct {
|
||||||
strokes []stroke
|
strokes []stroke
|
||||||
width float32
|
diameter float32
|
||||||
canvas *ebiten.Image
|
canvas *ebiten.Image
|
||||||
sizeAnchorPos Vec2
|
sizeAnchorPos Vec2
|
||||||
historyIndex uintptr
|
historyIndex uintptr
|
||||||
@@ -33,7 +33,7 @@ func (a *app) Draw(screen *ebiten.Image) {
|
|||||||
screen,
|
screen,
|
||||||
cursor.x,
|
cursor.x,
|
||||||
cursor.y,
|
cursor.y,
|
||||||
a.width/2,
|
a.diameter/2,
|
||||||
3,
|
3,
|
||||||
color.White,
|
color.White,
|
||||||
true,
|
true,
|
||||||
@@ -42,7 +42,7 @@ func (a *app) Draw(screen *ebiten.Image) {
|
|||||||
screen,
|
screen,
|
||||||
cursor.x,
|
cursor.x,
|
||||||
cursor.y,
|
cursor.y,
|
||||||
a.width/2,
|
a.diameter/2,
|
||||||
1,
|
1,
|
||||||
color.Black,
|
color.Black,
|
||||||
true,
|
true,
|
||||||
@@ -71,7 +71,7 @@ func (a *app) Update() error {
|
|||||||
}
|
}
|
||||||
a.strokes = append(a.strokes, stroke{
|
a.strokes = append(a.strokes, stroke{
|
||||||
points: []Vec2{},
|
points: []Vec2{},
|
||||||
width: a.width,
|
width: a.diameter,
|
||||||
color: clr,
|
color: clr,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@@ -100,7 +100,7 @@ func (a *app) Update() error {
|
|||||||
length := float32(math.Sqrt(
|
length := float32(math.Sqrt(
|
||||||
float64(reltivePos.x) * float64(reltivePos.x) + float64(reltivePos.y) * float64(reltivePos.y),
|
float64(reltivePos.x) * float64(reltivePos.x) + float64(reltivePos.y) * float64(reltivePos.y),
|
||||||
))
|
))
|
||||||
a.width = length * 2.0
|
a.diameter = length * 2.0
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
@@ -120,7 +120,7 @@ func main() {
|
|||||||
ebiten.SetWindowResizingMode(ebiten.WindowResizingModeEnabled)
|
ebiten.SetWindowResizingMode(ebiten.WindowResizingModeEnabled)
|
||||||
ebiten.CursorPosition()
|
ebiten.CursorPosition()
|
||||||
whiteboardApp := newApp( func(a *app) {
|
whiteboardApp := newApp( func(a *app) {
|
||||||
a.width = 10
|
a.diameter = 10
|
||||||
a.canvas = ebiten.NewImage(width, height)
|
a.canvas = ebiten.NewImage(width, height)
|
||||||
a.canvas.Fill(color.White)
|
a.canvas.Fill(color.White)
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user