From 38920879325ea962941a8c282c6988148f2bb92e Mon Sep 17 00:00:00 2001 From: Noah Petherbridge Date: Sun, 3 Jan 2021 15:19:21 -0800 Subject: [PATCH] Doodads: Use Key and Working Warp Doors * The "Use Key" (Q or Spacebar) now activates the Warp Door instead of a collision event doing so. * Warp Doors are now functional: the player opens a door, disappears, the door closes; player is teleported to the linked door which opens, appears the player and closes. * If the player exits thru a Blue or Orange door which is disabled (dotted outline), the door still opens and drops the player off but returns to a Disabled state, acting as a one-way door. * Clean up several debug log lines from Doodle and doodad scripts. --- dev-assets/doodads/azulian/azulian-red.js | 2 - dev-assets/doodads/bird/bird.js | 2 - dev-assets/doodads/buttons/button.js | 2 - dev-assets/doodads/buttons/sticky.js | 2 - dev-assets/doodads/doors/electric-door.js | 4 -- dev-assets/doodads/objects/exit-flag.js | 1 - dev-assets/doodads/on-off/state-button.js | 1 - dev-assets/doodads/switches/switch.js | 1 - dev-assets/doodads/trapdoors/down.js | 2 - dev-assets/doodads/trapdoors/trapdoor.js | 1 - dev-assets/doodads/warp-door/warp-door.js | 61 ++++++++++++++++++----- pkg/editor_ui.go | 2 - pkg/keybind/keybind.go | 30 +++++++++++ pkg/level/fmt_readwrite.go | 2 +- pkg/play_scene.go | 26 +++++++--- pkg/scripting/events.go | 11 ++++ pkg/scripting/scripting.go | 6 +-- pkg/uix/actor.go | 25 +++++++++- pkg/uix/actor_collision.go | 10 ++++ pkg/uix/actor_events.go | 5 ++ pkg/uix/canvas_actors.go | 21 +------- pkg/uix/canvas_link_tool.go | 32 ++++++++++++ pkg/uix/scripting.go | 35 +++++++++++++ pkg/windows/layers_window.go | 6 --- pkg/windows/open_level_editor.go | 3 -- pkg/windows/palette_editor.go | 2 - 26 files changed, 218 insertions(+), 77 deletions(-) create mode 100644 pkg/uix/scripting.go diff --git a/dev-assets/doodads/azulian/azulian-red.js b/dev-assets/doodads/azulian/azulian-red.js index 87d7d4c..e3a4ea0 100644 --- a/dev-assets/doodads/azulian/azulian-red.js +++ b/dev-assets/doodads/azulian/azulian-red.js @@ -1,6 +1,4 @@ function main() { - console.log("Azulian '%s' initialized!", Self.Title); - var playerSpeed = 4; var gravity = 4; var Vx = Vy = 0; diff --git a/dev-assets/doodads/bird/bird.js b/dev-assets/doodads/bird/bird.js index ca8db3e..d7bb2a7 100644 --- a/dev-assets/doodads/bird/bird.js +++ b/dev-assets/doodads/bird/bird.js @@ -4,8 +4,6 @@ function main() { var Vx = Vy = 0; var altitude = Self.Position().Y; // original height in the level - console.log("Bird altitude is %d", altitude); - var direction = "left"; var states = { flying: 0, diff --git a/dev-assets/doodads/buttons/button.js b/dev-assets/doodads/buttons/button.js index c9c8237..3745467 100644 --- a/dev-assets/doodads/buttons/button.js +++ b/dev-assets/doodads/buttons/button.js @@ -1,6 +1,4 @@ function main() { - console.log("%s initialized!", Self.Title); - var timer = 0; var pressed = false; diff --git a/dev-assets/doodads/buttons/sticky.js b/dev-assets/doodads/buttons/sticky.js index 9dac758..0958454 100644 --- a/dev-assets/doodads/buttons/sticky.js +++ b/dev-assets/doodads/buttons/sticky.js @@ -1,6 +1,4 @@ function main() { - console.log("%s initialized!", Self.Title); - var pressed = false; // When a sticky button receives power, it pops back up. diff --git a/dev-assets/doodads/doors/electric-door.js b/dev-assets/doodads/doors/electric-door.js index 8bc9b0e..646cf4f 100644 --- a/dev-assets/doodads/doors/electric-door.js +++ b/dev-assets/doodads/doors/electric-door.js @@ -1,6 +1,4 @@ function main() { - console.log("%s initialized!", Self.Title); - Self.AddAnimation("open", 100, [0, 1, 2, 3]); Self.AddAnimation("close", 100, [3, 2, 1, 0]); var animating = false; @@ -9,8 +7,6 @@ function main() { Self.SetHitbox(0, 0, 34, 76); Message.Subscribe("power", function(powered) { - console.log("%s got power=%+v", Self.Title, powered); - if (powered) { if (animating || opened) { return; diff --git a/dev-assets/doodads/objects/exit-flag.js b/dev-assets/doodads/objects/exit-flag.js index 08680a9..fe530fe 100644 --- a/dev-assets/doodads/objects/exit-flag.js +++ b/dev-assets/doodads/objects/exit-flag.js @@ -1,6 +1,5 @@ // Exit Flag. function main() { - console.log("%s initialized!", Self.Title); Self.SetHitbox(22+16, 16, 75-16, 86); Events.OnCollide(function(e) { diff --git a/dev-assets/doodads/on-off/state-button.js b/dev-assets/doodads/on-off/state-button.js index c5e7bd7..f0b02a6 100644 --- a/dev-assets/doodads/on-off/state-button.js +++ b/dev-assets/doodads/on-off/state-button.js @@ -4,7 +4,6 @@ var state = false; function main() { - console.log("%s ID '%s' initialized!", Self.Title, Self.ID()); Self.SetHitbox(0, 0, 42, 42); // When the button is activated, don't keep toggling state until we're not diff --git a/dev-assets/doodads/switches/switch.js b/dev-assets/doodads/switches/switch.js index c62689a..f51f9cc 100644 --- a/dev-assets/doodads/switches/switch.js +++ b/dev-assets/doodads/switches/switch.js @@ -1,5 +1,4 @@ function main() { - console.log("%s initialized!", Self.Title); // Switch has two frames: // 0: Off diff --git a/dev-assets/doodads/trapdoors/down.js b/dev-assets/doodads/trapdoors/down.js index cc45c41..3ea5fba 100644 --- a/dev-assets/doodads/trapdoors/down.js +++ b/dev-assets/doodads/trapdoors/down.js @@ -1,6 +1,4 @@ function main() { - console.log("%s initialized!", Self.Title); - var timer = 0; Self.SetHitbox(0, 0, 72, 6); diff --git a/dev-assets/doodads/trapdoors/trapdoor.js b/dev-assets/doodads/trapdoors/trapdoor.js index fb23362..5ad50c2 100644 --- a/dev-assets/doodads/trapdoors/trapdoor.js +++ b/dev-assets/doodads/trapdoors/trapdoor.js @@ -1,7 +1,6 @@ function main() { // What direction is the trapdoor facing? var direction = Self.GetTag("direction"); - console.log("Trapdoor(%s) initialized", direction); var timer = 0; diff --git a/dev-assets/doodads/warp-door/warp-door.js b/dev-assets/doodads/warp-door/warp-door.js index 2dc73ab..0cb6e1a 100644 --- a/dev-assets/doodads/warp-door/warp-door.js +++ b/dev-assets/doodads/warp-door/warp-door.js @@ -1,7 +1,5 @@ // Warp Doors function main() { - console.log("Warp Door %s Initialized", Self.Title); - Self.SetHitbox(0, 0, 34, 76); // Are we a blue or orange door? Regular warp door will be 'none' @@ -31,12 +29,18 @@ function main() { spriteDefault = "door-1"; } - console.log("Warp %s: default=%s disabled=%+v color=%s isState=%+v state=%+v", Self.Title, spriteDefault, spriteDisabled, color, isStateDoor, state); + // Find our linked Warp Door. + var links = Self.GetLinks() + var linkedDoor = null; + for (var i = 0; i < links.length; i++) { + if (links[i].Title.indexOf("Warp Door") > -1) { + linkedDoor = links[i]; + } + } // Subscribe to the global state-change if we are a state door. if (isStateDoor) { Message.Subscribe("broadcast:state-change", function(newState) { - console.log("Warp %s: received state to %+v", Self.Title, newState); state = color === 'blue' ? !newState : newState; // Activate or deactivate the door. @@ -44,38 +48,69 @@ function main() { }); } - // TODO: respond to a "Use" button instead of a Collide to open the door. - Events.OnCollide(function(e) { - if (!e.Settled) { + // The player Uses the door. + var flashedCooldown = false; // "Locked Door" flashed message. + Events.OnUse(function(e) { + if (animating) { return; } - if (animating || collide) { + // Doors without linked exits are not usable. + if (linkedDoor === null) { + if (!flashedCooldown) { + Flash("This door is locked."); + flashedCooldown = true; + setTimeout(function() { + flashedCooldown = false; + }, 1000); + } return; } // Only players can use doors for now. - if (e.Actor.IsPlayer() && e.InHitbox) { + if (e.Actor.IsPlayer()) { if (isStateDoor && !state) { // The state door is inactive (dotted outline). return; } + // Freeze the player. + e.Actor.Freeze() + // Play the open and close animation. animating = true; - collide = true; Self.PlayAnimation("open", function() { e.Actor.Hide() Self.PlayAnimation("close", function() { Self.ShowLayerNamed(isStateDoor && !state ? spriteDisabled : spriteDefault); - e.Actor.Show() animating = false; + + // Teleport the player to the linked door. Inform the target + // door of the arrival of the player so it doesn't trigger + // to send the player back here again on a loop. + if (linkedDoor !== null) { + Message.Publish("warp-door:incoming", e.Actor); + e.Actor.MoveTo(linkedDoor.Position()); + } }); }); } }); - Events.OnLeave(function(e) { - collide = false; + // Respond to incoming warp events. + Message.Subscribe("warp-door:incoming", function(player) { + animating = true; + player.Unfreeze(); + Self.PlayAnimation("open", function() { + player.Show(); + Self.PlayAnimation("close", function() { + animating = false; + + // If the receiving door was a State Door, fix its state. + if (isStateDoor) { + Self.ShowLayerNamed(state ? spriteDefault : spriteDisabled); + } + }); + }); }); } diff --git a/pkg/editor_ui.go b/pkg/editor_ui.go index 1640cd5..0f8ef0e 100644 --- a/pkg/editor_ui.go +++ b/pkg/editor_ui.go @@ -109,7 +109,6 @@ func NewEditorUI(d *Doodle, s *EditorScene) *EditorUI { // Preload pop-up windows before they're needed. u.SetupPopups(d) - log.Error("menu size: %s", u.MenuBar.Rect()) u.screen.Pack(u.MenuBar, ui.Pack{ Side: ui.N, FillX: true, @@ -676,7 +675,6 @@ func (u *EditorUI) SetupMenuBar(d *Doodle) *ui.MenuBar { menu.Supervise(u.Supervisor) menu.Compute(d.Engine) - log.Error("Setup MenuBar: %s\n", menu.Size()) return menu } diff --git a/pkg/keybind/keybind.go b/pkg/keybind/keybind.go index 2feda7c..6d90bcb 100644 --- a/pkg/keybind/keybind.go +++ b/pkg/keybind/keybind.go @@ -106,3 +106,33 @@ func EraserTool(ev *event.State) bool { func DoodadDropper(ev *event.State) bool { return ev.KeyDown("d") } + +// Shift key. +func Shift(ev *event.State) bool { + return ev.Shift +} + +// Left arrow. +func Left(ev *event.State) bool { + return ev.Left || ev.KeyDown("a") +} + +// Right arrow. +func Right(ev *event.State) bool { + return ev.Right || ev.KeyDown("d") +} + +// Up arrow. +func Up(ev *event.State) bool { + return ev.Up || ev.KeyDown("w") +} + +// Down arrow. +func Down(ev *event.State) bool { + return ev.Down || ev.KeyDown("s") +} + +// "Use" button. +func Use(ev *event.State) bool { + return ev.Space || ev.KeyDown("q") +} diff --git a/pkg/level/fmt_readwrite.go b/pkg/level/fmt_readwrite.go index e2bdbc6..52eb599 100644 --- a/pkg/level/fmt_readwrite.go +++ b/pkg/level/fmt_readwrite.go @@ -57,7 +57,7 @@ func LoadFile(filename string) (*Level, error) { // Do we have the file in bindata? if jsonData, err := bindata.Asset(filename); err == nil { - log.Info("loaded from embedded bindata") + log.Debug("Level %s: loaded from embedded bindata", filename) return FromJSON(filename, jsonData) } diff --git a/pkg/play_scene.go b/pkg/play_scene.go index 18e150f..aca3dd1 100644 --- a/pkg/play_scene.go +++ b/pkg/play_scene.go @@ -471,30 +471,30 @@ func (s *PlayScene) movePlayer(ev *event.State) { velocity.Y = 0 // Shift to slow your roll to 1 pixel per tick. - if ev.Shift { + if keybind.Shift(ev) { playerSpeed = 1 } - if ev.Left { + if keybind.Left(ev) { velocity.X = -playerSpeed - } else if ev.Right { + } else if keybind.Right(ev) { velocity.X = playerSpeed } - if ev.Up { + if keybind.Up(ev) { velocity.Y = -playerSpeed - } else if ev.Down { + } else if keybind.Down(ev) { velocity.Y = playerSpeed } } else { // Moving left or right. - if ev.Left { + if keybind.Left(ev) { direction = -1 - } else if ev.Right { + } else if keybind.Right(ev) { direction = 1 } // Up button to signal they want to jump. - if ev.Up && (s.Player.Grounded() || s.playerJumpCounter >= 0) { + if keybind.Up(ev) && (s.Player.Grounded() || s.playerJumpCounter >= 0) { jumping = true if s.Player.Grounded() { @@ -533,8 +533,18 @@ func (s *PlayScene) movePlayer(ev *event.State) { } } + // Move the player unless frozen. + // TODO: if Y=0 then gravity fails, but not doing this allows the + // player to jump while frozen. Not a HUGE deal right now as only Warp Doors + // freeze the player currently but do address this later. + if s.Player.IsFrozen() { + velocity.X = 0 + } s.Player.SetVelocity(velocity) + // If the "Use" key is pressed, set an actor flag on the player. + s.Player.SetUsing(keybind.Use(ev)) + s.scripting.To(s.Player.ID()).Events.RunKeypress(ev) } diff --git a/pkg/scripting/events.go b/pkg/scripting/events.go index 04eaf9f..d132add 100644 --- a/pkg/scripting/events.go +++ b/pkg/scripting/events.go @@ -13,6 +13,7 @@ const ( CollideEvent = "OnCollide" // another doodad collides with us EnterEvent = "OnEnter" // a doodad is fully inside us LeaveEvent = "OnLeave" // a doodad no longer collides with us + UseEvent = "OnUse" // player pressed the Use key while touching us // Controllable (player character) doodad events KeypressEvent = "OnKeypress" // i.e. arrow keys @@ -46,6 +47,16 @@ func (e *Events) RunCollide(v interface{}) error { return e.run(CollideEvent, v) } +// OnUse fires when another actor collides with yours. +func (e *Events) OnUse(call otto.FunctionCall) otto.Value { + return e.register(UseEvent, call.Argument(0)) +} + +// RunUse invokes the OnUse handler function. +func (e *Events) RunUse(v interface{}) error { + return e.run(UseEvent, v) +} + // OnLeave fires when another actor stops colliding with yours. func (e *Events) OnLeave(call otto.FunctionCall) otto.Value { return e.register(LeaveEvent, call.Argument(0)) diff --git a/pkg/scripting/scripting.go b/pkg/scripting/scripting.go index 388f9ec..ae019d8 100644 --- a/pkg/scripting/scripting.go +++ b/pkg/scripting/scripting.go @@ -93,9 +93,9 @@ func (s *Supervisor) To(name string) *VM { // TODO: put this log back in, but add PLAYER script so it doesn't spam // the console for missing PLAYER. - // log.Error("scripting.Supervisor.To(%s): no such VM but returning blank VM", - // name, - // ) + log.Error("scripting.Supervisor.To(%s): no such VM but returning blank VM", + name, + ) return NewVM(name) } diff --git a/pkg/uix/actor.go b/pkg/uix/actor.go index 72ef702..06a96b4 100644 --- a/pkg/uix/actor.go +++ b/pkg/uix/actor.go @@ -25,19 +25,20 @@ import ( // as defined in the map: its spawn coordinate and configuration. // - A uix.Canvas that can present the actor's graphics to the screen. type Actor struct { - id string Drawing *doodads.Drawing Actor *level.Actor Canvas *Canvas activeLayer int // active drawing frame for display flagDestroy bool // flag the actor for destruction + flagUsing bool // flag that the (player) has pressed the Use key. // Actor runtime variables. hasGravity bool isMobile bool // Mobile character, such as the player or an enemy noclip bool // Disable collision detection hidden bool // invisible, via Hide() and Show() + frozen bool // Frozen, via Freeze() and Unfreeze() hitbox render.Rect inventory map[string]int // item inventory. doodad name -> quantity, 0 for key item. data map[string]string // arbitrary key/value store. DEPRECATED ?? @@ -174,6 +175,28 @@ func (a *Actor) Show() { a.hidden = false } +// Freeze an actor. For the player character, this means arrow key inputs +// will stop moving the actor. +func (a *Actor) Freeze() { + a.frozen = true +} + +// Unfreeze an actor. +func (a *Actor) Unfreeze() { + a.frozen = false +} + +// IsFrozen returns true if the actor is frozen. +func (a *Actor) IsFrozen() bool { + return a.frozen +} + +// SetUsing enables the "Use Key" flag, mainly for the player character to activate +// certain doodads in the level. +func (a *Actor) SetUsing(v bool) { + a.flagUsing = v +} + // SetNoclip sets the noclip setting for an actor. If true, the actor can // clip through level geometry. func (a *Actor) SetNoclip(v bool) { diff --git a/pkg/uix/actor_collision.go b/pkg/uix/actor_collision.go index ed28a65..3a296ea 100644 --- a/pkg/uix/actor_collision.go +++ b/pkg/uix/actor_collision.go @@ -276,6 +276,16 @@ func (w *Canvas) loopActorCollision() error { }); err != nil && err != scripting.ErrReturnFalse { log.Error("VM(%s).RunCollide: %s", a.ID(), err.Error()) } + + // If the (player) is pressing the Use key, call the colliding + // actor's OnUse event. + if b.flagUsing { + if err := w.scripting.To(a.ID()).Events.RunUse(&UseEvent{ + Actor: b, + }); err != nil { + log.Error("VM(%s).RunUse: %s", a.ID(), err.Error()) + } + } } } } diff --git a/pkg/uix/actor_events.go b/pkg/uix/actor_events.go index c1b9f0f..e34dc8e 100644 --- a/pkg/uix/actor_events.go +++ b/pkg/uix/actor_events.go @@ -9,3 +9,8 @@ type CollideEvent struct { InHitbox bool // If the two elected hitboxes are overlapping Settled bool // Movement phase finished, actor script can fire actions } + +// UseEvent holds data sent to an actor's OnUse handler. +type UseEvent struct { + Actor *Actor +} diff --git a/pkg/uix/canvas_actors.go b/pkg/uix/canvas_actors.go index 5bb02e3..d50b956 100644 --- a/pkg/uix/canvas_actors.go +++ b/pkg/uix/canvas_actors.go @@ -57,26 +57,7 @@ func (w *Canvas) InstallScripts() error { vm := w.scripting.To(actor.ID()) // Security: expose a selective API to the actor to the JS engine. - vm.Self = map[string]interface{}{ - "Filename": actor.Doodad().Filename, - "Title": actor.Doodad().Title, - - // functions - "ID": actor.ID, - "GetTag": actor.Doodad().Tag, - "Position": actor.Position, - "SetHitbox": actor.SetHitbox, - "SetVelocity": actor.SetVelocity, - "SetMobile": actor.SetMobile, - "SetGravity": actor.SetGravity, - "AddAnimation": actor.AddAnimation, - "IsAnimating": actor.IsAnimating, - "PlayAnimation": actor.PlayAnimation, - "StopAnimation": actor.StopAnimation, - "ShowLayer": actor.ShowLayer, - "ShowLayerNamed": actor.ShowLayerNamed, - "Destroy": actor.Destroy, - } + vm.Self = w.MakeSelfAPI(actor) vm.Set("Self", vm.Self) if _, err := vm.Run(actor.Doodad().Script); err != nil { diff --git a/pkg/uix/canvas_link_tool.go b/pkg/uix/canvas_link_tool.go index 0495d92..fd5b531 100644 --- a/pkg/uix/canvas_link_tool.go +++ b/pkg/uix/canvas_link_tool.go @@ -2,6 +2,7 @@ package uix import ( "errors" + "sort" "git.kirsle.net/apps/doodle/pkg/drawtool" "git.kirsle.net/apps/doodle/pkg/shmem" @@ -34,3 +35,34 @@ func (w *Canvas) LinkAdd(a *Actor) error { } return nil } + +// GetLinkedActors returns the live Actor instances (Play Mode) which are linked +// to the live actor given. +func (w *Canvas) GetLinkedActors(a *Actor) []*Actor { + // Identify the linked actor UUIDs from the level file. + linkedIDs := map[string]interface{}{} + matching := map[string]*Actor{} + for _, id := range a.Actor.Links { + linkedIDs[id] = nil + } + + // Find live instances of these actors. + for _, live := range w.actors { + if _, ok := linkedIDs[live.ID()]; ok { + matching[live.ID()] = live + } + } + + // Sort them deterministically and return. + keys := []string{} + for key, _ := range matching { + keys = append(keys, key) + } + sort.Strings(keys) + + result := []*Actor{} + for _, key := range keys { + result = append(result, matching[key]) + } + return result +} diff --git a/pkg/uix/scripting.go b/pkg/uix/scripting.go new file mode 100644 index 0000000..81096b5 --- /dev/null +++ b/pkg/uix/scripting.go @@ -0,0 +1,35 @@ +package uix + +// Functions relating to the Doodad JavaScript API for Canvas Actors. + +// MakeSelfAPI generates the `Self` object for the scripting API in +// reference to a live Canvas actor in the level. +func (w *Canvas) MakeSelfAPI(actor *Actor) map[string]interface{} { + return map[string]interface{}{ + "Filename": actor.Doodad().Filename, + "Title": actor.Doodad().Title, + + // functions + "ID": actor.ID, + "GetTag": actor.Doodad().Tag, + "Position": actor.Position, + "SetHitbox": actor.SetHitbox, + "SetVelocity": actor.SetVelocity, + "SetMobile": actor.SetMobile, + "SetGravity": actor.SetGravity, + "AddAnimation": actor.AddAnimation, + "IsAnimating": actor.IsAnimating, + "PlayAnimation": actor.PlayAnimation, + "StopAnimation": actor.StopAnimation, + "ShowLayer": actor.ShowLayer, + "ShowLayerNamed": actor.ShowLayerNamed, + "Destroy": actor.Destroy, + "GetLinks": func() []map[string]interface{} { + var result = []map[string]interface{}{} + for _, linked := range w.GetLinkedActors(actor) { + result = append(result, w.MakeSelfAPI(linked)) + } + return result + }, + } +} diff --git a/pkg/windows/layers_window.go b/pkg/windows/layers_window.go index d163bc7..4aa2236 100644 --- a/pkg/windows/layers_window.go +++ b/pkg/windows/layers_window.go @@ -6,7 +6,6 @@ import ( "git.kirsle.net/apps/doodle/pkg/balance" "git.kirsle.net/apps/doodle/pkg/doodads" - "git.kirsle.net/apps/doodle/pkg/log" "git.kirsle.net/apps/doodle/pkg/shmem" "git.kirsle.net/go/render" "git.kirsle.net/go/ui" @@ -54,7 +53,6 @@ func NewLayerWindow(config Layers) *ui.Window { ) config.activeLayer = fmt.Sprintf("%d", config.ActiveLayer) - log.Warn("config.activeLayer=%s", config.activeLayer) window := ui.NewWindow(title) window.SetButtons(ui.CloseButton) @@ -71,8 +69,6 @@ func NewLayerWindow(config Layers) *ui.Window { Expand: true, }) - log.Info("SETUP PALETTE WINDOW") - // Draw the header row. headers := []struct { Name string @@ -143,7 +139,6 @@ func NewLayerWindow(config Layers) *ui.Window { }) btnName.Handle(ui.Click, func(ed ui.EventData) error { shmem.Prompt("New layer name ["+doodad.Layers[i].Name+"]: ", func(answer string) { - log.Warn("Answer: %s", answer) if answer != "" { doodad.Layers[i].Name = answer if config.OnChange != nil { @@ -220,7 +215,6 @@ func NewLayerWindow(config Layers) *ui.Window { Font: balance.MenuFont, OnChange: func(newPage, perPage int) { page = newPage - log.Info("Page: %d, %d", page, perPage) // Re-evaluate which rows are shown/hidden for this page. var ( diff --git a/pkg/windows/open_level_editor.go b/pkg/windows/open_level_editor.go index c0d8e40..8f57754 100644 --- a/pkg/windows/open_level_editor.go +++ b/pkg/windows/open_level_editor.go @@ -5,7 +5,6 @@ import ( "git.kirsle.net/apps/doodle/pkg/balance" "git.kirsle.net/apps/doodle/pkg/level" - "git.kirsle.net/apps/doodle/pkg/log" "git.kirsle.net/apps/doodle/pkg/userdir" "git.kirsle.net/go/render" "git.kirsle.net/go/ui" @@ -74,7 +73,6 @@ func NewOpenLevelEditor(config OpenLevelEditor) *ui.Window { }) for i, lvl := range levels { func(i int, lvl string) { - log.Info("Add file %s to row %s", lvl, lvlRow.Name) btn := ui.NewButton("Level Btn", ui.NewLabel(ui.Label{ Text: lvl, Font: balance.MenuFont, @@ -95,7 +93,6 @@ func NewOpenLevelEditor(config OpenLevelEditor) *ui.Window { }) if i > 0 && (i+1)%4 == 0 { - log.Warn("i=%d wrapped at mod 4", i) lvlRow = ui.NewFrame(fmt.Sprintf("Level Row %d", i)) frame.Pack(lvlRow, ui.Pack{ Side: ui.N, diff --git a/pkg/windows/palette_editor.go b/pkg/windows/palette_editor.go index bcd90a0..7c0e1f5 100644 --- a/pkg/windows/palette_editor.go +++ b/pkg/windows/palette_editor.go @@ -73,8 +73,6 @@ func NewPaletteEditor(config PaletteEditor) *ui.Window { Expand: true, }) - log.Info("SETUP PALETTE WINDOW") - // Draw the header row. headers := []struct { Name string