mirror of
https://github.com/infinitefusion/infinitefusion-e18.git
synced 2025-12-11 15:15:00 +00:00
More characters customization
This commit is contained in:
@@ -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
|
||||
@@ -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
|
||||
Reference in New Issue
Block a user