ui.GestureView is now deprecated. Now what?

139 views
Skip to first unread message

Davide Aimone

unread,
May 16, 2016, 11:15:40 AM5/16/16
to Game Closure DevKit
Hi,
like the subject of this thread, what is the replacement of GestureView?

Thank you

Jimmy Griffith

unread,
May 16, 2016, 3:16:50 PM5/16/16
to Davide Aimone, Game Closure DevKit
Hey Davide,

There really isn't a replacement that does exactly that, but we found that particular class was causing people a lot of trouble. It doesn't follow best practices for user experience and has some bugs. I think to achieve the best input behavior in your game, you should use the default input API to create your own; it's typically a very small amount of code.

I took some notes on the API recently, here's a brief summary I put together. On any instance of View, you can add "listeners" for input like this:

// mouse/touch down
this.onInputStart = function (startEvent, startPoint) { // call startDrag if you want to follow a drag, it can also take opts, // like { radius: 50 }
this.startDrag();
};
// triggered if startDrag is called, once drag radius is met
this.onDragStart = function (dragEvent) {};
// fires each tick after onDragStart while a player is still dragging
this.onDrag = function (dragEvent, moveEvent, delta) {};
// fires instead of onInputSelect after dragging
this.onDragStop = function (dragEvent, stopEvent) {};
// fires each tick while mouse/touch moving or dragging // includes mouse over events
this.onInputMove = function () {};
// fires on mouse/touch up, only if not dragging
this.onInputSelect = function (stopEvent, stopPoint) {};


--
Jimmy Griffith
Studio Head | Weeby.co

Davide Aimone

unread,
May 29, 2016, 10:03:18 AM5/29/16
to Game Closure DevKit
Thank you Jimmy, I think GV is still good in some easy case, but I understand what you mean.
Reply all
Reply to author
Forward
0 new messages