Porting to iTorque2D from TGB (C++)
by Pedro Vicente · in iTorque 2D · 04/20/2011 (4:27 pm) · 5 replies
Hello everyone
I am porting The Game of Life Tutorial from TDN (done for TGB) for iTorque2D
Help thread
www.garagegames.com/community/forums/viewthread/125451
TDN tutorial
tdn.garagegames.com/wiki/TGB/Tutorials/The_Game_of_Life
I have a resource on issues found and solved
www.garagegames.com/community/resources/view/20965
This thread is for issues found and not solved :-)
EDIT: (ISSUE identified)
The mouse cursor disappears and the application does not respond to any mouse events when adding a onLevelLoaded function (class is a t2dSceneGraph instance)
NOTE: system is Windows
I am porting The Game of Life Tutorial from TDN (done for TGB) for iTorque2D
Help thread
www.garagegames.com/community/forums/viewthread/125451
TDN tutorial
tdn.garagegames.com/wiki/TGB/Tutorials/The_Game_of_Life
I have a resource on issues found and solved
www.garagegames.com/community/resources/view/20965
This thread is for issues found and not solved :-)
ISSUE 1. mouse events disabled when onLevelLoaded is defined
EDIT: (ISSUE identified)
The mouse cursor disappears and the application does not respond to any mouse events when adding a onLevelLoaded function (class is a t2dSceneGraph instance)
function CaTutorialPart2::onLevelLoaded( %this, %scenegraph )
{
}NOTE: system is Windows
#2
I think the issue here is not directly related to Multi-touch, I am just trying that my app responds to a simple onMouseDown event (I am in Windows).
EDIT: as a follow up to my original post further describing the issue (not sure if this is a bug or not ). Mouse events are just totally disabled (the mouse cursor does not even show) when onLevelLoaded is defined.
EDIT2: @Allistair. Even after removing the onLevelLoaded for *some* mouse clicks the app was not replying. Then I noticed that I was using your Multi-touch changes version and recompiled with the original 1.4.1 sources, which now totally fixes the issue. So, keep in mind of a potential issue in the patch. :-)
04/20/2011 (8:48 pm)
@Allistair. Thanks. I tried to use your source files (I use a version control system, so it's easy to see the changes you made), but the problem still happens.I think the issue here is not directly related to Multi-touch, I am just trying that my app responds to a simple onMouseDown event (I am in Windows).
EDIT: as a follow up to my original post further describing the issue (not sure if this is a bug or not ). Mouse events are just totally disabled (the mouse cursor does not even show) when onLevelLoaded is defined.
EDIT2: @Allistair. Even after removing the onLevelLoaded for *some* mouse clicks the app was not replying. Then I noticed that I was using your Multi-touch changes version and recompiled with the original 1.4.1 sources, which now totally fixes the issue. So, keep in mind of a potential issue in the patch. :-)
#3
04/21/2011 (12:28 pm)
@pedro - yeah multitouch requires that each device has a unique ID, for this to work in the window previewer you'd have to make a slight modification to the mouse input source for windows, just to tell it to transmit a unique id.
#4
The app is similar to the tutorial, but user interaction is done by selecting one and only one tile and then drag it.
For the moment I am developing in Windows, the final product will be of course for iOS.
From this thread it seems the transition Windows-iOS will be almost transparent
www.garagegames.com/community/forums/viewthread/123867
so a workaround is to set onMouseDragged to call onMouseDown
04/21/2011 (2:05 pm)
@Allistair. Thanks for the info. I am doing an app where I actually want to avoid multitouch :-)The app is similar to the tutorial, but user interaction is done by selecting one and only one tile and then drag it.
For the moment I am developing in Windows, the final product will be of course for iOS.
From this thread it seems the transition Windows-iOS will be almost transparent
www.garagegames.com/community/forums/viewthread/123867
Quote:onMouseDown, onMouseUp... are automatically converted to touches... onMouseDragged callback does not work on device
so a workaround is to set onMouseDragged to call onMouseDown
function t2dSceneObject::onMouseDragged( %this, %modifier, %worldPosition, %clicks )
{
%this.onMouseDown( %modifier, %worldPosition, %clicks );
}
#5
My code restores identical functionality to what you'd find on the PC and will transmit onMouseMove and with an instant mod dragged. If you don't want multitouch you can just untick it in the editor as always.
04/22/2011 (6:04 am)
@PedroMy code restores identical functionality to what you'd find on the PC and will transmit onMouseMove and with an instant mod dragged. If you don't want multitouch you can just untick it in the editor as always.
Torque 3D Owner Alistair Lowe3
http://www.garagegames.com/community/forums/viewthread/125394