Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Classic Chat / XC4 T2 Problem with 'GetSpriteHit' and 'GetPointerPressed'

Author
Message
JavierTF
14
Years of Service
User Offline
Joined: 15th Feb 2010
Location: Going out, to the right
Posted: 1st Dec 2011 08:05
Hello!

I'm working with XCode T2 4.x and I have a problem with 'GetSpriteHit' and 'GetPointerPressed'.

When I try to use these commands from a 'do ... while' loop from a different file than main.cpp (for example), it seems that this commands do not work (Sync () included in the do-while loop) if are not called from the loop of the main application.

I need to use the do-while loops to avoid making constant calls to the main loop of the application, in cases such as message windows, etc..

Am I doing something wrong? Could be a bug?

Thanks in advance.
bjadams
AGK Backer
16
Years of Service
User Offline
Joined: 29th Mar 2008
Location:
Posted: 1st Dec 2011 09:55
As far as I know, you can only Sync() within app::Loop
JavierTF
14
Years of Service
User Offline
Joined: 15th Feb 2010
Location: Going out, to the right
Posted: 1st Dec 2011 12:13 Edited at: 1st Dec 2011 12:43
Hi bjadams

Nop, it can be done anywhere you need.

For example, in my game I have a menu that makes a scroll to be displayed or not. Its placedthis in a separate .cpp file and the only precaution is to include the header file agk.h.

Here the code:




As you can see I made two calls to agk::Sync () with no problems. My problem is that in do-while loops run all commands but those two ...
baxslash
Valued Member
Bronze Codemaster
17
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 1st Dec 2011 12:30
Are you missing an include?

JavierTF
14
Years of Service
User Offline
Joined: 15th Feb 2010
Location: Going out, to the right
Posted: 1st Dec 2011 12:37
Hi baxslash

No... And there are a lot of agk commands in the same file and work fine. But watching the debuger, it reads GetPointerX and Y ok, reads the GetSpriteHit and jumps the 'if' it must read!

Later I'll post the code (I deleted It!!)
JavierTF
14
Years of Service
User Offline
Joined: 15th Feb 2010
Location: Going out, to the right
Posted: 1st Dec 2011 13:47 Edited at: 1st Dec 2011 14:42
Hello again

I rewrote the code that generates the problem. Here it is:




I hope you can help me. Greetings!
Paul Johnston
TGC Developer
21
Years of Service
User Offline
Joined: 16th Nov 2002
Location: United Kingdom
Posted: 2nd Dec 2011 15:43 Edited at: 2nd Dec 2011 15:44
In tier 2 you must avoid do while loops that wait on user input, since the input commands are updated by the device which can't do anything until you return from the loop. Also spending a long time looping in App.Loop() or App.Begin() without returning may cause the device to terminate your app thinking it is not responding.

Note this does not apply to tier 1 as the interpreter handles all the returning to device automatically.
JavierTF
14
Years of Service
User Offline
Joined: 15th Feb 2010
Location: Going out, to the right
Posted: 3rd Dec 2011 00:03
Tier 1 are lucky! Thank you very much for the information Paul. I think I'll have to make several important changes in the structure of my program.

A question. It may be silly but, is it possible to deceive the device by creating a sub process while waiting for user input?

regards
LeeBamber
TGC Lead Developer
24
Years of Service
User Offline
Joined: 21st Jan 2000
Location: England
Posted: 8th Dec 2011 00:06
In T2, you can do a lot of deceiving, depending on your C++ skills. As a native application, you can hack in pretty much anything you can dream up - at your own risk

I drink tea, and in my spare time I write software.
bjadams
AGK Backer
16
Years of Service
User Offline
Joined: 29th Mar 2008
Location:
Posted: 8th Dec 2011 10:03
Sorry guys but I cannot understand why you want to be limiting yourself to T1 when the T2 command set is practically identical!
JavierTF
14
Years of Service
User Offline
Joined: 15th Feb 2010
Location: Going out, to the right
Posted: 8th Dec 2011 19:04 Edited at: 8th Dec 2011 19:08
Thanks Paul.

@Lee, I said, a silly question… I think at that time I had my mind wandering through cyberspace.

Well... really the matter is that it is curious that these commands do not work in a 'do - while' (called from a function, otherwise I have not tried) even having loaded all the logic and variables to run an 'if'. Tracking in the XCode debugger, it is hooked in the asm. I say, a curiosity.

In my opinion this is not a bug but a logical consequence. If in T2 you exit the loop 'app:' some commands remain on a siding. The solution is simple: bring them back to the main loop.

@bjadams You're absolutely right. In my case I used T1 only for a week in order to test it. Then I go immediately to T2, which leverages the power of both languages.

I do not remember where I read that AppGameKit team explicitly stated that T1 is a language of initiation, but to get the best performance had to work with T2. The reality is that between T1 and T2 there is a big difference in performance. Although I'm seeing here that the companions of T1 are doing great jobs!

Regards

.
bjadams
AGK Backer
16
Years of Service
User Offline
Joined: 29th Mar 2008
Location:
Posted: 8th Dec 2011 19:26
I never tested T1 myself, I started with T2 from day 1.

I am developing 2 games. Framerate is at 60fps on iphone 3gs (doesn't use any physics though). Can't seem to throw enough data to AppGameKit to make it slow down!!!!
JavierTF
14
Years of Service
User Offline
Joined: 15th Feb 2010
Location: Going out, to the right
Posted: 8th Dec 2011 20:19
Yes! I think T2 is its natural environment. 60 fps are very very good results. I'm working on an adventure game and I can assure you that when I did the first test in the IPad I was amazed.

Please keep me informed of your two games!

regards


.

Login to post a reply

Server time is: 2024-04-25 02:19:57
Your offset time is: 2024-04-25 02:19:57