Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #=========================================================
- # Classe Text
- #---------------------------------------------------------
- # Mostra um texto definido em tempo de execução
- #---------------------------------------------------------
- # * Adicione um comando de evento Chamar Script com os
- # parâmetros a seguir:
- #
- # text = <seu texto aqui>
- # $systxt = Text.new(x,y,w,h,text)
- #
- # * Substitua X,Y,W e H por suas respectivas cordenadas de
- # tela.
- #
- #=========================================================
- class Text < Sprite
- #====================================
- # Initialize
- #------------------------------------
- # * Inicializa a sprite
- # * Cria uma bitmap
- # * Seta o texto e a posição na bitmap
- #====================================
- def initialize(x,y,w,h,text)
- super(nil)
- @text = text
- self.bitmap = Bitmap.new(w,h)
- self.bitmap.draw_text(0,0,w,h,text)
- self.x = x
- self.y = y
- end
- #====================================
- # Update
- #------------------------------------
- # * Atualiza a Sprite
- #====================================
- def update
- super
- end
- #====================================
- # Dispose
- #------------------------------------
- # * Dispõe a sprite
- #====================================
- def dispose
- super
- end
- #====================================
- # Change Text
- #------------------------------------
- # * Muda o texto da bitmap
- # * Muda a posição da bitmap
- #====================================
- def change_text(x,y,w,h,text)
- self.bitmap.clear
- self.bitmap = Bitmap.new(w,h)
- self.bitmap.draw_text(0,0,w,h,text)
- self.x = x
- self.y = y
- end
- end
- #=========================================================
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement