note
	description: "A touch input device that can detect finger pressure"
	author: "Louis Marchand"
	date: "Thu, 16 Apr 2015 19:47:44 +0000"
	revision: "2.0"

class 
	GAME_TOUCH_DEVICE

inherit
	GAME_TOUCH_DEVICE_EVENTS
		rename
			make as make_events,
			id as index,
			stop as stop_events,
			run as run_events,
			is_running as is_events_running,
			clear as clear_events
		end

	GAME_LIBRARY_SHARED
		undefine
			default_create
		end

	GAME_DOLLAR_GESTURE_MANAGER
		export
			{NONE} save_all_dollar_gesture_template, append_all_dollar_gesture_template
		undefine
			default_create
		end

create 
	make

feature {NONE} -- Initialization

	make (a_number: INTEGER_32)
			-- Initialization of Current being the a_numbernd touch device in the system
		do
			index := {GAME_SDL_EXTERNAL}.sdl_gettouchdevice (a_number)
			events_controller := Game_library.events_controller
			make_events
		end
	
feature -- Access

	finger_count: INTEGER_32
			-- The number of fingers presently detect by Current
		do
			Result := {GAME_SDL_EXTERNAL}.sdl_getnumtouchfingers (index)
		end

	finger_with_number (a_number: INTEGER_32): GAME_FINGER_STATE
			-- Retreive a snapshot of the finger state at a_number in fingers
		require
			number_strictly_positive: a_number > 0
		do
			create Result.make (Current, a_number)
		end

	fingers: ARRAYED_LIST [GAME_FINGER_STATE]
			-- A snapshot of the states of every finger that is applied on Current
		local
			l_number: INTEGER_32
		do
			create Result.make (finger_count)
			from
				l_number := 1
			until
				l_number > finger_count
			loop
				Result.extend (finger_with_number (l_number))
				l_number := l_number + 1
			end
		end

	index: INTEGER_64
			-- The unique internal identifier of Current

	events_controller: GAME_EVENTS_CONTROLLER
			-- Manage every internal events
	
end -- class GAME_TOUCH_DEVICE

Generated by ISE EiffelStudio