diff --git a/cmd/tins2021/app.go b/cmd/tins2021/app.go index befba3b..05b0e7a 100644 --- a/cmd/tins2021/app.go +++ b/cmd/tins2021/app.go @@ -63,8 +63,8 @@ func (a *app) Init(ctx ui.Context) error { virtual.RegisterKey("confirm", ui.KeyEnter, tins2021.MustCreateNamedTextureImage(textures, "return-key", drawReturnKey())) virtual.RegisterKey("arrow-top-left", ui.KeyUp, tins2021.MustCreateNamedTextureImage(textures, "arrow-top-left-key", drawArrowKey(.75*geom.Pi))) virtual.RegisterKey("arrow-top-right", ui.KeyRight, tins2021.MustCreateNamedTextureImage(textures, "arrow-top-right-key", drawArrowKey(.25*geom.Pi))) - virtual.RegisterKey("arrow-bottom-left", ui.KeyDown, tins2021.MustCreateNamedTextureImage(textures, "arrow-bottom-left-key", drawArrowKey(1.25*geom.Pi))) - virtual.RegisterKey("arrow-bottom-right", ui.KeyLeft, tins2021.MustCreateNamedTextureImage(textures, "arrow-bottom-right-key", drawArrowKey(1.75*geom.Pi))) + virtual.RegisterKey("arrow-bottom-left", ui.KeyLeft, tins2021.MustCreateNamedTextureImage(textures, "arrow-bottom-left-key", drawArrowKey(1.25*geom.Pi))) + virtual.RegisterKey("arrow-bottom-right", ui.KeyDown, tins2021.MustCreateNamedTextureImage(textures, "arrow-bottom-right-key", drawArrowKey(1.75*geom.Pi))) virtual.RegisterKey("cancel", ui.KeyEscape, tins2021.MustCreateNamedTextureImage(textures, "arrow-left-key", drawArrowKey(geom.Pi))) virtual.Enabled = a.settings.Controls.Virtual diff --git a/cmd/tins2021/appcontext.go b/cmd/tins2021/appcontext.go index 684d948..9b8da33 100644 --- a/cmd/tins2021/appcontext.go +++ b/cmd/tins2021/appcontext.go @@ -197,8 +197,8 @@ func (app *appContext) SetVirtualKeys(cancel, confirm, controls bool) { topRight = append(topRight, "confirm") } if controls { - bottomRight = append(bottomRight, "arrow-top-right", "arrow-bottom-right") - bottomLeft = append(bottomLeft, "arrow-top-left", "arrow-bottom-left") + bottomRight = append(bottomRight, "arrow-bottom-right", "arrow-top-right") + bottomLeft = append(bottomLeft, "arrow-bottom-left", "arrow-top-left") } app.Virtual.SetControls(topLeft, topRight, bottomRight, bottomLeft) } diff --git a/cmd/tins2021/levelcontroller.go b/cmd/tins2021/levelcontroller.go index 39dccf3..984b1d0 100644 --- a/cmd/tins2021/levelcontroller.go +++ b/cmd/tins2021/levelcontroller.go @@ -80,6 +80,13 @@ func newLevelControl(app *appContext, ctx ui.Context, level *tins2021.Level) *le } } + if app.Virtual.Enabled { + control.Controls[ui.KeyUp] = tins2021.DirectionUpLeft + control.Controls[ui.KeyLeft] = tins2021.DirectionDownLeft + control.Controls[ui.KeyDown] = tins2021.DirectionDownRight + control.Controls[ui.KeyRight] = tins2021.DirectionUpRight + } + control.Play(level) return control diff --git a/cmd/tins2021/virtualcontrols.go b/cmd/tins2021/virtualcontrols.go index 04b4c9e..1f52c0a 100644 --- a/cmd/tins2021/virtualcontrols.go +++ b/cmd/tins2021/virtualcontrols.go @@ -14,6 +14,7 @@ import ( ) func drawArrowKey(a float64) image.Image { + a = -a const keyHeight_5 = .5 * tins2021.TextureSize const keyWidth_5 = .5 * tins2021.TextureSize