本帖最后由 jhhuang 于 2017-7-7 21:44 编辑
滤镜(伪)
随手试写,接受评论,不接受吐槽。
Q键放大,W键缩小。(随手修改默认工程,请勿直接食用)
#encoding:utf-8
#==============================================================================
# ■ Window_Gold
#------------------------------------------------------------------------------
# 显示持有金钱的窗口
#==============================================================================
class Window_Gold < Window_Base
#--------------------------------------------------------------------------
# ● 初始化对象
#--------------------------------------------------------------------------
def initialize
super ( 0 , 0 , 200 , 200 )
@with = 0
@w = 1.0
@h = 1.0
end
#--------------------------------------------------------------------------
# ● 刷新
#--------------------------------------------------------------------------
def refresh
#contents.clear
self .z = -1
bitmap = Graphics.snap_to_bitmap
rect = Rect.new ( 0 , 0 , contents.width , contents.height )
x = ( bitmap.width - contents.width * @w ) / 2
y = ( bitmap.height - contents.height * @h ) / 2
rect2 = Rect.new ( x, y, contents.width * @w , contents.height * @h )
contents.stretch_blt ( rect, bitmap, rect2)
bitmap.dispose
self .z = 100
end
#--------------------------------------------------------------------------
# ● 更新画面
#--------------------------------------------------------------------------
def update
super
@w = @h += 0.1 if Input.repeat ?( :L )
@w = @h -= 0.1 if Input.repeat ?( :R )
@with += 1
if @with % 3 == 0
refresh
@with = 0
end
end
end
class Scene_Map < Scene_Base
#--------------------------------------------------------------------------
# ● 生成所有窗口
#--------------------------------------------------------------------------
def create_all_windows
create_message_window
create_scroll_text_window
create_location_window
@gold_window = Window_Gold.new
end
end
#encoding:utf-8
#==============================================================================
# ■ Window_Gold
#------------------------------------------------------------------------------
# 显示持有金钱的窗口
#==============================================================================
class Window_Gold < Window_Base
#--------------------------------------------------------------------------
# ● 初始化对象
#--------------------------------------------------------------------------
def initialize
super ( 0 , 0 , 200 , 200 )
@with = 0
@w = 1.0
@h = 1.0
end
#--------------------------------------------------------------------------
# ● 刷新
#--------------------------------------------------------------------------
def refresh
#contents.clear
self .z = -1
bitmap = Graphics.snap_to_bitmap
rect = Rect.new ( 0 , 0 , contents.width , contents.height )
x = ( bitmap.width - contents.width * @w ) / 2
y = ( bitmap.height - contents.height * @h ) / 2
rect2 = Rect.new ( x, y, contents.width * @w , contents.height * @h )
contents.stretch_blt ( rect, bitmap, rect2)
bitmap.dispose
self .z = 100
end
#--------------------------------------------------------------------------
# ● 更新画面
#--------------------------------------------------------------------------
def update
super
@w = @h += 0.1 if Input.repeat ?( :L )
@w = @h -= 0.1 if Input.repeat ?( :R )
@with += 1
if @with % 3 == 0
refresh
@with = 0
end
end
end
class Scene_Map < Scene_Base
#--------------------------------------------------------------------------
# ● 生成所有窗口
#--------------------------------------------------------------------------
def create_all_windows
create_message_window
create_scroll_text_window
create_location_window
@gold_window = Window_Gold.new
end
end