New, simple, fun drawing function

Game Editor comments and discussion.

New, simple, fun drawing function

Postby Hblade » Sat Aug 08, 2015 12:16 am

This function allows you to draw triangles, filled or wired, pentagons, or even circles!
Code: Select all
void drawCircle(int X, int Y, double size, double detail)
{
    double i;
    for(i=-3.14159;i<3.14159;i+=3.14159/(detail/2))
    {
        moveto(X+cos(1.570795+(i))*size, Y+sin(1.570795+(i))*size);
        lineto(X+cos(1.570795+(i+(3.14159/detail*2)))*size, Y+sin(1.570795+(i+(3.14159/detail*2)))*size);
    }
}

void drawFilledCircle(int X, int Y, double size, double detail)
{
    double i, i2;
    for(i2=0;i2<size;i2+=1)
    {
        for(i=-3.14159;i<3.14159;i+=3.14159/(detail/2))
        {
            moveto(X+cos(1.570795+(i))*i2, Y+sin(1.570795+(i))*i2);
            lineto(X+cos(1.570795+(i+(3.14159/detail*2)))*i2, Y+sin(1.570795+(i+(3.14159/detail*2)))*i2);
        }
    }
}


Place this in Global Code.

To use:
Make a canvas, and in draw actor, choose rather you want filled or non-filled.
Code: Select all
erase(0, 0, 0, 1);
setpen(255, 255, 255, 0, 1);
drawFilledCircle(xmouse, ymouse, 166, 4);


^ The following will draw a diamond around the mouse the size of 166 pixels each side.

Usage:
drawCircle(X, Y, Size, Detail);

same with filled

Screenshots:
s1.png

s2.png

s3.png

s4.png
Subscribe to my YouTube? - Yes| No
User avatar
Hblade
 
Posts: 4455
Joined: Fri Dec 08, 2006 11:14 pm
Score: 181 Give a positive score

Re: New, simple, fun drawing function

Postby bat78 » Sun Aug 09, 2015 3:14 am

Nigh a day after I released several functions for drawing n-polygon, Hblade decided to release the same function, coded in a different way.
A way, I totally assume is a sheer example of write-only code.

While I do believe in coincidences.. I also believe in logic. And now I believe on both lacking.
My topic has been seen and as far as I know Hblade is the only person capable to understand what is actually happening in geometric drawing functions.
(Jointly LcL, but his online status is rather controversial)

On another note, that way of filling is evidently unmercifully inefficient and fps-destructive (Depending on one's requirements of course).
The fastest way is to use horizontal line from x to x2. But that's just a note.
The future of "Game-Editor" here
User avatar
bat78
 
Posts: 816
Joined: Sun Dec 14, 2008 9:13 pm
Location: Bulgaria, Sofia
Score: 88 Give a positive score

Re: New, simple, fun drawing function

Postby Hblade » Sun Aug 09, 2015 3:12 pm

You released one? Lol that is coincidence then. And eh, I'm not really the best coder, but honestly I don't want to be :P I was just bored, my arms finally healed enough for me to use computer again and program a bit, so I made this.

I'll check yours out bat =D
Subscribe to my YouTube? - Yes| No
User avatar
Hblade
 
Posts: 4455
Joined: Fri Dec 08, 2006 11:14 pm
Score: 181 Give a positive score

Re: New, simple, fun drawing function

Postby bat78 » Sun Aug 09, 2015 10:23 pm

It is dangerous to release something with the title "New, simple, fun drawing function" while better approaches of the same thing are already available and even further - available from most recent times.

You are a moderator and doing this, so untimely without doing a research is discrediting people.

Also, I wasn't discussing your coding skills, Hblade. I was discussing your code.
I've seen very good developers showing a very damn bad code and the opposite too.

The reason I cannot make a full review of your code is because this is a time abuse.
I already did that in the topic of mine. What I like about your code is that it is short. Sadly, it isn't meant to be that short.
Using PascalCase naming for everything, including non-std function is ..weird somehow.
See? The only things of my review I can relate to your code that doesn't apply to my versions.
So that's what I mean.
The future of "Game-Editor" here
User avatar
bat78
 
Posts: 816
Joined: Sun Dec 14, 2008 9:13 pm
Location: Bulgaria, Sofia
Score: 88 Give a positive score

Re: New, simple, fun drawing function

Postby Hblade » Mon Aug 10, 2015 4:39 am

How is it dangerous? I never claimed anybody elses to be bad, and well.. it IS new in a way. I don't know why I'd have to research if someone else already done this or not, as it doesn't really matter tbh, this was just for fun.

And yeah, code is short :D
Subscribe to my YouTube? - Yes| No
User avatar
Hblade
 
Posts: 4455
Joined: Fri Dec 08, 2006 11:14 pm
Score: 181 Give a positive score

Re: New, simple, fun drawing function

Postby bat78 » Mon Aug 10, 2015 5:23 am

What doesn't mater O_o
The future of "Game-Editor" here
User avatar
bat78
 
Posts: 816
Joined: Sun Dec 14, 2008 9:13 pm
Location: Bulgaria, Sofia
Score: 88 Give a positive score

Re: New, simple, fun drawing function

Postby Hblade » Mon Aug 10, 2015 4:10 pm

Researching O: Since it's kind of my own method, and it was out of boredom and just for fun lol. Even if it has been done already, doesn't matter xD
Subscribe to my YouTube? - Yes| No
User avatar
Hblade
 
Posts: 4455
Joined: Fri Dec 08, 2006 11:14 pm
Score: 181 Give a positive score

Re: New, simple, fun drawing function

Postby bat78 » Mon Aug 10, 2015 4:48 pm

Well that actually depends. Now interested users have to waste time and efforts in searching the forums for the best / or suitable / method.. They may or may not find the best as there is no rate system.
Get what I mean ?

If I am the only one concerned of the quality of the imminent game-editor projects.. then just go on, do whatever you like.
I will be creating my own Game-Editor and I shall stop "toying with kids".. it is getting way too exhausting.
0% Appreciation when destroying fun in the name of quality and professionalism (which was dominating years ago).

But what is done - it's done and cannot be undone.
Well done.
The future of "Game-Editor" here
User avatar
bat78
 
Posts: 816
Joined: Sun Dec 14, 2008 9:13 pm
Location: Bulgaria, Sofia
Score: 88 Give a positive score

Re: New, simple, fun drawing function

Postby Hblade » Mon Aug 10, 2015 5:18 pm

Regardless of who gets annoyed or not, I'll continue doing things the way I know how, the way I've been doing them. Not exactly sure if I was just insulted or not, but it bares no emotional effect on me either way, and good luck with your game editor. I'll stick the one I know and love however, and I hardly see how game-editor is falling, it's not falling, it's just the program just doesn't visually appeal to people as much as it should. To me it's nice.. I enjoy game-editor, and I enjoy making little things in it. As for a main project, well, that depends.
Subscribe to my YouTube? - Yes| No
User avatar
Hblade
 
Posts: 4455
Joined: Fri Dec 08, 2006 11:14 pm
Score: 181 Give a positive score

Re: New, simple, fun drawing function

Postby bat78 » Tue Aug 11, 2015 12:49 am

Nothing was meant to insult you.
I am just speaking professionally.. a concept lacking in most of you.

For you, Game-Editor is entertainment, not a business.
So I am leaving you with this semi-dead gE.. good luck.
The future of "Game-Editor" here
User avatar
bat78
 
Posts: 816
Joined: Sun Dec 14, 2008 9:13 pm
Location: Bulgaria, Sofia
Score: 88 Give a positive score

Re: New, simple, fun drawing function

Postby DeltaLeeds » Tue Aug 11, 2015 2:10 am

Hblade wrote:Regardless of who gets annoyed or not, I'll continue doing things the way I know how, the way I've been doing them. Not exactly sure if I was just insulted or not, but it bares no emotional effect on me either way, and good luck with your game editor. I'll stick the one I know and love however, and I hardly see how game-editor is falling, it's not falling, it's just the program just doesn't visually appeal to people as much as it should. To me it's nice.. I enjoy game-editor, and I enjoy making little things in it. As for a main project, well, that depends.


HBlade, I'd like to say that making little things for gE is what enables gE to be much more customizable for newbies and programmers alike. Attempting to make huge serious projects or those stuff in gE is hopeless; How many huge and serious projects have succeeded in our small community: Almost none! Stick with the gE most of us know and love, don't leave it! ;)

I really appreciate the code, it makes me learn a lot about the for function! (Well, I know it already, but making it into a simple function, and drawing a circle out of it, I did not know. ;)) +1 for the useful code!

bat78 wrote:For you, Game-Editor is entertainment, not a business.
So I am leaving you with this semi-dead gE.. good luck.

This is game editor, not stack overflow. This is a game making engine that wants to make people's game making dreams come true, not limit people with amazing C programming skill to use. Successful game making engines are game engines that can make awesome games that doesn't require much programming skill to use, and please learn to accept this. I bet even crossy roads has less programming skill required than Winter Blast!

bat78 wrote:Using PascalCase naming for everything, including non-std function is ..weird somehow.
See? The only things of my review I can relate to your code that doesn't apply to my versions.
So that's what I mean.

If people learn from simpler codes, they learn more, if people learn from complex code that perhaps only a limited amount of people understand, they get nothing.

P.S: Please start an argument in private chat Bat, don't make the forums look bad.
Currently: Semi-Active.
Working on: Maybe putting my test games in gamejolt, polishing them a bit, but I still don't know when.
User avatar
DeltaLeeds
 
Posts: 693
Joined: Fri May 06, 2011 12:45 pm
Location: In front of my computer.
Score: 38 Give a positive score

Re: New, simple, fun drawing function

Postby bat78 » Tue Aug 11, 2015 4:02 am

And yet you up-voted his awfully-coded function instead of mine, clearly better coded doing the same thing.
You haven't even seen mine, this is what I was talking about. See this in action!

Also, Game-Editor will never even be good without skills in C.
Moreover, Game-Editor will never progress without "supreme skills in C"
And supreme games are not possible without skills in C.
So do me a favor.. and take your words back.

..and "for" isn't a function.
Last edited by bat78 on Tue Aug 11, 2015 4:13 am, edited 1 time in total.
The future of "Game-Editor" here
User avatar
bat78
 
Posts: 816
Joined: Sun Dec 14, 2008 9:13 pm
Location: Bulgaria, Sofia
Score: 88 Give a positive score

Re: New, simple, fun drawing function

Postby DeltaLeeds » Tue Aug 11, 2015 4:13 am

bat78 wrote:And yet you up-voted his awfully-coded function instead of mine, clearly better coded doing the same thing.
You haven't even seen mine, this is what I was talking about. See this in action!

..and "for" isn't a function.

Alright sorry! I mean "function of "for"" not "for function". My bad. :oops:

And if you meant the circle from the quiz you gave us, it's not as customizable as this, even if it is, it's not as clear as this code, so saying this code is awful, it an awful thing to say. HBlade tried, and got the job done right, not perfectly, but it's right.

bat78 wrote:So do me a favor.. and stop expressing your own personal opinion as the greatest.


Just to point out, you've been the one doing this, not me. Peace out.
Last edited by DeltaLeeds on Tue Aug 11, 2015 4:14 am, edited 1 time in total.
Currently: Semi-Active.
Working on: Maybe putting my test games in gamejolt, polishing them a bit, but I still don't know when.
User avatar
DeltaLeeds
 
Posts: 693
Joined: Fri May 06, 2011 12:45 pm
Location: In front of my computer.
Score: 38 Give a positive score

Re: New, simple, fun drawing function

Postby bat78 » Tue Aug 11, 2015 4:14 am

I DONT MEAN THE CIRCLE FROM THE QUIZ ??
viewtopic.php?f=27&t=13657
eh..

Hblade's approach is awfully unclear and 20 times slower.
Also the real function is called npolygon not circle. He is indeed bad in basic geometry as well O_O
Last edited by bat78 on Tue Aug 11, 2015 4:17 am, edited 2 times in total.
The future of "Game-Editor" here
User avatar
bat78
 
Posts: 816
Joined: Sun Dec 14, 2008 9:13 pm
Location: Bulgaria, Sofia
Score: 88 Give a positive score

Re: New, simple, fun drawing function

Postby DeltaLeeds » Tue Aug 11, 2015 4:15 am

bat78 wrote:I DONT MEAN THE CIRCLE OMG

Alright, then at least show me the thread you are talking about in the argument. And don't use caps, it scares me. :oops: :lol:
EDIT: Alright, you post fast. :lol:
Currently: Semi-Active.
Working on: Maybe putting my test games in gamejolt, polishing them a bit, but I still don't know when.
User avatar
DeltaLeeds
 
Posts: 693
Joined: Fri May 06, 2011 12:45 pm
Location: In front of my computer.
Score: 38 Give a positive score

Next

Return to GE - General

Who is online

Users browsing this forum: No registered users and 1 guest

cron