Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #==============================================================
- # http://thiagodd.blogspot.com.br
- # [TSDA] Custom Window
- # --> Version 1.2
- # by thiago_d_d
- #
- #--------------------------------------------------------------
- # * Features
- #--------------------------------------------------------------
- # + Adds an windows to the map that can show up to 2 variables
- # value. That windows is customizable.
- #--------------------------------------------------------------
- # * Configuration
- #--------------------------------------------------------------
- # Edit lines below.
- #==============================================================
- module TSDA
- #Swicth that activates the HUD
- HUD_SWITCH_ID = 1
- #Variables text
- HUD_TEXT1 = "Var1: "
- HUD_TEXT2 = "Var2: "
- #ID of variables that will be shown
- # Put 0 on VAR2_ID if you don't want to show an second variable.
- VAR1_ID = 1
- VAR2_ID = 2
- #Text Font
- HUD_FONTNAME = "Tahoma"
- HUD_FONTSIZE = 18
- #window ipacity
- HUD_OPACITY = 0
- #position and dimension of the window
- HUD_POSX = 0
- HUD_POSY = 0
- HUD_WIDTH = 224
- HUD_HEIGHT = 96
- end
- #--------------------------------------------------------------
- class Window_S_HUD < Window_Base
- include TSDA
- def initialize
- super(HUD_POSX,HUD_POSY,HUD_WIDTH,HUD_HEIGHT)
- self.contents = Bitmap.new(width - 32, height - 32)
- self.contents.font.name = HUD_FONTNAME
- self.contents.font.size = HUD_FONTSIZE
- self.back_opacity = HUD_OPACITY
- self.opacity = HUD_OPACITY
- @var1 = $game_variables[VAR1_ID]
- @var2 = $game_variables[VAR2_ID]
- self.visible = $game_switches[HUD_SWITCH_ID]
- refresh
- end
- #------------------------------------------------------------
- def update
- super
- if @var1 != $game_variables[VAR1_ID] ||
- @var2 != $game_variables[VAR2_ID]
- refresh
- end
- end
- #------------------------------------------------------------
- def refresh
- self.contents.clear
- w1 = self.contents.text_size(HUD_TEXT1).width
- w2 = self.contents.text_size(HUD_TEXT2).width
- self.contents.font.color = system_color
- self.contents.draw_text(0,0,w1,32,HUD_TEXT1)
- self.contents.draw_text(0,32,w2,32,HUD_TEXT2)
- self.contents.font.color = normal_color
- self.contents.draw_text(w1 + 4,0,194 - w1,32,
- @var1.to_s)
- if VAR2_ID != 0
- self.contents.draw_text(w2 + 4,32,194 - w2,32,
- @var2.to_s)
- end
- end
- end
- #--------------------------------------------------------------
- class Scene_Map
- include TSDA
- alias old_update_hud_s update
- def update
- old_update_hud_s
- @window_hud_s.visible =
- $game_switches[HUD_SWITCH_ID]
- @window_hud_s.update
- end
- #------------------------------------------------------------
- alias old_main_hud_s main
- def main
- @window_hud_s = Window_S_HUD.new
- old_main_hud_s
- @window_hud_s.dispose
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement