gel.events: Add space mouse click detection for 2D.
This commit is contained in:
@@ -775,9 +775,6 @@ is
|
|||||||
|
|
||||||
Site_world_space : constant Vector_3 := the_Camera.to_world_Site (Site_window_space);
|
Site_world_space : constant Vector_3 := the_Camera.to_world_Site (Site_window_space);
|
||||||
|
|
||||||
sprite_Event : constant gel.Events.sprite_click_down_Event := (mouse_Button => the_Event.Button,
|
|
||||||
world_Site => Site_world_space);
|
|
||||||
|
|
||||||
begin
|
begin
|
||||||
case the_world_Info.World.space_Kind
|
case the_world_Info.World.space_Kind
|
||||||
is
|
is
|
||||||
@@ -788,7 +785,12 @@ is
|
|||||||
begin
|
begin
|
||||||
if the_Collision.near_Sprite /= null
|
if the_Collision.near_Sprite /= null
|
||||||
then
|
then
|
||||||
the_Collision.near_Sprite.emit (sprite_Event);
|
declare
|
||||||
|
sprite_clicked_Event : constant gel.Events.sprite_click_down_Event := (mouse_Button => the_Event.Button,
|
||||||
|
world_Site => Site_world_space);
|
||||||
|
begin
|
||||||
|
the_Collision.near_Sprite.emit (sprite_clicked_Event);
|
||||||
|
end;
|
||||||
end if;
|
end if;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@@ -796,13 +798,26 @@ is
|
|||||||
declare
|
declare
|
||||||
use gel.linear_Algebra_3D;
|
use gel.linear_Algebra_3D;
|
||||||
|
|
||||||
Intersect : constant Vector_3 := intersect_Line_and_z0_Plane (Line_p1 => the_Camera.Site,
|
Intersect : constant Vector_3 := intersect_Line_and_z0_Plane (Line_p1 => the_Camera.Site,
|
||||||
Line_p2 => Site_world_space);
|
Line_p2 => Site_world_space);
|
||||||
the_Collision : constant point_Collision := the_world_Info.World.cast_Point (Point => Intersect);
|
the_Collision : constant point_Collision := the_world_Info.World.cast_Point (Point => Intersect);
|
||||||
begin
|
begin
|
||||||
if the_Collision.near_Sprite /= null
|
if the_Collision.near_Sprite /= null
|
||||||
then
|
then
|
||||||
the_Collision.near_Sprite.emit (sprite_Event);
|
declare
|
||||||
|
sprite_clicked_Event : constant gel.Events.sprite_click_down_Event := (mouse_Button => the_Event.Button,
|
||||||
|
world_Site => Site_world_space);
|
||||||
|
|
||||||
|
begin
|
||||||
|
the_Collision.near_Sprite.emit (sprite_clicked_Event);
|
||||||
|
end;
|
||||||
|
else
|
||||||
|
declare
|
||||||
|
space_clicked_Event : constant gel.Events.space_click_down_Event := (mouse_Button => the_Event.Button,
|
||||||
|
world_Site => Site_world_space);
|
||||||
|
begin
|
||||||
|
Self.Applet.emit (space_clicked_Event);
|
||||||
|
end;
|
||||||
end if;
|
end if;
|
||||||
end;
|
end;
|
||||||
end case;
|
end case;
|
||||||
|
|||||||
@@ -73,6 +73,20 @@ is
|
|||||||
end record;
|
end record;
|
||||||
|
|
||||||
|
|
||||||
|
type space_click_down_Event is new lace.Event.item with
|
||||||
|
record
|
||||||
|
mouse_Button : gel.Mouse.Button_Id;
|
||||||
|
world_Site : math.Vector_3;
|
||||||
|
end record;
|
||||||
|
|
||||||
|
|
||||||
|
type space_click_up_Event is new lace.Event.item with
|
||||||
|
record
|
||||||
|
mouse_Button : gel.Mouse.Button_Id;
|
||||||
|
world_Site : math.Vector_3;
|
||||||
|
end record;
|
||||||
|
|
||||||
|
|
||||||
type sprite_click_down_Event is new lace.Event.item with
|
type sprite_click_down_Event is new lace.Event.item with
|
||||||
record
|
record
|
||||||
mouse_Button : gel.Mouse.Button_Id;
|
mouse_Button : gel.Mouse.Button_Id;
|
||||||
|
|||||||
Reference in New Issue
Block a user