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 / Screen erases inside the Main loop and I don't want it to

Author
Message
BillR
21
Years of Service
User Offline
Joined: 19th Mar 2003
Location: United States
Posted: 9th Jul 2016 04:16 Edited at: 9th Jul 2016 04:21
I want to draw concentric blue rectangles with a delay between drawing each one and not have the screen erase after drawing each one,
so that all the blue rectangles will eventually be on the screen at the end before the screen is erased.



Windows 8.1
On my system, only one rectangle is drawn, then the screen is erased before the next rectangle is drawn.
Why is the screen being erased?
Does Sync() erase the screen? The Docs don't say this.
What if I want to show things drawing in a sequence on the screen and it keeps erasing the screen?

Thanks for your help in this matter.
IBOL
Retired Moderator
20
Years of Service
User Offline
Joined: 30th Mar 2004
Location: @IBOL17
Posted: 9th Jul 2016 05:10
the "draw" commands are "just for one sync".
things like sprites, texts, and objects exist independently, but the draw commands are temporary.
Ortu
DBPro Master
16
Years of Service
User Offline
Joined: 21st Nov 2007
Location: Austin, TX
Posted: 9th Jul 2016 07:18
each sync loop, you will need to redraw all the previous boxes as well as the new box. Something like this should work:

BillR
21
Years of Service
User Offline
Joined: 19th Mar 2003
Location: United States
Posted: 9th Jul 2016 07:43
Thanks IBOL for the info about the draw commands being for one Sync()

And Thanks Ortu for the Code Example, it worked Great!

Too bad there isn't a flag for the Sync() command to let the Draw commands be persistent if you wanted
them to be like I do, rather than having to draw them all every frame.

For this game my/your modified routine will work perfectly!

If in the future I do something more complex with draw commands, I guess I will just build my own 'Display List'
of Lines to be redrawn each frame, then process through my list each frame as needed.

Your help is much appreciated!
Thanks!
Markus
Valued Member
20
Years of Service
User Offline
Joined: 10th Apr 2004
Location: Germany
Posted: 9th Jul 2016 09:54
with this command you can disable this clear at sync but it work not at all devices.
EnableClearColor ( clear )
SetClearColor ( red, green, blue )
ClearScreen ()

also interesiting is DrawSprite

you can replace sync with Update, Render, Swap for more control
AGK (Steam) V2.0.19 : Windows 10 Pro 64 Bit : AMD (16.3.2) Radeon R7 265 : Mac mini OS X 10.10 (Yosemite)

Login to post a reply

Server time is: 2024-09-29 15:23:11
Your offset time is: 2024-09-29 15:23:11