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 / How to draw a dot?

Author
Message
Mark Garrett
Reviewed AGK on Steam
18
Years of Service
User Offline
Joined: 10th Jul 2005
Location: California, US
Posted: 12th Aug 2017 22:47
Part of my interested in doing drawings with dots.

However, I noticed that there is no 'draw dot' command.

Is there a solution to that ? Or a 'work-arround' ?
.
Rich Dersheimer
AGK Developer
14
Years of Service
User Offline
Joined: 1st Jul 2009
Location: Inside the box
Posted: 13th Aug 2017 00:50 Edited at: 13th Aug 2017 00:53
There's not a DrawDot() command. But then again, you can't really draw lines with the DrawLine() command, or boxes with the DrawBox() Command. The commands like this that draw to the screen only last for one Sync(), so you have to keep drawing them every cycle to get persistance.

One thing you can do is to place sprites wherever you want dots, but that could lead to a LOT of sprites.

Another thing you could do is to use a memblock for your drawing canvas, create an image from the memblock, then use the image on a sprite. This takes a bit of time, so it's recommended that you don't do this every cycle, perhaps only updating the memblock/image/sprite when you actually draw a dot.

You can even do the same thing by drawing a small filled box or circle, rendering the screen, grabbing the screen to an image, then putting the image back on to a sprite background that you can use for the next dot, and so on.

There's probably other better ways to do this.
Rich Dersheimer
AGK Developer
14
Years of Service
User Offline
Joined: 1st Jul 2009
Location: Inside the box
Posted: 13th Aug 2017 01:02
Here some sample code to use the "grab image each time to place a dot" technique.

fubarpk
Retired Moderator
19
Years of Service
User Offline
Joined: 11th Jan 2005
Playing: AGK is my friend
Posted: 17th Aug 2017 23:11 Edited at: 17th Aug 2017 23:12
here is a technique that draws a square wherever you move the mouse to
using render instead of grab image

fubar

Login to post a reply

Server time is: 2024-03-28 10:49:36
Your offset time is: 2024-03-28 10:49:36