Sha256: 8216ebd31df2b299d9ac01f2ee64623f6294dd6827e2c451d680bcd4f314eba8

Contents?: true

Size: 1.54 KB

Versions: 1

Compression:

Stored size: 1.54 KB

Contents

#Copyright (C) 2007-2008  Han Dao and contributors
#
#This program is free software: you can redistribute it and/or modify
#it under the terms of the GNU General Public License as published by
#the Free Software Foundation, either version 3 of the License, or
#(at your option) any later version.
#
#This program 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 General Public License for more details.
#
#You should have received a copy of the GNU General Public License
#along with this program.  If not, see <http://www.gnu.org/licenses/>.


#PROJECT: Rbgooey
#DESCRIPTION: A GUI library for the rubygame library.
#FUNCTION OF THIS PART: This class deal with text manpluication

class Text
	attr_accessor :ui , :render , :font , :size
	def initialize ui
		@ui = ui
		@render = TextRender.new(@ui)
	end
	#Add a piece of text along with the location
	def add string , x , y , bg = 0
		@ui.string << string
		@ui.name[@ui.status][0] << @ui.string.length - 1
		@ui.name[@ui.status][3] << "text"
		if bg != 0
			@render.render(x,y,bg)
		else
			@render.render(x,y)
		end
	end
	#Text class required a font name to load and the normal size
	def setup font , size
		@font = font
		@size = size
	end
	#Assign certain code when a specific string collide.
	def active &action
		@ui.action << action
		@ui.name[@ui.status][2] << @ui.action.length - 1
		@ui.rect << @ui.name[@ui.status][1].last
		@ui.name[@ui.status][1][-1] = @ui.rect.length - 1
	end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rbgooey-0.0.5 lib/text.rb