View difference between Paste ID: TURDqJaN and vEkrFVB8
SHOW: | | - or go back to the newest paste.
1
module GI_Colors
2
	COLORS = {
3
	#------------------------------
4
	# Insira novas cores aqui
5
	#------------------------------
6-
# * Adicione um comando de evento Chamar Script com os 
6+
	# "nome da cor" => Color.new(Valor RGB),
7
	#
8
	# Não esqueça da virgula.
9
	#------------------------------
10
        "clWhite" => Color.new(255,255,255),
11-
# 
11+
	"clBlack" => Color.new(0,0,0)				
12-
# * Substitua X,Y,W e H por suas respectivas cordenadas de 
12+
13
	#...
14
	#------------------------------
15
	}	
16
17
end
18
19-
	# Initialize
19+
20-
	#------------------------------------
20+
21-
	# * Inicializa a sprite
21+
22-
	# * Cria uma bitmap
22+
23-
	# * Seta o texto e a posição na bitmap
23+
24
# * Adicione um comando de evento Chamar Script com os
25-
	def initialize(x,y,w,h,text)
25+
26-
		super(nil)
26+
27
# text = <seu texto aqui>
28-
		self.bitmap = Bitmap.new(w,h)
28+
29-
		self.bitmap.draw_text(0,0,w,h,text)
29+
30-
		self.x = x
30+
# * Substitua X,Y,W e H por suas respectivas cordenadas de
31-
		self.y = y	
31+
32-
	end
32+
33
#=========================================================
34
class Text < Sprite
35-
	# Update
35+
	attr_accessor :font_color
36-
	#------------------------------------
36+
        attr_accessor :font_name
37-
	# * Atualiza a Sprite
37+
	attr_accessor :text
38
		
39-
	def update
39+
        #====================================
40-
		super	
40+
        # Initialize
41-
	end
41+
        #------------------------------------
42
        # * Inicializa a sprite
43
        # * Cria uma bitmap
44-
	# Dispose
44+
        # * Seta o texto e a posição na bitmap
45-
	#------------------------------------
45+
        #====================================
46-
	# * Dispõe a sprite
46+
        def initialize(x,y,w,h,text)
47
                super(nil)
48-
	def dispose
48+
49-
		super
49+
                self.bitmap = Bitmap.new(w,h)
50-
	end
50+
                self.bitmap.draw_text(0,0,w,h,text)
51
                self.x = x
52
                self.y = y    
53-
	# Change Text
53+
		@font_name = self.bitmap.font.name
54-
	#------------------------------------
54+
		@font_color = 'clWhite'
55-
	# * Muda o texto da bitmap
55+
        end
56-
	# * Muda a posição da bitmap
56+
        		
57
	#====================================
58-
	def change_text(x,y,w,h,text)
58+
        # Update
59-
		self.bitmap.clear
59+
        #------------------------------------
60-
		self.bitmap = Bitmap.new(w,h)
60+
        # * Atualiza a Sprite
61-
		self.bitmap.draw_text(0,0,w,h,text)
61+
        #====================================
62-
		self.x = x
62+
        def update
63-
		self.y = y		
63+
		self.text = @text
64-
	end
64+
		self.font_color = @font_color
65
		self.font_name = @font_name
66
                super  
67
        end
68
       
69
        #====================================
70
        # Dispose
71
        #------------------------------------
72
        # * Dispõe a sprite
73
        #====================================
74
        def dispose
75
                super
76
        end
77
       
78
        #====================================
79
        # Change Text
80
        #------------------------------------
81
        # * Muda o texto da bitmap
82
        # * Muda a posição da bitmap
83
        #====================================
84
        def change_text(x,y,w,h,text)
85
                self.bitmap.clear
86
                self.bitmap = Bitmap.new(w,h)
87
		@text = text
88
                self.bitmap.draw_text(0,0,w,h,text)
89
                self.x = x
90
                self.y = y             
91
        end
92
		
93
        #====================================
94
        # Change Font
95
        #------------------------------------
96
        # * Muda a fonte do texto da bitmap
97
        #====================================
98
        def change_font(name,color)
99
                self.bitmap.font.name = name
100
		self.bitmap.font.color = GI_Colors::COLORS[color]
101
                @font_name = name
102
		@font_color = GI_Colors::COLORS.index(self.bitmap.font.color)
103
        end
104
       
105
end
106
#=========================================================