diff --git a/dev-assets/doodads/bird/bird.js b/dev-assets/doodads/bird/bird.js index 5d94ebe..c47b628 100644 --- a/dev-assets/doodads/bird/bird.js +++ b/dev-assets/doodads/bird/bird.js @@ -47,10 +47,17 @@ function main() { } sampleTick++; + // If we are not flying at our original altitude, correct for that. + var curV = Self.Position(); + var Vy = 0.0; + if (curV.Y != altitude) { + Vy = curV.Y < altitude ? 1 : -1; + } + // TODO: Vector() requires floats, pain in the butt for JS, // the JS API should be friendlier and custom... var Vx = parseFloat(speed * (direction === "left" ? -1 : 1)); - Self.SetVelocity(Vector(Vx, 0.0)); + Self.SetVelocity(Vector(Vx, Vy)); // If we changed directions, stop animating now so we can // turn around quickly without moonwalking. diff --git a/pkg/doodle.go b/pkg/doodle.go index f395ea5..eb3475d 100644 --- a/pkg/doodle.go +++ b/pkg/doodle.go @@ -243,6 +243,7 @@ func (d *Doodle) MakeSettingsWindow(supervisor *ui.Supervisor) *ui.Window { EnableFeatures: &usercfg.Current.EnableFeatures, CrosshairSize: &usercfg.Current.CrosshairSize, CrosshairColor: &usercfg.Current.CrosshairColor, + HideTouchHints: &usercfg.Current.HideTouchHints, } return windows.MakeSettingsWindow(d.width, d.height, cfg) } diff --git a/pkg/editor_ui_palette.go b/pkg/editor_ui_palette.go index ab8a076..4c1c76d 100644 --- a/pkg/editor_ui_palette.go +++ b/pkg/editor_ui_palette.go @@ -44,10 +44,11 @@ func (u *EditorUI) setupPaletteFrame(window *ui.Window) *ui.Frame { packConfig = ui.Pack{ Side: packAlign, Fill: true, - PadY: 4, + PadY: 1, } tooltipEdge = ui.Left buttonSize = 32 + twoColumn = true // To place in two columns, halves buttonSize to /2 ) if usercfg.Current.HorizontalToolbars { packAlign = ui.W @@ -58,6 +59,7 @@ func (u *EditorUI) setupPaletteFrame(window *ui.Window) *ui.Frame { } tooltipEdge = ui.Top buttonSize = 24 + twoColumn = false } // Handler function for the radio buttons being clicked. @@ -74,16 +76,37 @@ func (u *EditorUI) setupPaletteFrame(window *ui.Window) *ui.Frame { } // Draw the radio buttons for the palette. + var row *ui.Frame if u.Canvas != nil && u.Canvas.Palette != nil { - for _, swatch := range u.Canvas.Palette.Swatches { - swFrame := ui.NewFrame(fmt.Sprintf("Swatch(%s) Button Frame", swatch.Name)) - swFrame.Configure(ui.Config{ - Width: buttonSize, - Height: buttonSize, + for i, swatch := range u.Canvas.Palette.Swatches { + swatch := swatch + var width = buttonSize + + // Drawing buttons in two-column mode? (default right-side palette layout) + if twoColumn { + width = buttonSize / 2 + if row == nil || i%2 == 0 { + row = ui.NewFrame(fmt.Sprintf("Swatch(%s) Button Frame", swatch.Name)) + frame.Pack(row, packConfig) + } + } else { + row = ui.NewFrame(fmt.Sprintf("Swatch(%s) Button Frame", swatch.Name)) + frame.Pack(row, packConfig) + } + + colorbox := ui.NewFrame(swatch.Name) + colorbox.Configure(ui.Config{ + Width: width, + Height: width, Background: swatch.Color, }) - btn := ui.NewRadioButton("palette", &u.selectedSwatch, swatch.Name, swFrame) + btn := ui.NewRadioButton("palette", &u.selectedSwatch, swatch.Name, colorbox) + btn.Configure(ui.Config{ + BorderColor: swatch.Color.Darken(20), + BorderSize: 2, + OutlineSize: 0, + }) btn.Handle(ui.Click, onClick) u.Supervisor.Add(btn) @@ -95,7 +118,10 @@ func (u *EditorUI) setupPaletteFrame(window *ui.Window) *ui.Frame { btn.Compute(u.d.Engine) - frame.Pack(btn, packConfig) + row.Pack(btn, ui.Pack{ + Side: ui.W, + PadX: 1, + }) } } diff --git a/pkg/play_scene_touch.go b/pkg/play_scene_touch.go index 93a5248..c3c4cad 100644 --- a/pkg/play_scene_touch.go +++ b/pkg/play_scene_touch.go @@ -5,6 +5,7 @@ import ( "git.kirsle.net/apps/doodle/pkg/balance" "git.kirsle.net/apps/doodle/pkg/log" + "git.kirsle.net/apps/doodle/pkg/usercfg" "git.kirsle.net/go/render" "git.kirsle.net/go/render/event" "git.kirsle.net/go/ui" @@ -111,6 +112,10 @@ func (s *PlayScene) LoopTouchable(ev *event.State) { // DrawTouchable draws any UI elements if needed for the touch UI. func (s *PlayScene) DrawTouchable() { + if usercfg.Current.HideTouchHints { + return + } + var ( middle = s.touchGetMiddleBox() background = render.RGBA(200, 200, 200, uint8(s.idleHelpAlpha)) diff --git a/pkg/uix/canvas.go b/pkg/uix/canvas.go index fc8eb43..11f1f97 100644 --- a/pkg/uix/canvas.go +++ b/pkg/uix/canvas.go @@ -222,9 +222,6 @@ func (w *Canvas) Loop(ev *event.State) error { } _ = w.loopConstrainScroll() - // Current time of this loop so we can advance animations. - // now := time.Now() - // Remove any actors that were destroyed the previous tick. var newActors []*Actor for _, a := range w.actors { diff --git a/pkg/usercfg/usercfg.go b/pkg/usercfg/usercfg.go index 041aa76..583432a 100644 --- a/pkg/usercfg/usercfg.go +++ b/pkg/usercfg/usercfg.go @@ -33,6 +33,7 @@ type Settings struct { EnableFeatures bool `json:",omitempty"` CrosshairSize int `json:",omitempty"` CrosshairColor render.Color + HideTouchHints bool `json:"omitempty"` // Secret boolprops from balance/boolprops.go ShowHiddenDoodads bool `json:",omitempty"` diff --git a/pkg/windows/settings.go b/pkg/windows/settings.go index a222fb0..948d5c4 100644 --- a/pkg/windows/settings.go +++ b/pkg/windows/settings.go @@ -28,6 +28,7 @@ type Settings struct { EnableFeatures *bool CrosshairSize *int CrosshairColor *render.Color + HideTouchHints *bool // Configuration options. SceneName string // name of scene which called this window @@ -135,6 +136,12 @@ func (c Settings) makeOptionsTab(tabFrame *ui.TabFrame, Width, Height int) *ui.F PadX: 4, name: "toolbars", }, + { + Boolean: c.HideTouchHints, + Text: "Hide touchscreen control hints during Play Mode", + PadX: 4, + name: "toolbars", + }, { Integer: c.CrosshairSize, Text: "Editor: Crosshair size (0 to disable):",