Posted: 29th Sep 2011 21:28
Is there a way to speedup the GetPointerPressed() command in any way?
I use it in my IPad project but I need to hold the finger for about a
second until it gets recognized.

The game itself runs at full speed (same as on Windows) so it seems
that there's a delay in the Pointer commands.

Any ideas or experiences with that?
Posted: 29th Sep 2011 21:46
I do experience the same on my iPad.
Posted: 29th Sep 2011 22:00
Which XCode and Base SDK version do you use to compile the AppGameKit player? Currently I upgraded XCode to 4.0.2 with Base SDK 4.3.
Posted: 29th Sep 2011 22:41
I use the same as you
Posted: 30th Sep 2011 0:18
For me its like the GetPointerPressed gets slower and slower the longer I play my game
Posted: 30th Sep 2011 19:22
My hole game get slower and slower on my iPad.
Could it be the player?
Posted: 30th Sep 2011 20:18
I changed some code and now it's a bit faster but not optimal.

Before it was like that:

+ Code Snippet
Do

Gosub _sub1
Gosub _sub2

If GetPointerPressed() = 1

Gosub _dosomestuff1
Gosub _dosomestuff2

Do

If GetPointerReleased() = 1 then Exit

Gosub _domorestuff1
Gosub _domorestuff2
Gosub _domorestuff3

Sync()
Loop


EndIf

Sync()

Loop


Then I changed it to something like that:


+ Code Snippet
Do

Gosub _sub1
Gosub _sub2

If GetPointerPressed() = 1

Gosub _dosomestuff1
Gosub _dosomestuff2

Do

If GetPointerReleased() = 1 then Exit
Gosub _domorestuff1

If GetPointerReleased() = 1 then Exit
Gosub _domorestuff2

If GetPointerReleased() = 1 then Exit
Gosub _domorestuff3

Sync()
Loop


EndIf

Sync()

Loop


Now it's better then before but it seems that there's still some delay in detecting a touch event.

Then I updated to current XCode 4.1 and it also seems to be a bit faster.
Posted: 30th Sep 2011 20:52
I don't know anything about AGK. But maybe you could just hold a variable that contains the GetPointerReleased() its return.

So...

bool screentouched = (bool)GetPointerReleased();

...at the beginning of your loop code.

And after that you just check that each time when you need it.

if(screentouched == true)
{
// do stuff
} else {
// do other stuff
}
Posted: 30th Sep 2011 21:20
RedEye the problem seems related to Tier1 not to Tier2 c++
Posted: 30th Sep 2011 21:29
@Hubdule: You overdoing it with the GetPointerReleased calls. You are calling it 3 times in every frame. That could be 3 times in 16 milliseconds. Overkill! One call for each frame should be enough!
Posted: 30th Sep 2011 22:15
@MikeHart

I know that it's not the best way to do it and to me it really looks wrong but when I call it only once a frame then it doesn't feel "right" as it takes up to one second until the "touch" event got recognized.

When calling it more then one time, then it seems like it's faster. So I'll try it with different methods and test, what "feels" best
Posted: 30th Sep 2011 22:21
Hubdule:

I'll be waiting to see if you find the solution.
And I'll try myself to see if I can speed things up.
Posted: 30th Sep 2011 23:56
File it as a bug if you haven't yet.
http://code.google.com/p/agk/issues/list
I haven't been able to test yet on iPod Touch although I'm getting to a point to where I will be doing that soon.
Posted: 2nd Oct 2011 21:03
I tried to optimize my code but it did not help.
When I print the FPS it starts with 30 and slowly drops down to below 10. Proberly lower but I stopped it.

The game I'm working on is a memory game.
What I do is show a grid with 10x10 sprites.
Each loop I check for keypress and if keypressed then I change the pressed sprite with SetSpriteImage.

But for each keypressed it gets slower and slower.

Any idea why?
[Edit]
I think I'm onto something.
I print the GetManagedSpriteCount every loop and it is increasing for each loop. So proberly something wrong with my code somewhere.
[/Edit]

[Solved]
I found out that every time I did redraw my 10x10 grid I did a CreateSprite instead of SetSpriteImage and it added a 100 new sprits every time I called my keypressed routine.
But now it sloved and my game is fast again.
[/Solved]
Posted: 9th Oct 2011 4:17
Phew, thought we had a problem with the input code there If anyone else experiences a slow GetPointerPressed command, please write a small peice of code and what you expect it to do so we can all compile and run to see what we get on our systems.
Posted: 10th Oct 2011 9:31
I found the "error" The problem was that I tossed to many sprites on the IPad. So the whole thing slowed down a bit and the GetPointerReleased() seemed to be slow on detecting touches. But this wasn't the case as soon as I changed the project in the main loop where now every second cycle most of the drawing takes place. Now it works as expected! Perfect on IPod and IPad.