More characters customization

This commit is contained in:
chardub
2025-04-27 12:17:35 -04:00
parent 4a19fbc754
commit 6536fcda77
10 changed files with 333 additions and 55 deletions

View File

@@ -0,0 +1,14 @@
# frozen_string_literal: true
class IconSprite
def setBitmapDirectly(bitmap)
oldrc = self.src_rect
clearBitmaps()
@name = ""
return if bitmap == nil
@_iconbitmap = bitmap
# for compatibility
#
self.bitmap = @_iconbitmap ? @_iconbitmap.bitmap : nil
self.src_rect = oldrc
end
end

View File

@@ -0,0 +1,33 @@
# frozen_string_literal: true
module RPG
module Cache
def self.load_bitmap_path(path, hue = 0)
cached = true
ret = fromCache(path)
if !ret
if path == ""
ret = BitmapWrapper.new(32, 32)
else
ret = BitmapWrapper.new(path)
end
@cache[path] = ret
cached = false
end
if hue == 0
ret.addRef if cached
return ret
end
key = [path, hue]
ret2 = fromCache(key)
if ret2
ret2.addRef
else
ret2 = ret.copy
ret2.hue_change(hue)
@cache[key] = ret2
end
return ret2
end
end
end