aboutsummaryrefslogtreecommitdiffstats
path: root/src/video.ads
blob: b6be6c88a8b7817bbe9d742211f7f11942080d04 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
with Sf;
with Sf.Graphics;
with Sf.Graphics.Image;
with Sf.Graphics.RenderWindow;
with Sf.Graphics.Sprite;
with Sf.Graphics.Texture;

package Video is
   use Sf;
   use Sf.Graphics;

   type Key is range 0 .. 15;
   type Key_Map is array (Key'Range) of Boolean;

   Width  : constant := 64;
   Height : constant := 32;
   Scale  : constant := 10;
   Title  : constant String := "Ada-Chip";

   procedure Clear_Screen;
   procedure Initialize;
   procedure Display;
   procedure Finish;

   function Key_Down (K : Key) return Boolean;
   function Key_Up (K : Key) return Boolean;
   function Is_Running return Boolean;
   function Toggle_Pixel (X, Y : sfUint32) return Boolean;

private
   Keys           : Key_Map;
   Pixels         : constant sfImage_Ptr   := Image.create (Width, Height);
   Pixels_Sprite  : constant sfSprite_Ptr  := Sprite.create;
   Pixels_Texture : constant sfTexture_Ptr :=
      Texture.createFromImage (Pixels);

   app : constant sfRenderWindow_Ptr := RenderWindow.create
      ((Width * Scale, Height * Scale, 32), Title);
end Video;