Submit Your Article


 
RPG Maker

Welcome Guest ( Log In | Register )


  Games Resources RPG Maker VX RPG Maker XP Scripts Tutorials Downloads

> 


———
Before you ask! Read! ;)

You must have 30+ Posts to create a topic here!

Thanks for reading!
———

 
Reply to this topicStart new topic
> Draw Circles into Bitmap Class.
Feoden
post Feb 18 2012, 06:55 AM
Post #1


Level 5
Group Icon

Group: Member
Posts: 66
Type: Scripter
RM Skill: Skilled




Hello again. This time I need a script that allows to draw a circle (or at least, a part of it) into the contents of a window.

It would be better if it could be used in this way:

class Bitmap
def draw_circle/arc (starting_x, starting_y, ending_x, ending_y, radius, direction, line_width)

another method could be like this:

def draw_circle/arc (starting_x, starting_y, ending_x, ending_y, center_x, center_y, width)

However since I think it is difficult, I would appreciate anything that allows to draw circular arcs in any way (I Just NEED to be able to change the width of the line)


__________________________
- Drown into eyes while they're still blind... -

Go to the top of the page
 
+Quote Post
   
Feoden
post Feb 24 2012, 07:08 AM
Post #2


Level 5
Group Icon

Group: Member
Posts: 66
Type: Scripter
RM Skill: Skilled




Uhm this one was quite easy to find out on my own....
If anyone needed the code this is it:
CODE
def draw_circle(x,y,radius,width,teta0=0,teta1=2*Math::PI,color=Color.new(0,0,0))
    #2pi * radius should be enough but 8 is more than enough to have the circle DENSELY filled.
    intervals = radius*8
    each = (teta1-teta0).to_f / intervals
    for j in 0...width
      rad = radius + j - width/2
      for i in 0...intervals
        angle = (i * each + teta0)
        x_pos = Math.cos(angle) * rad + x
        y_pos = -Math.sin(angle) * rad + y
        self.fill_rect(x_pos, y_pos, 1,1, color)
      end
    end
  end


enjoy it! I have used it to draw sphere grid lines happy.gif

This post has been edited by Feoden: Feb 24 2012, 07:08 AM


__________________________
- Drown into eyes while they're still blind... -

Go to the top of the page
 
+Quote Post
   

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 

Lo-Fi Version Time is now: 19th June 2013 - 10:18 AM
RPG RPG Revolution is an Privacy Policy and Legal
eXTReMe Tracker