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 / Drawing lines and points

Author
Message
niansenx
8
Years of Service
User Offline
Joined: 29th Jan 2016
Location:
Posted: 3rd Sep 2016 11:57
Hello

I am writing a program that draws lines on the screen. I've noticed that if I use the draw function once, then loop a sync() statement, the line disppears. I have to keep drawing it in the loop to make it stay on the screen. Is there any way to make drawn objects remain on the screen without you haveing to use the draw function again? I want to be able to leave a trail of lines so that each draw is added to the graphics already drawn on the screen. I've tried various combinations of swap and render, but I can't seem to make it work.

Any hints?
Thanks
Markus
Valued Member
20
Years of Service
User Offline
Joined: 10th Apr 2004
Location: Germany
Posted: 3rd Sep 2016 14:23
you can render to an image and the image you use as fullscreen sprite.
SetRenderToImage( colorImage, depthImage )
also good for drawing its DrawSprite( iSpriteIndex ) , u can exchange the sprite image as brush.

there is a command EnableClearColor( clear ) but it not work at all android devices.
the clear screen is made in Swap() command, Sync ommand can split into update,render,swap etc.
AGK (Steam) V2.0.20 : Windows 10 Pro 64 Bit : AMD (16.3.2) Radeon R7 265 : Mac mini OS X 10.10 (Yosemite)
Phaelax
DBPro Master
21
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 3rd Sep 2016 15:43
Two other options:
1. Build an array that holds the endpoints of each line as it's drawn. Then you can redraw them with a simple loop each frame.
2. If you really want to avoid the draw command, turn the lines into sprites. This also allows you to control the thickness of the line. See my link for my example.

https://forum.thegamecreators.com/thread/216368

"I like offending people, because I think people who get offended should be offended." - Linus Torvalds

Login to post a reply

Server time is: 2024-11-25 03:47:36
Your offset time is: 2024-11-25 03:47:36