Advertisement
Guest User

Untitled

a guest
Jun 25th, 2017
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ada 2.59 KB | None | 0 0
  1.  
  2. with media.Video;
  3.  
  4.  
  5. with mmi.Window.sdl,
  6.      mmi.Applet,
  7.      mmi.Sprite.forge,
  8.      mmi.Model,
  9.      mmi.textured_box_Model;
  10.  
  11. with opengl.Texture,
  12.      opengl.Palette,
  13.      opengl.Face,
  14.      opengl.IO,
  15.      opengl.Face.lit_textured_geometry;
  16.  
  17. with Math;
  18.  
  19. with ada.Calendar,
  20.      ada.Strings.unbounded,
  21.      ada.text_IO;
  22.  
  23.  
  24.  
  25. procedure launch_video_Sprite
  26. --
  27. -- A sample program demonstrating ...
  28. --
  29. is
  30.    use openGL, opengl.Palette;
  31.  
  32.    use mmi.Applet,
  33.        mmi.textured_box_Model;
  34.  
  35.    use ada.calendar,
  36.        ada.Strings.unbounded,
  37.        ada.text_IO;
  38.  
  39.  
  40.    use type math.Real;
  41.  
  42.  
  43.    the_Movie     : media.Video.view      := media.Video.new_Video ("MVI_0922.ogv");
  44.  
  45.    the_Window    : mmi.Window.View       := mmi.window.sdl.Forge.new_Window ("video sprite Demo",
  46.                                                                              500, 500);
  47.    the_Applet    : mmi.Applet.view       := mmi.applet.forge.new_Applet (the_Window);
  48.  
  49.    the_Texture   : opengl.Texture.Object := opengl.Texture.to_Texture (the_Movie.next_Frame);
  50.  
  51.    the_box_Model : aliased mmi.textured_box_Model.item
  52.      := (mmi.Model.item with
  53.          scale => (10.0, 10.0, 1.0),
  54.          faces => (front => (colors => (others => (White,   Opaque)),  texture => the_Texture),
  55.                    rear  => (colors => (others => (Blue,    Opaque)),  texture => <>),
  56.                    upper => (colors => (others => (Green,   Opaque)),  texture => <>),
  57.                    lower => (colors => (others => (Yellow,  Opaque)),  texture => <>),
  58.                    left  => (colors => (others => (Cyan,    Opaque)),  texture => <>),
  59.                    right => (colors => (others => (Magenta, Opaque)),  texture => <>)));
  60.  
  61.    the_Box       : mmi.Sprite.view       := mmi.Sprite.forge.new_Sprite (the_box_Model'access,  mass => 0.0);
  62.  
  63.    next_render_Time  : ada.calendar.Time;
  64. begin
  65.    --- setup
  66.    --
  67.  
  68.    -- add box
  69.    --
  70.    the_Applet.add (the_Box);
  71.    the_Box.Site_is ((0.0,  -1.0,  0.0));
  72.  
  73.    -- user interface
  74.    --
  75.    the_Applet.Camera.Site_is ((0.0, 1.0, 15.0));
  76.    the_Applet.enable_Dolly;
  77.    the_Applet.enable_Mouse;
  78.  
  79.  
  80.    --- begin processing
  81.    --
  82.    next_render_Time := ada.Calendar.clock;
  83.  
  84.    while the_Applet.is_open loop
  85.       opengl.Texture.set_Image (the_Texture,  to => the_Movie.next_Frame);
  86.  
  87.       the_Applet.World.evolve (by => 1.0/60.0);
  88.       the_Applet.freshen;
  89.  
  90.       next_render_Time := next_render_Time + 1.0/60.0;
  91.       delay until next_render_Time;
  92.    end loop;
  93.  
  94.  
  95.    --- close
  96.    --
  97.    the_Applet.destroy;
  98.    the_Movie.destroy;
  99.  
  100. end launch_video_Sprite;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement