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 / Making drawn lines stay on the screen

Author
Message
niansenx
8
Years of Service
User Offline
Joined: 29th Jan 2016
Location:
Posted: 3rd Sep 2016 11:58
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
Woodster
13
Years of Service
User Offline
Joined: 3rd Oct 2011
Location: Redditch, United Kingdom
Posted: 3rd Sep 2016 12:34
I had a similar issue when writing a retro style game, wanted a humble line to persist. Alas, I couldn't think of a good way and my solution initially was to continually redraw it in my main loop.

Then I noticed a posting that suggested the use of sprites, ie draw your line and Sprite it up.

Then it will stay put and doesn't need redrawing again.

I won't insult your intelligence showing you code, but it isn't rocket surgery

Simples!!


Login to post a reply

Server time is: 2024-11-25 03:44:07
Your offset time is: 2024-11-25 03:44:07