function vdo_scrolling_text_init() 
 
end 
 
 
 
function vdo_scrolling_text_cleanup() 
 
end 
 
 
 
-- Inherited from Vdo_base_object 
 
Vdo_scrolling_text = Vdo_base_object:new_base() 
 
 
 
function Vdo_scrolling_text:set_wrap_width(new_width) 
 
	local text_graphic = Vdo_base_object:new("text_graphic", self.handle)  
	text_graphic:set_property("wrap_width",new_width)  
end 
 
 
 
function Vdo_scrolling_text:set_font(new_font, new_size_x, new_size_y) 
 
	--check if text scale x is valid 
 
	if new_size_x == nil then 
 
		new_size_x = 1.0 
 
	end 
 
	--check if text scale y is valid 
 
	if new_size_y == nil then 
 
		new_size_y = new_size_x 
 
	end 
 
	local text_graphic = Vdo_base_object:new("text_graphic", self.handle)  
	--set the font face and the text scale 
 
	text_graphic:set_property("font", new_font)  
	text_graphic:set_property("text_scale", new_size_x, new_size_y)  
end 
 
 
 
function Vdo_scrolling_text:force_case(case) 
 
	--check if text scale x is valid 
 
 
 
	local text_graphic = Vdo_base_object:new("text_graphic", self.handle)  
	--set the font face and the text scale 
 
	text_graphic:set_property("force_case", case)  
end 
 
 
 
function Vdo_scrolling_text:set_auto_offset(compass) 
 
	--check if text scale x is valid 
 
 
 
	local text_graphic = Vdo_base_object:new("text_graphic", self.handle)  
	--set the font face and the text scale 
 
	text_graphic:set_property("auto_offset", compass)  
end 
 
 
 
function Vdo_scrolling_text:run_text(new_text, new_speed, is_loop, time_delay, start_delay) 
 
	--are we already running a thread? 
 
	if self.thread ~= nil then 
 
		thread_kill(self.thread) 
 
	end 
 
	 
 
	if start_delay == nil then 
 
		start_delay = 0 
 
	end 
 
	 
 
	-- If we fed a table into this thing, then split it into lines and make a huge string out of it	 
 
	if type(new_text) == "table" then 
 
		local holder_string = "" 
 
		for idx, val in pairs(new_text) do 
 
			holder_string = holder_string .. new_text[idx] .. "\n" 
 
		end 
 
		 
 
		new_text = holder_string 
 
	else 
 
		local temp_text = get_localized_string_for_tag(new_text) 
 
		--this has a localized tag 
 
		if temp_text ~= "" then  
 
			self.thread = thread_new("vdo_scrolling_text_localized_tag_thread", new_text, new_speed, is_loop, time_delay, start_delay, self.handle)  
			return 
 
		end 
 
	end 
 
	 
 
	-- Run the thread 
 
	self.thread = thread_new("vdo_scrolling_text_number_thread", new_text, new_speed, is_loop, time_delay, start_delay, self.handle)  
end 
 
 
 
function vdo_scrolling_text_number_thread(new_text, new_speed, is_loop, time_delay, start_delay, handle) 
 
	local count = 0 
 
	local new_string = "" 
 
	local char = "" 
 
	local text_graphic = Vdo_base_object:new("text_graphic", handle)  
	 
 
	-- use a start_delay if one exists 
 
	delay(start_delay) 
 
	 
 
	repeat 
 
		-- Run through the text 
 
		while true do  
 
			char = get_char_in_string(new_text, count) 
 
			if char == nil then 
 
				break 
 
			end 
 
			new_string = set_char_in_string(new_string, count, char) 
 
			text_graphic:set_text(new_string) 
 
			count = count + 1 
 
			delay(new_speed) 
 
		end 
 
		text_graphic:set_text(new_string) 
 
		-- Reset and ready to loop through again 
 
		count = 0 
 
		new_string = "" 
 
		char = "" 
 
		 
 
		if is_loop then 
 
			-- Default delay to 1 
 
			time_delay = time_delay or 1 
 
			delay(time_delay) 
 
		end 
 
	until not is_loop 
 
end 
 
 
 
function vdo_scrolling_text_localized_tag_thread(tag, speed, is_loop, time_delay, start_delay, handle) 
 
 
 
	local current_end = 0 
 
	local current_string = "" 
 
 
 
	local text_graphic = Vdo_base_object:new("text_graphic", handle)  
	 
 
	-- use a start_delay if one exists 
 
	delay(start_delay) 
 
	 
 
	repeat 
 
		-- Run through the text 
 
		-- while true do	 
 
			-- delay(speed) 
 
			-- local new_string = get_localized_substring_for_tag(tag, 0, current_end) 
 
				-- if new_string == current_string then 
 
				-- break 
 
			-- end 
 
			-- text_graphic:set_text(new_string) 
 
			-- current_end = current_end + 1 
 
			-- current_string = new_string 
 
			-- delay(speed) 
 
		-- end 
 
		 
 
		-- Reset and ready to loop through again 
 
		current_end = 0 
 
		current_string = "" 
 
		 
 
		if is_loop then 
 
			-- Default delay to 1 
 
			time_delay = time_delay or 1 
 
			delay(time_delay) 
 
		end 
 
	until not is_loop 
 
end 
 
 
 
function Vdo_scrolling_text:object_destroy() 
 
	thread_kill(self.thread) 
 
	return vint_object_destroy(self.handle) 
 
end