Problem when trying to overlap a black color on a background

2 views
Skip to first unread message

Hima

unread,
Dec 31, 2008, 8:58:29 AM12/31/08
to Star Ruby (English)
This is what happen when I was trying to draw a black rectangle with
opacity about 180 on a background

http://img.photobucket.com/albums/v628/himatako/DOTPLUS/starruby_bug.jpg


I was going to make a puzzle game using starruby but turned out I
couldn't because of this issue X( Hope this will be fixed in the next
version!

Hajime Hoshi

unread,
Dec 31, 2008, 9:15:48 AM12/31/08
to starr...@googlegroups.com
Hi, Hima,

2008/12/31 Hima <hima...@gmail.com>:

Thank you for your reporting.
Unfortunately I couldn't understand what is the probrem.

* What code did you execute?
* What image did you use?
* What result did you hope?

Thanks,

--
Hajime Hoshi <hajim...@gmail.com>

Hima

unread,
Dec 31, 2008, 9:56:36 AM12/31/08
to Star Ruby (English)
Oh sorry about me wasn't being clear on the first post. Here's what
I'm trying to do

I want to draw this rectangle
http://img.photobucket.com/albums/v628/himatako/DOTPLUS/spr_blockarea.png

over this background
http://img.photobucket.com/albums/v628/himatako/DOTPLUS/bg_main.png


With the rectangle have an opacity of 200. But the result I got was
this
http://img.photobucket.com/albums/v628/himatako/DOTPLUS/starruby_bug.jpg


This is my code

require "framework/scene_base"
class SceneKurickZum < SceneBase
def initialize
super
@rect_color = Color.new(0,0,0,200)
@play_area = $resource_manager.get_texture("/sprite/
spr_blockarea")
@bg = $resource_manager.get_texture("/back/bg_main")
end

def update
super
end

def draw
super
#Bg Render
@game.screen.render_texture(@bg,0,0)

#Block Area
@game.screen.render_rect(32, 0, 256, 480, @rect_color)
end
end

-----------------------------------------------------------------------------------
I think it's the order of drawing. So I tried adding the black
background to the code like this
#Paint black background on the whole screen
@game.screen.render_rect(0, 0, 640, 480, Color.new(0,0,0,255))

#Bg Render
@game.screen.render_texture(@bg,0,0)

#Block Area
@game.screen.render_rect(32, 0, 256, 480, @rect_color)


And it works.
http://img.photobucket.com/albums/v628/himatako/DOTPLUS/expected_result.jpg


So I guess when StarRuby clear the screen, it doesn't paint the black
background automatically , right? So I guess this is not a
bug...maybe something you should mention in the document :)

Hajime Hoshi

unread,
Dec 31, 2008, 10:46:11 AM12/31/08
to starr...@googlegroups.com
2008/12/31 Hima <hima...@gmail.com>:

Yes, the screen of previous frame remains.
This is the reason why 'previous screen' is sometimes useful.
For example, by Texture#dup or Texture#clone method,
the developer can rerender the screen.

By the way, you can also clear the screen by Texture#clear method:

@game.screen.clear
(instead of @game.screen.render_rect(...))

> So I guess this is not a
> bug...maybe something you should mention in the document :)

Oh, sorry. You just said it.
I'll add it to the document later.

--
Hajime Hoshi <hajim...@gmail.com>

Reply all
Reply to author
Forward
0 new messages