class Sprite_States_Icon < Sprite
def initialize(actor, x, y, view_area)
super(view_area)
@back = Sprite.new(view_area)
@back.bitmap = Cache.system("Statebox.png")
@back.opacity = 128
[url=home.php?mod=space&uid=95897]@actor[/url] = actor
@states = []
self.bitmap = Bitmap.new(24 * 4, 24)
self.x = x
self.y = y
@back.x = x
@back.y = y
@back.z = 200
update
end
def update
return if @states == @actor.states
self.bitmap.clear
count = 0
@states = @actor.states
for state in @actor.states
draw_icon(state.icon_index, x + 24 * count, y)
count += 1
break if (24 * count > width - 24)
end
end
def draw_icon(icon_index, x, y, enabled = true)
bitmap = Cache.system("Iconset")
rect = Rect.new(icon_index % 16 * 24, icon_index / 16 * 24, 24, 96)
self.bitmap.blt(0, 0, bitmap, rect, enabled ? 255 : 128)
end
class Sprite_States_Icon < Sprite
def initialize(actor, x, y, view_area)
super(view_area)
@back = Sprite.new(view_area)
@back.bitmap = Cache.system("Statebox.png")
@back.opacity = 128
[url=home.php?mod=space&uid=95897]@actor[/url] = actor
@states = []
self.bitmap = Bitmap.new(24 * 4, 24)
self.x = x
self.y = y
@back.x = x
@back.y = y
@back.z = 200
update
end
def update
return if @states == @actor.states
self.bitmap.clear
count = 0
@states = @actor.states
for state in @actor.states
draw_icon(state.icon_index, x + 24 * count, y)
count += 1
break if (24 * count > width - 24)
end
end
def draw_icon(icon_index, x, y, enabled = true)
bitmap = Cache.system("Iconset")
rect = Rect.new(icon_index % 16 * 24, icon_index / 16 * 24, 24, 96)
self.bitmap.blt(0, 0, bitmap, rect, enabled ? 255 : 128)
end