? Drawing Filled Circles ● SmileBASIC Source

Sign In

Register
*Usernames are case-sensitive
Forgot my password

Drawing Filled Circles

A function that draws a filled circle with a selectable color. Source code: DEF FCIRCLE X,Y,R,L:_=-6.28319R=MAX(R,1)F=_/R:FOR I=_ TO.STEP-F:C=COS(I)S=SIN(I)N=COS(I-F)M=SIN(I-F)GTRI X,Y,X-C*R,Y-S*R,X-N*R,Y-M*R,L:NEXT.END Usage: FCIRCLE X, Y, R, L int X (X coordinate of origin point of circle) int Y (Y coordinate of origin point of circle) int R (Radius) int L (Color code) Example: Draws a circle in the middle of the screen with a radius of 20 pixels FCIRCLE 200, 120, 20, -1
Author
AnswerXOX
Updated
Rating
4 votes
Categories
Keywords
13 Comment(s) AnswerXOX AnswerXOX Great Page Hidden Achievements RNG Hidden Easter Eggs Second Year My account is over 2 years old Website I didn't even realize the terrible formatting And this is basically designed to just draw circles very quickly, not meant to be accurate 12Me21 12Me21 Head Admin Second Year My account is over 2 years old Website Syntax Highlighter Received for creating the code syntax highlighter on SBS Night Person I like the quiet night and sleep late. Express Yourself The circles that this draws are pretty ugly and deformed. MZ952 MZ952 Intermediate Programmer I can make programs, but I still have trouble here and there. Programming Strength Drawing I like to draw! Hobbies Reading I like to read books! Hobbies It seems to work OK for me (even in its one-line format). Although it isn't perfect. snail_ snail_ Helper Received for being very helpful around SmileBASIC Source Achievements OSP Contest 2 Contest Participant I participated in the second SmileBASIC Source OSP Contest! Night Person I like the quiet night and sleep late. Express Yourself Please fix the formatting on this page. AnswerXOX AnswerXOX Great Page Hidden Achievements RNG Hidden Easter Eggs Second Year My account is over 2 years old Website Sorry, I didn't realize the terrible formatting, I was on a 3DS and I didn't think it wouldn't automatically have line breaks when using the (code) blocks Simeon Simeon Scholar Received for knowing a great deal about programming topics Achievements Amazing Page Hidden Achievements Drawing I like to draw! Hobbies Wait what? How does this work?? It does work (it draws the circle like a pie chart) What does TO.STEP mean? Because it doesn't work without that MZ952 MZ952 Intermediate Programmer I can make programs, but I still have trouble here and there. Programming Strength Drawing I like to draw! Hobbies Reading I like to read books! Hobbies A single period is recognized as a "0" in smilebasic. Example, ?A[.] Now for the NEXT.END, I thought that maybe SB recognizes the "." token like it does spaces, and it seemed that way up until you tried it with any other command. As it turns out, the NEXT instruction accepts an optional input after it, which it promptly ignores. Simply put, NEXT X has no weight over NEXT SQR(-1), and likewise with this strange "." functionality, which it recognizes simply as "0" NEXT.END is the same code as NEXT 0 END. spaceturtles spaceturtles Video Games I like to play video games! Hobbies Avatar Block I didn't change my avatar for 30 days. Website Intermediate Programmer I can make programs, but I still have trouble here and there. Programming Strength So something similar applies to "TO.STEP" too? MZ952 MZ952 Intermediate Programmer I can make programs, but I still have trouble here and there. Programming Strength Drawing I like to draw! Hobbies Reading I like to read books! Hobbies Yes. TO.STEP is the same as TO 0 STEP. Y_ack Y_ack Which I'd like to note is a useful golfing trick... when used that way. Since the rest of this code ISN'T condensed, it's just meaningless cuteness/obfuscation. MZ952 MZ952 Intermediate Programmer I can make programs, but I still have trouble here and there. Programming Strength Drawing I like to draw! Hobbies Reading I like to read books! Hobbies I couldn't help but notice your use of periods in the code. I had no idea that was legal syntax. I can understand a single period being interpreted as a 0 in the for loop, but . . . "NEXT.END"? spaceturtles spaceturtles Video Games I like to play video games! Hobbies Avatar Block I didn't change my avatar for 30 days. Website Intermediate Programmer I can make programs, but I still have trouble here and there. Programming Strength Also "TO.STEP". How? MZ952 MZ952 Intermediate Programmer I can make programs, but I still have trouble here and there. Programming Strength Drawing I like to draw! Hobbies Reading I like to read books! Hobbies Never mind, I figured it out lol.