Add initial prototype.

This commit is contained in:
Rod Kay
2022-07-31 17:34:54 +10:00
commit 54a53b2ac0
1421 changed files with 358874 additions and 0 deletions

View File

@@ -0,0 +1,22 @@
with
"gel",
"lace_shared";
project Drop_Ball_On_Box
is
for Object_Dir use "build";
for Exec_Dir use ".";
for Main use ("launch_drop_ball_on_box.adb");
for Languages use ("Ada");
package Ide renames Lace_shared.Ide;
package Builder renames Lace_shared.Builder;
package Compiler renames Lace_shared.Compiler;
package Binder renames Lace_shared.Binder;
package Linker
is
for Linker_Options use ("-g", "-lGL", "-lGLU", "-lglut", "-lSDL2");
end Linker;
end Drop_Ball_On_Box;

View File

@@ -0,0 +1,76 @@
with
gel.Window.setup,
gel.Applet.gui_world,
gel.Forge,
gel.Sprite,
gel.World,
gel.Camera,
Physics,
ada.Text_IO,
ada.Exceptions;
pragma unreferenced (gel.Window.setup);
procedure launch_drop_Ball_on_Box
--
-- Drops a ball onto a box 'terrain'.
--
is
use gel.Applet,
gel.Applet.gui_world,
Ada.Text_IO;
the_Applet : gel.Applet.gui_world.view := gel.Forge.new_gui_Applet ("drop Ball on Box",
space_Kind => physics.Bullet);
function gui_World return gel.World.view
is
begin
return the_Applet.World (gui_world_Id);
end gui_World;
function gui_Camera return gel.Camera.view
is
begin
return the_Applet.Camera (gui_world_Id,
gui_camera_Id);
end gui_Camera;
the_Ball : constant gel.Sprite.view := gel.Forge.new_ball_Sprite (gui_World);
the_Box : constant gel.Sprite.view := gel.Forge.new_box_Sprite (gui_World,
Mass => 0.0,
Size => [20.0, 1.0, 20.0]);
begin
new_Line;
put_Line ("Use arrow keys and PgUp/PgDn to move the camera.");
new_Line;
gui_Camera.Site_is ([0.0, 2.0, 20.0]); -- Position the camera.
the_Applet.enable_simple_Dolly (in_World => gui_world_Id); -- Enable user camera control via keyboards.
the_Ball.Site_is ([0.0, 10.0, 0.0]);
gui_World.Gravity_is ([0.0, -9.8, 0.0]);
gui_World.add (the_Ball); -- Add ball.
gui_World.add (the_Box); -- Add box.
while the_Applet.is_open
loop
the_Applet.freshen; -- Handle any new events and update the screen.
end loop;
free (the_Applet);
exception
when E : others =>
new_Line;
put_Line ("Unhandled exception in main task ...");
put_Line (ada.Exceptions.exception_Information (E));
new_Line;
end launch_drop_Ball_on_Box;