Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Bitmap
- def initialize(param1, param2 = 0)
- @filepath = ''
- @width = 0
- @height = 0
- if param2 == 0
- prefix = ".png"
- if !FileTest.exist?("#{param1}#{prefix}")
- prefix = ".jpg"
- end
- @filepath = "#{param1}#{prefix}"
- size = Graphics.load_texture(@filepath)
- @width = size[0]
- @height = size[1]
- else
- @width = param1
- @height = param2
- end
- @draws = []
- @font = Font.new
- @text_size = TextSize.new
- end
- def filepath
- @filepath
- end
- def clear
- p "LIMPOI"
- draws.each{|draw|;
- draw = nil
- }
- @draws = []
- end
- def newDraw(draw)
- @draws = [] if @draws.nil?
- @draws.push(draw)
- end
- def draws
- @draws
- end
- def fill_rect(rect, color)
- end
- def fill_rect(x = 0, y = 0, width = 0, height = 0, color = Color.new(250,250,250))
- end
- def draw_text(param1, param2, param3, param4 = 0, param5 = "", center = 0, bold = false, underlined = false, regular = false, italic = false)
- if param4 == 0
- Draw.new(self, Graphics::DRAW_TYPE_TEXT, param1.x, param1.y, param1.width, param1.height, "", Rect.new(0,0,0,0), self.font.color, param2, 14)
- else
- Draw.new(self, Graphics::DRAW_TYPE_TEXT, param1, param2, param3, param4, "", Rect.new(0,0,0,0), self.font.color, param5, 14)
- end
- end
- #def draw_text(rect, text, center)
- # Draw.new(self, Graphics::DRAW_TYPE_TEXT, rect.x, rect.y, rect.width, rect.height, "", Rect.new(0,0,0,0), self.font.color, text)
- #end
- def rect
- Rect.new(0,0,0,0)
- end
- def blt(x, y, bitmap, rect)
- return if bitmap.filepath.size <= 1
- p bitmap
- Draw.new(self, Graphics::DRAW_TYPE_NORMAL, x, y, self.width, self.height, bitmap.filepath, rect)
- end
- def width
- @width
- end
- def width=(v)
- @width = v
- end
- def height
- @height
- end
- def height=(v)
- @height = v
- end
- def font
- @font
- end
- def font=(v)
- @font = v
- end
- def text_size(str)
- @text_size
- end
- def gradient_fill_rect(temp_rect = nil, back_color2 = nil, back_color1 = nil)
- end
- end
- class Draw
- def initialize(bitmap, type = 0, x = 0, y = 0, width = 0, height = 0, filepath = '', rect = Rect.new(0,0,0,0), color = Color.new(255,255,255,255), text = "", size = 14)
- @type = type
- @x = x
- @y = y
- @r = color.red
- @g = color.green
- @b = color.blue
- @a = color.alpha
- @text = text
- @size = size
- if @type == 0
- p filepath
- end
- @filepath = filepath
- @rect = rect
- bitmap.newDraw(self)
- end
- def type
- @type
- end
- def x
- @x
- end
- def y
- @y
- end
- def r
- @r
- end
- def g
- @g
- end
- def b
- @b
- end
- def a
- @a
- end
- def filepath
- @filepath
- end
- def rect
- @rect
- end
- def text
- @text
- end
- def size
- @size
- end
- def bold
- 0
- end
- def underlined
- 0
- end
- def italic
- 0
- end
- def regular
- 0
- end
- end
- class TextSize
- def initialize
- @height = 0
- @width = 0
- end
- def height
- @height
- end
- def width
- @width
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement