note
	description: "[
		A GAME_SURFACE that represent a text.
		Rendering from this class does not use
		alpha blending. You have to specify the
		background color.
	]"
	author: "Louis Marchand"
	date: "Mon, 30 Mar 2015 01:20:46 +0000"
	revision: "2.0"

class 
	TEXT_SURFACE_SHADED

inherit
	TEXT_SURFACE
		rename
			make as make_text_surface,
			color as foreground_color
		end

create 
	make

feature {NONE} -- Initialization

	make (a_text: READABLE_STRING_GENERAL; a_font: TEXT_FONT; a_foreground_color, a_background_color: GAME_COLOR_READABLE)
			-- Initialization for Current from the text l_text
			-- using the font l_font and color a_foreground_color
			-- with a background color a_background_color.
		require
			text_is_enabled: Text_library.is_text_enable
			font_is_open: a_font.is_open
		do
			background_color := a_background_color
			make_text_surface (a_text, a_font, a_foreground_color)
		end
	
feature -- Access

	background_color: GAME_COLOR_READABLE
			-- The color to draw in the background of the text
	
feature {NONE} -- Implementation

	c_render_text (a_font, a_text, a_foreground_color: POINTER): POINTER
			-- The internal C function to render the latin a_text
		local
			l_background_color: GAME_SDL_COLOR
		do
			create l_background_color.make_from_other (background_color)
			Result := {GAME_TEXT_EXTERNAL}.ttf_rendertext_shaded (a_font, a_text, a_foreground_color, l_background_color.item)
		end

	c_render_utf8 (a_font, a_text, a_foreground_color: POINTER): POINTER
			-- The internal C function to render the UTF8 a_text
		local
			l_background_color: GAME_SDL_COLOR
		do
			create l_background_color.make_from_other (background_color)
			Result := {GAME_TEXT_EXTERNAL}.ttf_renderutf8_shaded (a_font, a_text, a_foreground_color, l_background_color.item)
		end
	
end -- class TEXT_SURFACE_SHADED

Generated by ISE EiffelStudio