Skip to content
This repository has been archived by the owner on Mar 5, 2021. It is now read-only.

Cross platform multi touch fixes #44 #174

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

AgileJoshua
Copy link
Contributor

Restarting PR #65 (by accident) while trying to cleanup stuff.

Still needs to be tested on devices - this is just the cleanup...

@AgileJoshua
Copy link
Contributor Author

I have tested this out using this project: https://github.com/AgileJoshua/superpowers-touch-demo
which can be downloaded and copied into the projects folder of a SuperPowers server.

The project suports multiple touches and tapping simultaneously.
Tested on Samsung S6 & S7, chrome in mobile emulation mode, iPhone simulator (XCode), iPad Mini & iPad Air.

The only issue I have found so far is on Android when tracking multiple touches when a touch is ended then the first touch in the array is also ended. But this only occurs once after there are zero touches. This could be an issue with my demo project...

    function getTouchPosition(identifier: number): Math.Vector2;
    function isTouchDown(identifier?: number): boolean;
    function wasTouchJustStarted(identifier?: number): boolean;
    function wasTouchJustEnded(identifier?: number): boolean;
    function wasTouchJustMoved(identifier?: number): boolean;
    function getTouchesStarted(): number[]; 
    function getTouchesEnded(): number[]; 
    function getTouchesMoved(): number[];
    function getTouchesDown(): number[];

I have tried to keep to the API standard for mouse events:
was Thing Just Event
is Thing State

plus
get Thing Event

@AlexBezuska
Copy link

I am pretty new to SP, is there any way I can test out this build of the engine? (I'm not sure how to replace the build with the one on my local computer)

@AgileJoshua
Copy link
Contributor Author

Updated with current master and finally got around to testing and debugging through the problems that were occuring on Android devices. I have tested this on real devices and in emulators/simulators, single and multitouch works as far as I can tell on Android and iOS. I have not tested on touch enabled Windows devices.

To test this, setup a superpowers dev environment. Switch to this branch of the code for the game system and compile as instructed.

Use my demo project https://github.com/AgileJoshua/superpowers-touch-demo to get a simple test project up. Just create a new folder inside the superpowers project folder and place all the files from https://github.com/AgileJoshua/superpowers-touch-demo there.

@AgileJoshua
Copy link
Contributor Author

This closes #44, #135, #178

@AgileJoshua
Copy link
Contributor Author

Rebased the whole fix on top of master to ensure only relevant changes are included...

@AgileJoshua
Copy link
Contributor Author

Verified to work on Windows 10 on a Phone (Lumia) and Surface Pro 4 (in Chrome).

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants