Jump to content
New account registrations are disabed. This website is now an archive. Read more here.

Recommended Posts

Who here thinks that it would be a good idea to add on to the built in RGSS classes such as bitmap. Well, I'm starting doing it. So far I have added in several RGSS2 bitmap functions missing from RGSS.

 

Functions completed:

 

Bitmap:

draw_gradient(rectangle, color1, color2, gradient_type[, subtype])

rectangle - rectangle in which to draw gradient

color1, color2 - starting and ending colors

gradient_type:

0 - horizontal, 1 - vertical, 2 - diagonal, 3 - radial

subtype - for diagonal:

0 - top-left to bottom-right, 1 - top-right to bottom-left

- this method is very laggy, especially with anything other than horizontal or vertical

 

draw_circle(rectangle, color[, border, border_size, border_color])

rectange - rectangle in which to draw circle

color - color of the circle

border - whether to draw a border (default false)

border_size - how large the border is (default 0)

border_color - color of the border (default black)

- this method doesn't lag as much as the gradient, but it still lags

 

blur

- this method only lags a bit compared to the other functions

 

sharpen

- this method lags a little more than blur

 

draw_line(x1, y1, x2, y2, color[, width])

x1, y1, x2, y2 - starting and ending coordinates of line

color - color in which to draw the line

width - thickness of the line

Share this post


Link to post
Share on other sites

what you figured out how to get blur and sharpen to work. happy.png Cool.

I've actually found a better way to draw a line in Window_base without having to write in bitmap.

class Window_Base
def draw_horz_line(y)
 line_y = y + 24 / 2 - 1
 self.contents.fill_rect(x, y width, height, line_color)
end
def draw_vert_line(x,y)
 line_y = y + 24 / 2 - 1
 line_x = x + 24 / 2 - 1
 self.contents.fill_rect(x, y width, height, line_color)
end
def line_color
 color = normal_color
 color.alpha = 192
 return color
end
end

 

And it's alot shorter then what bitmap does, unless you got it in a shorter version?

Share this post


Link to post
Share on other sites

*shakes head in despair

Mine can draw lines of any slope. And there's a simple formula for blur. You just set each pixel to the average of surrounding pixels.

Share this post


Link to post
Share on other sites

Sounds cool, when are you going to release it?

 

Is it all programmed in ruby?

I do have concerns about the blur/sharpen or any other algorithm that would require pixel-by-pixel manipulation.

 

I'm actually very interested in some profiling stats: how long does it take to blur a full 640x480 bitmap?

 

While it's a good idea, I do believe it to be useless in games if it causes lag. That was the reason I dropped my version of the blur algorithm -> It worked, but lagged too hard. Unfortunately, Ruby was not designed for manipulating graphics.

 

However, if your blur algorithm can blur 640x480 bitmap in less than a frame's worth of time, that would be pretty awesome.

 

And, you'd be my hero if you are actually cracking open the RGSS dll and adding the functions that way.

Share this post


Link to post
Share on other sites

Sorry, I'm trying to convert my code over to Win32API, but its not working very well. Right now it's just in ruby.

Share this post


Link to post
Share on other sites

oh, don't be sorry, I was just curious. My blur implementation was PAINFULLY slow, even on small bitmaps; yours sounds a little more usable and I was curious on the specific statistics.

 

If you get something usable going, I'm sure the community would find it very useful.

Share this post


Link to post
Share on other sites

I'll try some tests to see how they can be used ingame. I'm already working on making constantly changing gradient health bars on the map. I'll let you know when I get something cool working.

Share this post


Link to post
Share on other sites

Did you ever find the gradient_fill_rect(x, y, width, height, color1, color2[, vertical]) method as I need that for a script and it would be nice if anyone has seen or written already to save the trouble.

Share this post


Link to post
Share on other sites

That's one of them there's actually two unless you set it to an *argument. gradient_fill_rect(x, y, width, height, color1, color2[, vertical]) gradient_fill_rect(rect, color1, color2[, vertical]) You have the latter posted, and I need the first one.

Share this post


Link to post
Share on other sites

can't you just make a rectangle using the parameters?

 

Rect.new(x, y, width, height)

Share this post


Link to post
Share on other sites

Just a quick update on the progress of this project. I am almost ready to release version 1.0 of RGSS Addon. I have successfully ported most of the code to a dll to speed it up and have created corresponding ruby functions.

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...