note
	description: "The main manager of the text library."
	author: "Louis Marchand"
	date: "Mon, 30 Mar 2015 01:20:46 +0000"
	revision: "2.0"

class 
	TEXT_CONTROLLER

inherit
	GAME_SDL_ANY

	MEMORY
		export
			{NONE} all
		end

create 
	default_create

feature -- Access

	is_text_enable: BOOLEAN assign set_is_text_enable
			-- The library is enabled.
		do
			Result := {GAME_TEXT_EXTERNAL}.ttf_wasinit = 1
		end

	set_is_text_enable (a_value: BOOLEAN)
			-- Assign to is_text_enable the value of a_value
		do
			if a_value then
				enable_text
			else
				disable_text
			end
		ensure
			is_assign: not has_error implies is_text_enable ~ a_value
		end

	enable_text
			-- Activate the game text library.
		local
			l_error: INTEGER_32
		do
			clear_error
			l_error := {GAME_TEXT_EXTERNAL}.ttf_init
			manage_error_code (l_error, "Could not enable text library.")
		ensure
			enable_text_is_enable: not has_error implies is_text_enable
		end

	disable_text
			-- Desactivate the library.
		require
			disable_text_is_enable: is_text_enable
		do
			full_collect
			{GAME_TEXT_EXTERNAL}.ttf_quit
		ensure
			is_disable: not is_text_enable
		end

	quit_library
			-- Close the library.
		local
			l_mem: MEMORY
		do
			create l_mem;
			l_mem.full_collect
			if is_text_enable then
				disable_text
			end
		end
	
end -- class TEXT_CONTROLLER

Generated by ISE EiffelStudio