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 Studio Chat / [SOLVED] smooth drawing possible?

Author
Message
smerf
19
Years of Service
User Offline
Joined: 24th Feb 2005
Location: nm usa
Posted: 15th Feb 2020 09:53
Im trying to draw in real time on the screen for a simple drawing tool. The issue is the faster the mouse moves the more space between pixels is generated. Tried using sprites and a render image but im not having much luck as far as speed goes. using the line tool to draw since there is no pixel or dot as far as im aware. and with manual frame control i figure i should be able to track the mouse a few thousand times a second but seem to be having the opposite effect when attempting to manually sync.

some code to look at basically all i have everything ive tried failed so far.


renderid=CreateRenderImage(256,256,0,0)
sprite=createsprite(renderid)
setspriteimage(sprite,renderid)
do
x#=getrawmousex()
y#=getrawmousey()
if GetRawMouseLeftstate()=1
SetRenderToImage(renderid,0)
drawline(x#,y#,x#+1,y#,255,255,255)
setrendertoscreen()
endif
sync()
loop

The author of this post has marked a post as an answer.

Go to answer

Impetus73
12
Years of Service
User Offline
Joined: 28th Aug 2011
Location: Volda, Norway
Posted: 15th Feb 2020 12:47 Edited at: 15th Feb 2020 12:52
This post has been marked by the post author as the answer.
Hi. here is the solution, study it:

smerf
19
Years of Service
User Offline
Joined: 24th Feb 2005
Location: nm usa
Posted: 16th Feb 2020 00:59
Thank you impetus. I was thinking there would be a solution based on speed and performance, it didnt occur to me to just a draw a line. its a little rough and jagged but i think i can make a math function to smooth it out and antialiase it.

Login to post a reply

Server time is: 2024-05-04 02:36:48
Your offset time is: 2024-05-04 02:36:48