Advertisement
Guill

Class Text

Jun 23rd, 2013
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 0.79 KB | None | 0 0
  1. #=========================================================================
  2. # Classe Text
  3. #-------------------------------------------------------------------------
  4. # Cole o código abaixo no chamar evento
  5. #
  6. # txt = "texto que você quer mostrar"
  7. # $txt = Text.new(x,y,w,h,txt)
  8. #
  9. # Substitua x,y,w e h pelas cordenadas x e y da tela, a largura e a altura. Respectivamente.
  10. #=========================================================================
  11. class Text < Sprite
  12.     def initialize(x,y,w,h,txt)
  13.         super(nil)
  14.         self.bitmap = Bitmap.new(w,h)
  15.         self.bitmap.draw_text(0,0,w,h,txt)
  16.         @x = x
  17.         @y = y
  18.     end
  19.     def update
  20.         super
  21.         self.x = @x
  22.         self.y = @y
  23.     end
  24.     def dispose
  25.         self.bitmap.clear
  26.         super
  27.     end
  28. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement