gel.sprite: Add 'user_Data'.

This commit is contained in:
Rod Kay
2023-04-24 16:34:21 +10:00
parent ac87a2e6ca
commit bd5557cb67
4 changed files with 271 additions and 194 deletions

View File

@@ -122,7 +122,8 @@ is
Bounce : in math.Real := 0.5; Bounce : in math.Real := 0.5;
Radius : in math.Real := 0.5; Radius : in math.Real := 0.5;
Color : in openGL.Color := opengl.Palette.White; Color : in openGL.Color := opengl.Palette.White;
Texture : in openGL.asset_Name := openGL.null_Asset) return gel.Sprite.view Texture : in openGL.asset_Name := openGL.null_Asset;
user_Data : in any_user_Data_view := null) return gel.Sprite.view
is is
use openGL; use openGL;
use type Vector_2; use type Vector_2;
@@ -152,7 +153,8 @@ is
the_physics_Model, the_physics_Model,
owns_graphics => True, owns_graphics => True,
owns_physics => True, owns_physics => True,
is_Kinematic => False); is_Kinematic => False,
user_Data => user_Data);
end new_circle_Sprite; end new_circle_Sprite;
@@ -163,7 +165,8 @@ is
Friction : in math.Real := 0.5; Friction : in math.Real := 0.5;
Bounce : in math.Real := 0.5; Bounce : in math.Real := 0.5;
Vertices : in Geometry_2d.Sites; Vertices : in Geometry_2d.Sites;
Color : in openGL.Color := opengl.Palette.White) return gel.Sprite.view Color : in openGL.Color := opengl.Palette.White;
user_Data : in any_user_Data_view := null) return gel.Sprite.view
is is
use Math; use Math;
use type Geometry_2d.Sites; use type Geometry_2d.Sites;
@@ -190,7 +193,8 @@ is
the_physics_Model, the_physics_Model,
owns_graphics => True, owns_graphics => True,
owns_physics => True, owns_physics => True,
is_Kinematic => False); is_Kinematic => False,
user_Data => user_Data);
end new_polygon_Sprite; end new_polygon_Sprite;
@@ -202,7 +206,8 @@ is
Bounce : in math.Real := 0.5; Bounce : in math.Real := 0.5;
Width, Width,
Height : in math.Real; Height : in math.Real;
Color : in openGL.Color := opengl.Palette.White) return gel.Sprite.view Color : in openGL.Color := opengl.Palette.White;
user_Data : in any_user_Data_view := null) return gel.Sprite.view
is is
use Math; use Math;
@@ -214,7 +219,7 @@ is
[ half_Width, half_Height], [ half_Width, half_Height],
[-half_Width, half_Height]]; [-half_Width, half_Height]];
begin begin
return new_polygon_Sprite (in_World, Site, Mass, Friction, Bounce, the_Vertices, Color); return new_polygon_Sprite (in_World, Site, Mass, Friction, Bounce, the_Vertices, Color, user_Data);
end new_rectangle_Sprite; end new_rectangle_Sprite;
@@ -230,7 +235,8 @@ is
long_Count : in Positive := openGL.Model.sphere.default_longitude_Count; long_Count : in Positive := openGL.Model.sphere.default_longitude_Count;
is_Lit : in Boolean := True; is_Lit : in Boolean := True;
Color : in openGL.lucid_Color := opengl.no_lucid_Color; Color : in openGL.lucid_Color := opengl.no_lucid_Color;
Texture : in openGL.asset_Name := openGL.null_Asset) return gel.Sprite.view Texture : in openGL.asset_Name := openGL.null_Asset;
user_Data : in any_user_Data_view := null) return gel.Sprite.view
is is
use type openGL.lucid_Color; use type openGL.lucid_Color;
@@ -268,7 +274,8 @@ is
the_physics_Model, the_physics_Model,
owns_Graphics => True, owns_Graphics => True,
owns_Physics => True, owns_Physics => True,
is_Kinematic => False); is_Kinematic => False,
user_Data => user_Data);
end new_ball_Sprite; end new_ball_Sprite;
@@ -276,7 +283,8 @@ is
function new_skysphere_Sprite (in_World : in gel.World.view; function new_skysphere_Sprite (in_World : in gel.World.view;
Site : in math.Vector_3 := math.Origin_3D; Site : in math.Vector_3 := math.Origin_3D;
Radius : in math.Real := 1_000_000.0; Radius : in math.Real := 1_000_000.0;
Texture : in openGL.asset_Name) return gel.Sprite.view Texture : in openGL.asset_Name;
user_Data : in any_user_Data_view := null) return gel.Sprite.view
is is
the_graphics_Model : openGL.Model.sphere.view; the_graphics_Model : openGL.Model.sphere.view;
@@ -295,7 +303,8 @@ is
the_physics_Model, the_physics_Model,
owns_Graphics => True, owns_Graphics => True,
owns_Physics => True, owns_Physics => True,
is_Kinematic => False); is_Kinematic => False,
user_Data => user_Data);
end new_skysphere_Sprite; end new_skysphere_Sprite;
@@ -305,7 +314,8 @@ is
Mass : in math.Real := 1.0; Mass : in math.Real := 1.0;
Size : in math.Vector_3 := [1.0, 1.0, 1.0]; Size : in math.Vector_3 := [1.0, 1.0, 1.0];
Colors : in box_Colors := [others => opengl.Palette.random_Color]; Colors : in box_Colors := [others => opengl.Palette.random_Color];
is_Kinematic : in Boolean := False) return gel.Sprite.view is_Kinematic : in Boolean := False;
user_Data : in any_user_Data_view := null) return gel.Sprite.view
is is
use openGL.Model.box, use openGL.Model.box,
openGL, openGL,
@@ -332,7 +342,8 @@ is
the_box_physics_Model, the_box_physics_Model,
owns_Graphics => True, owns_Graphics => True,
owns_Physics => True, owns_Physics => True,
is_Kinematic => is_Kinematic); is_Kinematic => is_Kinematic,
user_Data => user_Data);
begin begin
return the_Box; return the_Box;
end new_box_Sprite; end new_box_Sprite;
@@ -343,7 +354,8 @@ is
Site : in math.Vector_3 := math.Origin_3D; Site : in math.Vector_3 := math.Origin_3D;
Mass : in math.Real := 1.0; Mass : in math.Real := 1.0;
Size : in math.Vector_3 := [1.0, 1.0, 1.0]; Size : in math.Vector_3 := [1.0, 1.0, 1.0];
Texture : in openGL.asset_Name) return gel.Sprite.view Texture : in openGL.asset_Name;
user_Data : in any_user_Data_view := null) return gel.Sprite.view
is is
use openGL.Model.box, use openGL.Model.box,
Math; Math;
@@ -369,7 +381,8 @@ is
the_box_physics_Model, the_box_physics_Model,
owns_graphics => True, owns_graphics => True,
owns_physics => True, owns_physics => True,
is_Kinematic => False); is_Kinematic => False,
user_Data => user_Data);
begin begin
return the_Box; return the_Box;
end new_box_Sprite; end new_box_Sprite;
@@ -380,7 +393,8 @@ is
Site : in math.Vector_3 := math.Origin_3D; Site : in math.Vector_3 := math.Origin_3D;
Mass : in math.Real := 1.0; Mass : in math.Real := 1.0;
Size : in math.Vector_3 := [1.0, 1.0, 1.0]; Size : in math.Vector_3 := [1.0, 1.0, 1.0];
Texture : in openGL.asset_Name := openGL.null_Asset) return gel.Sprite.view Texture : in openGL.asset_Name := openGL.null_Asset;
user_Data : in any_user_Data_view := null) return gel.Sprite.view
is is
use Math; use Math;
@@ -404,7 +418,8 @@ is
the_billboard_physics_Model, the_billboard_physics_Model,
owns_Graphics => True, owns_Graphics => True,
owns_Physics => True, owns_Physics => True,
is_Kinematic => False); is_Kinematic => False,
user_Data => user_Data);
begin begin
return the_Billboard; return the_Billboard;
end new_billboard_Sprite; end new_billboard_Sprite;
@@ -416,7 +431,8 @@ is
Color : in openGL.lucid_Color; Color : in openGL.lucid_Color;
Mass : in math.Real := 1.0; Mass : in math.Real := 1.0;
Size : in math.Vector_3 := [1.0, 1.0, 1.0]; Size : in math.Vector_3 := [1.0, 1.0, 1.0];
Texture : in openGL.asset_Name := openGL.null_Asset) return gel.Sprite.view Texture : in openGL.asset_Name := openGL.null_Asset;
user_Data : in any_user_Data_view := null) return gel.Sprite.view
is is
use Math; use Math;
@@ -439,7 +455,8 @@ is
the_billboard_physics_Model, the_billboard_physics_Model,
owns_Graphics => True, owns_Graphics => True,
owns_Physics => True, owns_Physics => True,
is_Kinematic => False); is_Kinematic => False,
user_Data => user_Data);
begin begin
return the_Billboard; return the_Billboard;
end new_billboard_Sprite; end new_billboard_Sprite;
@@ -452,7 +469,8 @@ is
Size : in math.Vector_3 := [1.0, 1.0, 1.0]; Size : in math.Vector_3 := [1.0, 1.0, 1.0];
Texture : in openGL.asset_Name := openGL.null_Asset; Texture : in openGL.asset_Name := openGL.null_Asset;
Color : in openGL.lucid_Color := (openGL.Palette.Black, openGL.Opaque); Color : in openGL.lucid_Color := (openGL.Palette.Black, openGL.Opaque);
line_Width : in openGL.Real := openGL.Primitive.unused_line_Width) return gel.Sprite.view line_Width : in openGL.Real := openGL.Primitive.unused_line_Width;
user_Data : in any_user_Data_view := null) return gel.Sprite.view
is is
pragma Unreferenced (Texture); pragma Unreferenced (Texture);
use Math; use Math;
@@ -474,7 +492,8 @@ is
the_physics_Model, the_physics_Model,
owns_Graphics => True, owns_Graphics => True,
owns_Physics => True, owns_Physics => True,
is_Kinematic => False); is_Kinematic => False,
user_Data => user_Data);
begin begin
return the_Arrow; return the_Arrow;
end new_arrow_Sprite; end new_arrow_Sprite;
@@ -487,7 +506,8 @@ is
Size : in math.Vector_3 := [1.0, 1.0, 1.0]; Size : in math.Vector_3 := [1.0, 1.0, 1.0];
Texture : in openGL.asset_Name := openGL.null_Asset; Texture : in openGL.asset_Name := openGL.null_Asset;
Color : in openGL.lucid_Color := (openGL.Palette.Black, openGL.Opaque); Color : in openGL.lucid_Color := (openGL.Palette.Black, openGL.Opaque);
line_Width : in openGL.Real := openGL.Primitive.unused_line_Width) return gel.Sprite.view line_Width : in openGL.Real := openGL.Primitive.unused_line_Width;
user_Data : in any_user_Data_view := null) return gel.Sprite.view
is is
pragma Unreferenced (Texture, line_Width); pragma Unreferenced (Texture, line_Width);
use Math; use Math;
@@ -508,7 +528,8 @@ is
the_physics_Model, the_physics_Model,
owns_Graphics => True, owns_Graphics => True,
owns_Physics => True, owns_Physics => True,
is_Kinematic => False); is_Kinematic => False,
user_Data => user_Data);
begin begin
return the_Line; return the_Line;
end new_line_Sprite; end new_line_Sprite;
@@ -521,7 +542,8 @@ is
Size : in math.Vector_3 := [1.0, 1.0, 1.0]; Size : in math.Vector_3 := [1.0, 1.0, 1.0];
Texture : in openGL.asset_Name := openGL.null_Asset; Texture : in openGL.asset_Name := openGL.null_Asset;
Color : in openGL.lucid_Color := (openGL.Palette.Black, openGL.Opaque); Color : in openGL.lucid_Color := (openGL.Palette.Black, openGL.Opaque);
line_Width : in openGL.Real := openGL.Primitive.unused_line_Width) return gel.Sprite.view line_Width : in openGL.Real := openGL.Primitive.unused_line_Width;
user_Data : in any_user_Data_view := null) return gel.Sprite.view
is is
pragma Unreferenced (Texture, line_Width); pragma Unreferenced (Texture, line_Width);
use Math; use Math;
@@ -541,7 +563,8 @@ is
the_physics_Model, the_physics_Model,
owns_Graphics => True, owns_Graphics => True,
owns_Physics => True, owns_Physics => True,
is_Kinematic => False); is_Kinematic => False,
user_Data => user_Data);
begin begin
return the_Line; return the_Line;
end new_segment_line_Sprite; end new_segment_line_Sprite;
@@ -557,7 +580,8 @@ is
Font : in openGL.Font.font_Id; Font : in openGL.Font.font_Id;
Color : in openGL.Color := opengl.Palette.Black; Color : in openGL.Color := opengl.Palette.Black;
Size : in math.Vector_3 := [1.0, 1.0, 1.0]; Size : in math.Vector_3 := [1.0, 1.0, 1.0];
Centered : in Boolean := True) return gel.Sprite.view Centered : in Boolean := True;
user_Data : in any_user_Data_view := null) return gel.Sprite.view
is is
use Math; use Math;
use type Physics.space_Kind; use type Physics.space_Kind;
@@ -597,7 +621,8 @@ is
the_physics_Model, the_physics_Model,
owns_Graphics => True, owns_Graphics => True,
owns_Physics => True, owns_Physics => True,
is_Kinematic => False); is_Kinematic => False,
user_Data => user_Data);
end new_text_Sprite; end new_text_Sprite;

View File

@@ -47,6 +47,9 @@ is
--- Sprites --- Sprites
-- --
use gel.Sprite;
-- 2D -- 2D
-- --
@@ -57,7 +60,8 @@ is
Bounce : in math.Real := 0.5; Bounce : in math.Real := 0.5;
Radius : in math.Real := 0.5; Radius : in math.Real := 0.5;
Color : in openGL.Color := opengl.Palette.White; Color : in openGL.Color := opengl.Palette.White;
Texture : in openGL.asset_Name := openGL.null_Asset) return gel.Sprite.view; Texture : in openGL.asset_Name := openGL.null_Asset;
user_Data : in any_user_Data_view := null) return gel.Sprite.view;
function new_polygon_Sprite (in_World : in gel.World.view; function new_polygon_Sprite (in_World : in gel.World.view;
Site : in math.Vector_2 := math.Origin_2D; Site : in math.Vector_2 := math.Origin_2D;
@@ -65,7 +69,8 @@ is
Friction : in math.Real := 0.5; Friction : in math.Real := 0.5;
Bounce : in math.Real := 0.5; Bounce : in math.Real := 0.5;
Vertices : in Geometry_2d.Sites; Vertices : in Geometry_2d.Sites;
Color : in openGL.Color := opengl.Palette.White) return gel.Sprite.view; Color : in openGL.Color := opengl.Palette.White;
user_Data : in any_user_Data_view := null) return gel.Sprite.view;
function new_rectangle_Sprite (in_World : in gel.World.view; function new_rectangle_Sprite (in_World : in gel.World.view;
Site : in math.Vector_2 := math.Origin_2D; Site : in math.Vector_2 := math.Origin_2D;
@@ -74,7 +79,8 @@ is
Bounce : in math.Real := 0.5; Bounce : in math.Real := 0.5;
Width, Width,
Height : in math.Real; Height : in math.Real;
Color : in openGL.Color := opengl.Palette.White) return gel.Sprite.view; Color : in openGL.Color := opengl.Palette.White;
user_Data : in any_user_Data_view := null) return gel.Sprite.view;
-- 3D -- 3D
-- --
@@ -86,12 +92,14 @@ is
long_Count : in Positive := openGL.Model.sphere.default_longitude_Count; long_Count : in Positive := openGL.Model.sphere.default_longitude_Count;
is_Lit : in Boolean := True; is_Lit : in Boolean := True;
Color : in openGL.lucid_Color := opengl.no_lucid_Color; Color : in openGL.lucid_Color := opengl.no_lucid_Color;
Texture : in openGL.asset_Name := openGL.null_Asset) return gel.Sprite.view; Texture : in openGL.asset_Name := openGL.null_Asset;
user_Data : in any_user_Data_view := null) return gel.Sprite.view;
function new_skysphere_Sprite (in_World : in gel.World.view; function new_skysphere_Sprite (in_World : in gel.World.view;
Site : in math.Vector_3 := math.Origin_3D; Site : in math.Vector_3 := math.Origin_3D;
Radius : in math.Real := 1_000_000.0; Radius : in math.Real := 1_000_000.0;
Texture : in openGL.asset_Name) return gel.Sprite.view; Texture : in openGL.asset_Name;
user_Data : in any_user_Data_view := null) return gel.Sprite.view;
subtype box_Colors is openGL.Colors (1 .. 6); subtype box_Colors is openGL.Colors (1 .. 6);
@@ -101,26 +109,30 @@ is
Mass : in math.Real := 1.0; Mass : in math.Real := 1.0;
Size : in math.Vector_3 := [1.0, 1.0, 1.0]; Size : in math.Vector_3 := [1.0, 1.0, 1.0];
Colors : in box_Colors := [others => opengl.Palette.random_Color]; Colors : in box_Colors := [others => opengl.Palette.random_Color];
is_Kinematic : in Boolean := False) return gel.Sprite.view; is_Kinematic : in Boolean := False;
user_Data : in any_user_Data_view := null) return gel.Sprite.view;
function new_box_Sprite (in_World : in gel.World.view; function new_box_Sprite (in_World : in gel.World.view;
Site : in math.Vector_3 := math.Origin_3D; Site : in math.Vector_3 := math.Origin_3D;
Mass : in math.Real := 1.0; Mass : in math.Real := 1.0;
Size : in math.Vector_3 := [1.0, 1.0, 1.0]; Size : in math.Vector_3 := [1.0, 1.0, 1.0];
Texture : in openGL.asset_Name) return gel.Sprite.view; Texture : in openGL.asset_Name;
user_Data : in any_user_Data_view := null) return gel.Sprite.view;
function new_billboard_Sprite (in_World : in gel.World.view; function new_billboard_Sprite (in_World : in gel.World.view;
Site : in math.Vector_3 := math.Origin_3D; Site : in math.Vector_3 := math.Origin_3D;
Mass : in math.Real := 1.0; Mass : in math.Real := 1.0;
Size : in math.Vector_3 := [1.0, 1.0, 1.0]; Size : in math.Vector_3 := [1.0, 1.0, 1.0];
Texture : in openGL.asset_Name := openGL.null_Asset) return gel.Sprite.view; Texture : in openGL.asset_Name := openGL.null_Asset;
user_Data : in any_user_Data_view := null) return gel.Sprite.view;
function new_billboard_Sprite (in_World : in gel.World.view; function new_billboard_Sprite (in_World : in gel.World.view;
Site : in math.Vector_3 := math.Origin_3D; Site : in math.Vector_3 := math.Origin_3D;
Color : in openGL.lucid_Color; Color : in openGL.lucid_Color;
Mass : in math.Real := 1.0; Mass : in math.Real := 1.0;
Size : in math.Vector_3 := [1.0, 1.0, 1.0]; Size : in math.Vector_3 := [1.0, 1.0, 1.0];
Texture : in openGL.asset_Name := openGL.null_Asset) return gel.Sprite.view; Texture : in openGL.asset_Name := openGL.null_Asset;
user_Data : in any_user_Data_view := null) return gel.Sprite.view;
function new_arrow_Sprite (in_World : in gel.World.view; function new_arrow_Sprite (in_World : in gel.World.view;
Site : in math.Vector_3 := math.Origin_3D; Site : in math.Vector_3 := math.Origin_3D;
@@ -128,7 +140,8 @@ is
Size : in math.Vector_3 := [1.0, 1.0, 1.0]; Size : in math.Vector_3 := [1.0, 1.0, 1.0];
Texture : in openGL.asset_Name := openGL.null_Asset; Texture : in openGL.asset_Name := openGL.null_Asset;
Color : in openGL.lucid_Color := (openGL.Palette.Black, openGL.Opaque); Color : in openGL.lucid_Color := (openGL.Palette.Black, openGL.Opaque);
line_Width : in openGL.Real := openGL.Primitive.unused_line_Width) return gel.Sprite.view; line_Width : in openGL.Real := openGL.Primitive.unused_line_Width;
user_Data : in any_user_Data_view := null) return gel.Sprite.view;
function new_line_Sprite (in_World : in gel.World.view; function new_line_Sprite (in_World : in gel.World.view;
Site : in math.Vector_3 := math.Origin_3D; Site : in math.Vector_3 := math.Origin_3D;
@@ -136,7 +149,8 @@ is
Size : in math.Vector_3 := [1.0, 1.0, 1.0]; Size : in math.Vector_3 := [1.0, 1.0, 1.0];
Texture : in openGL.asset_Name := openGL.null_Asset; Texture : in openGL.asset_Name := openGL.null_Asset;
Color : in openGL.lucid_Color := (openGL.Palette.Black, openGL.Opaque); Color : in openGL.lucid_Color := (openGL.Palette.Black, openGL.Opaque);
line_Width : in openGL.Real := openGL.Primitive.unused_line_Width) return gel.Sprite.view; line_Width : in openGL.Real := openGL.Primitive.unused_line_Width;
user_Data : in any_user_Data_view := null) return gel.Sprite.view;
function new_segment_line_Sprite (in_World : in gel.World.view; function new_segment_line_Sprite (in_World : in gel.World.view;
Site : in math.Vector_3 := math.Origin_3D; Site : in math.Vector_3 := math.Origin_3D;
@@ -144,7 +158,8 @@ is
Size : in math.Vector_3 := [1.0, 1.0, 1.0]; Size : in math.Vector_3 := [1.0, 1.0, 1.0];
Texture : in openGL.asset_Name := openGL.null_Asset; Texture : in openGL.asset_Name := openGL.null_Asset;
Color : in openGL.lucid_Color := (openGL.Palette.Black, openGL.Opaque); Color : in openGL.lucid_Color := (openGL.Palette.Black, openGL.Opaque);
line_Width : in openGL.Real := openGL.Primitive.unused_line_Width) return gel.Sprite.view; line_Width : in openGL.Real := openGL.Primitive.unused_line_Width;
user_Data : in any_user_Data_view := null) return gel.Sprite.view;
-- Text -- Text
-- --
@@ -154,6 +169,7 @@ is
Font : in openGL.Font.font_Id; Font : in openGL.Font.font_Id;
Color : in openGL.Color := opengl.Palette.Black; Color : in openGL.Color := opengl.Palette.Black;
Size : in math.Vector_3 := [1.0, 1.0, 1.0]; Size : in math.Vector_3 := [1.0, 1.0, 1.0];
Centered : in Boolean := True) return gel.Sprite.view; Centered : in Boolean := True;
user_Data : in any_user_Data_view := null) return gel.Sprite.view;
end gel.Forge; end gel.Forge;

View File

@@ -107,7 +107,8 @@ is
physics_Model : access physics.Model.item'Class; physics_Model : access physics.Model.item'Class;
owns_Graphics : in Boolean; owns_Graphics : in Boolean;
owns_Physics : in Boolean; owns_Physics : in Boolean;
is_Kinematic : in Boolean := False) is_Kinematic : in Boolean := False;
user_Data : in any_user_Data_view := null)
is is
use type physics.Model.view; use type physics.Model.view;
begin begin
@@ -120,6 +121,8 @@ is
Self.owns_Physics := owns_Physics; Self.owns_Physics := owns_Physics;
Self.is_Kinematic := is_Kinematic; Self.is_Kinematic := is_Kinematic;
Self.user_Data := user_Data;
-- set_Translation (Self.Transform, To => physics_Model.Site); -- set_Translation (Self.Transform, To => physics_Model.Site);
-- Physics -- Physics
@@ -128,7 +131,6 @@ is
then then
Self.rebuild_Shape; Self.rebuild_Shape;
Self.rebuild_Solid (at_Site); Self.rebuild_Solid (at_Site);
null;
end if; end if;
end define; end define;
@@ -228,13 +230,14 @@ is
physics_Model : access physics.Model.item'Class; physics_Model : access physics.Model.item'Class;
owns_Graphics : in Boolean; owns_Graphics : in Boolean;
owns_Physics : in Boolean; owns_Physics : in Boolean;
is_Kinematic : in Boolean := False) return Item is_Kinematic : in Boolean := False;
user_Data : in any_user_Data_view := null) return Item
is is
begin begin
return Self : Item := (lace.Subject_and_deferred_Observer.forge.to_Subject_and_Observer (Name) return Self : Item := (lace.Subject_and_deferred_Observer.forge.to_Subject_and_Observer (Name)
with others => <>) with others => <>)
do do
Self.define (World, at_Site, graphics_Model, physics_Model, owns_Graphics, owns_Physics, is_Kinematic); Self.define (World, at_Site, graphics_Model, physics_Model, owns_Graphics, owns_Physics, is_Kinematic, user_Data);
end return; end return;
end to_Sprite; end to_Sprite;
@@ -247,7 +250,8 @@ is
physics_Model : access physics.Model.item'Class; physics_Model : access physics.Model.item'Class;
owns_Graphics : in Boolean := True; owns_Graphics : in Boolean := True;
owns_Physics : in Boolean := True; owns_Physics : in Boolean := True;
is_Kinematic : in Boolean := False) return View is_Kinematic : in Boolean := False;
user_Data : in any_user_Data_view := null) return View
is is
Self : constant View := new Item' (to_Sprite (Name, Self : constant View := new Item' (to_Sprite (Name,
World, World,
@@ -256,8 +260,10 @@ is
physics_Model, physics_Model,
owns_Graphics, owns_Graphics,
owns_Physics, owns_Physics,
is_Kinematic)); is_Kinematic,
user_Data => user_Data));
begin begin
return Self; return Self;
end new_Sprite; end new_Sprite;
@@ -469,6 +475,24 @@ is
end Shape; end Shape;
function user_Data (Self : in Item) return any_user_Data_view
is
begin
return Self.user_Data;
end user_Data;
procedure user_Data_is (Self : in out Item; Now : in any_user_Data_view)
is
begin
Self.user_Data := Now;
end user_Data_is;
------------- -------------
--- Dynamics --- Dynamics
-- --

View File

@@ -12,6 +12,7 @@ with
lace.Subject_and_deferred_Observer, lace.Subject_and_deferred_Observer,
lace.Response, lace.Response,
lace.Any,
ada.Containers.Vectors; ada.Containers.Vectors;
@@ -35,7 +36,10 @@ is
type physics_Space_view is access all physics.Space.item'Class; type physics_Space_view is access all physics.Space.item'Class;
type World_view is access all gel.World.item'Class; type World_view is access all gel.World .item'Class;
type any_user_Data is new lace.Any.limited_item with null record;
type any_user_Data_view is access all any_user_Data'Class;
use Math; use Math;
@@ -62,7 +66,8 @@ is
physics_Model : access physics.Model.item'Class; physics_Model : access physics.Model.item'Class;
owns_Graphics : in Boolean; owns_Graphics : in Boolean;
owns_Physics : in Boolean; owns_Physics : in Boolean;
is_Kinematic : in Boolean := False); is_Kinematic : in Boolean := False;
user_Data : in any_user_Data_view := null);
procedure destroy (Self : access Item; and_Children : in Boolean); procedure destroy (Self : access Item; and_Children : in Boolean);
function is_Destroyed (Self : in Item) return Boolean; function is_Destroyed (Self : in Item) return Boolean;
@@ -78,7 +83,8 @@ is
physics_Model : access physics.Model.item'Class; physics_Model : access physics.Model.item'Class;
owns_Graphics : in Boolean; owns_Graphics : in Boolean;
owns_Physics : in Boolean; owns_Physics : in Boolean;
is_Kinematic : in Boolean := False) return Item; is_Kinematic : in Boolean := False;
user_Data : in any_user_Data_view := null) return Item;
function new_Sprite (Name : in String; function new_Sprite (Name : in String;
World : in World_view; World : in World_view;
@@ -87,7 +93,8 @@ is
physics_Model : access physics.Model.item'Class; physics_Model : access physics.Model.item'Class;
owns_Graphics : in Boolean := True; owns_Graphics : in Boolean := True;
owns_Physics : in Boolean := True; owns_Physics : in Boolean := True;
is_Kinematic : in Boolean := False) return View; is_Kinematic : in Boolean := False;
user_Data : in any_user_Data_view := null) return View;
end Forge; end Forge;
@@ -140,6 +147,10 @@ is
function to_GEL (the_Solid : in physics_Object_view) return gel.Sprite.view; function to_GEL (the_Solid : in physics_Object_view) return gel.Sprite.view;
function user_Data (Self : in Item) return any_user_Data_view;
procedure user_Data_is (Self : in out Item; Now : in any_user_Data_view);
------------- -------------
--- Dynamics --- Dynamics
-- --
@@ -406,6 +417,7 @@ private
is_Visible : Boolean := True; is_Visible : Boolean := True;
key_Response : lace.Response.view; key_Response : lace.Response.view;
user_Data : any_user_Data_view;
is_Destroyed : Boolean := False; is_Destroyed : Boolean := False;
end record; end record;