func (c *InputHandler) movePlayer(x, y int) { defer debug.Trace().UnTrace() trans := c.Owner().Comp("physics.Transform").(*physics.Transform) trans.X += (10 * x) trans.Y += (10 * y) debug.Msg(trans.X, trans.Y) }
func (c *core) Step() { defer debug.Trace().UnTrace() c.TimeStamp = time.Now() dt := time.Since(c.TimeStamp) // if dt < 16*time.Millisecond { return } debug.Msg() debug.Msg("frame:", c.CurrFrame) debug.Log("dt:", dt) c.CurrFrame++ for _, mgr := range c.managers { mgr.BeginFrame() defer mgr.EndFrame() } for _, spc := range c.spaces { spc.Update(dt) } debug.Msg() // } }
// HandleKey handles keyboard events func (q *QmlInputMngr) HandleKey(key int, shift_mod, ctrl_mod, alt_mod bool) { defer debug.Trace().UnTrace() switch keycodes.Keycode(key) { case keycodes.Key_None: // do nothing case keycodes.Key_Alt, keycodes.Key_Shift, keycodes.Key_Control: debug.Msg(keycodes.Keycode(key)) debug.Msg() default: // TODO(jemorgan): move this logic into input system switch key { case keycodes.Key_Right: q.Dispatch("move_right", nil) return case keycodes.Key_Left: q.Dispatch("move_left", nil) return case keycodes.Key_Up: q.Dispatch("move_up", nil) return case keycodes.Key_Down: q.Dispatch("move_down", nil) return case keycodes.Key_D: q.Dispatch("debug_draw", nil) case keycodes.Key_F: q.Dispatch("collision", nil) } if shift_mod && key != keycodes.Key_Shift { debug.Msg("shift+") } if ctrl_mod && key != keycodes.Key_Control { debug.Msg("ctrl+") } if alt_mod && key != keycodes.Key_Alt { debug.Msg("alt+") } debug.Msg(keycodes.Keycode(key)) debug.Msg() } if shift_mod && key == keycodes.Key_Q { os.Exit(1) } // if key == keycodes.Key_T { // ctrl.Timer.Set("running", true) // } }
func (c *GoBox) Deinit() { defer debug.Trace().UnTrace() debug.Msg(c.x1, c.y1, c.x2, c.y2) c.Destroy() }
func (q *QmlInputMngr) HandleMouseDown(xPos, yPos int) { defer debug.Trace().UnTrace() debug.Msg("mouse:", xPos, yPos) }