Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # rbGooey. -- Game GUI library to be used with rubygame
- # Copyright (C) 2006 Han 'kiba' Dao
- #
- # This library is free software; you can redistribute it and/or
- # modify it under the terms of the GNU Lesser General Public
- # License as published by the Free Software Foundation; either
- # version 2.1 of the License, or (at your option) any later version.
- #
- # This library is distributed in the hope that it will be useful,
- # but WITHOUT ANY WARRANTY; without even the implied warranty of
- # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- # Lesser General Public License for more details.
- #
- # You should have received a copy of the GNU Lesser General Public
- # License along with this library; if not, write to the Free Software
- # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- #Class TextRender handle the TextRender tasks. It also formed the foundation for entire text library for the RbGooey. This include the TextInput class.
- class TextRender
- def initialize main , textmode
- @main = main
- @text = textmode
- end
- def render_text
- # This method render the texts array one by one
- y_value = 0
- default = nil
- skip = @main.font.line_skip
- @text.text.zip(@text.size,@text.x,@text.y,@text.report).each do |string , size , x , y , report|
- font = TTF.new("#{@main.fname}",size)
- if @text.omit == false
- render = font.render("#{[string]}",true,@text.fgcolor,@text.bgcolor)
- elsif @text.omit == true
- render = font.render("#{[string]}",true,@text.fgcolor)
- end
- render.blit(@main.screen,[x,y+=y_value])
- if report == 1
- puts report
- @text.textsprite.add(x,y,render)
- end
- y_value+= skip
- end
- end
- def screen_clear
- @main.background.blit(@main.screen, [0,0])
- end
- def update
- #This update the screen
- @main.screen.flip()
- end
- end
Add Comment
Please, Sign In to add comment