note
	description: "An haptic device uniquely identified with an index."
	author: "Louis Marchand"
	date: "Mon, 02 Mar 2015 14:20:07 +0000"
	revision: "2.0"

class 
	GAME_HAPTIC_DEVICE

inherit
	GAME_HAPTIC

create {GAME_LIBRARY_CONTROLLER}
	make

feature {NONE} -- Initialization

	make (a_index: INTEGER_32)
			-- Initialization of Current using a_index as internal index.
		require
			is_haptic_enabled: Game_library.is_haptic_enable
			is_index_valid: a_index < {GAME_SDL_EXTERNAL}.sdl_numhaptics
			is_haptic_not_already_open: not {GAME_SDL_EXTERNAL}.sdl_hapticopened (a_index)
		do
			default_create
			index := a_index
		end
	
feature -- Query

	index: INTEGER_32
			-- The unique identifier of Current

	name: READABLE_STRING_GENERAL
			-- A text to identified Current
		local
			l_c_pointer: POINTER
		do
			clear_error
			l_c_pointer := {GAME_SDL_EXTERNAL}.sdl_hapticname (index)
			if l_c_pointer.is_default_pointer then
				manage_error_pointer (l_c_pointer, "Cannot retreive haptic name.")
				Result := ""
			else
				Result := (create {C_STRING}.make_by_pointer (l_c_pointer)).string
			end
		end
	
feature {NONE} -- Implementation

	internal_open: POINTER
			-- The internal C function to open the haptic
		do
			Result := {GAME_SDL_EXTERNAL}.sdl_hapticopen (index)
		end
	
end -- class GAME_HAPTIC_DEVICE

Generated by ISE EiffelStudio