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 / Sync issues

Author
Message
Santman
13
Years of Service
User Offline
Joined: 15th Sep 2011
Location: Inverness
Posted: 29th Apr 2013 13:54 Edited at: 29th Apr 2013 13:54
This may just be me, but I'm having an odd issue and wonder if anyway knows a way around. In a simple repeat:until loop to check for the pointer being pressed then released, it doesn't register the released part at all unless I sync in the middle. The problem is, I don't want the screen to update, just the background checking for key presses etc to update. I've tried every mix of update, swap etc but only sync seems to update this. In dbpro we could add a flag that allowed a sync that did everything EXCEPT the screen.

Does anyone know of a way to do this in agk?
Marl
13
Years of Service
User Offline
Joined: 19th Nov 2011
Location: Bradford, UK
Posted: 29th Apr 2013 15:00
My understanding is that it is during the sync that the pointer is updated.

This means that unless you call the sync - the pointer state change will not be seen by AppGameKit and your loop will run forever
Markus
Valued Member
20
Years of Service
User Offline
Joined: 10th Apr 2004
Location: Germany
Posted: 29th Apr 2013 15:32
hmm, it looks that it is part of Swap()

Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 29th Apr 2013 18:00
Well, Update, Render and Swap are all the steps done by Sync.

The help pages don't specify which one handles platform events (like mouse or touch). But Marcus' sample indicates it is done in Swap, which is odd.

Cheers,
Ancient Lady
AGK Community Tester and AppGameKit Master
Santman
13
Years of Service
User Offline
Joined: 15th Sep 2011
Location: Inverness
Posted: 29th Apr 2013 18:04
Thanks guys, I thought I'd tried swap by itself and it wasn't working, I'll try again later to see.... I may just have tried update and render.
Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 29th Apr 2013 18:47
I suspect it is actually Update. That sounds more reasonable.

Cheers,
Ancient Lady
AGK Community Tester and AppGameKit Master
Santman
13
Years of Service
User Offline
Joined: 15th Sep 2011
Location: Inverness
Posted: 29th Apr 2013 23:06
@Ancient lady, Markus

Not sure if I have a different version to you guys (beta 11) but neither on it's own works - though I have discovered that swap() by itself does change to the backbuffer, but this results in a black flash of the screen. doing render() then swap() appears to work though, but it's still drawing the screen. Neither render() or update() by themselves do anything, so I have to assume that the process is done during the swapping process as Markus suggested and find another way to code around it.

Thanks for the help guys, maybe this is something quick that Paul could drop in in the future - though not sure how many people would actually find it useful apart from me! Lol.
Markus
Valued Member
20
Years of Service
User Offline
Joined: 10th Apr 2004
Location: Germany
Posted: 29th Apr 2013 23:52
i added it to the issues list.
i think swap should only exchange the screen buffer or
the description can told more intern processes.
Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 30th Apr 2013 00:19
Santman, I haven't tested what Markus posted.

I do know that it is necessary to call Sync() to get the pointer commands to register. And this only works in Tier 1. In Tier 2, the pointer is updated at the end of each app::Loop() call. And this causes a bunch of annoyance.

Cheers,
Ancient Lady
AGK Community Tester and AppGameKit Master
Paul Johnston
TGC Developer
22
Years of Service
User Offline
Joined: 16th Nov 2002
Location: United Kingdom
Posted: 1st May 2013 03:35
The device updates like pointer and touch input are done in Swap, this is because mobile devices call the main loop of your code in response to a "please draw your screen" event, so AppGameKit uses this to run all your code up to the next Swap (or Sync) command then returns control to the device.

Returning control without modifying the screen is technically feasible, although the device will wait for the next display update to call your code again, about 17 milliseconds, but I'm not sure if some devices would have a problem with the display not updating after an event designed to update the display.
Impetus73
13
Years of Service
User Offline
Joined: 28th Aug 2011
Location: Volda, Norway
Posted: 1st May 2013 09:36
Why is running sync() a problem? if it's in a closed loop, none of the rest of the code should be running, and therefore no updates to the screen.

----------------
AGK programmer
Did Amiga / AMOS programming in the 90's.
Markus
Valued Member
20
Years of Service
User Offline
Joined: 10th Apr 2004
Location: Germany
Posted: 1st May 2013 09:43
@Paul
good to know
Santman
13
Years of Service
User Offline
Joined: 15th Sep 2011
Location: Inverness
Posted: 1st May 2013 22:06
@ Paul,

Ah, that kind of makes sense, I'm just more used to DBPro still.

@Impetus73

It's down to the way I code - I have a couple of routines that do assorted things throughout a fairly long loop depending on states etc, and I only therefor want the sync to occur once for the screen, at the end of that loop. See my new keyboard routine as a very simple example - that changes passwords to "*" characters as you type, or after a delay. Because of the way the code was set up, various combinations of key press checks needed to be done before the loop ran it's course but during the repeat loops to check for the pointer being released I had to sync to get the result, which updated an incomplete screen. I just coded around it though.

To be honest, I BADLY miss the ability of DBPro to set up a separate buffer and draw things periodically to that, before just dumping it to the screen - I used that a lot.

Login to post a reply

Server time is: 2024-11-24 13:51:46
Your offset time is: 2024-11-24 13:51:46