asfml_2.6.0_24478793/tests/graphics/main.adb

 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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
with Sf.Graphics.Rect;
with Sf.System.Vector2;
with Ada.Wide_Wide_Text_IO; use Ada.Wide_Wide_Text_IO;

procedure Main is

   FloatRectangle : aliased constant Sf.Graphics.Rect.sfFloatRect := (0.00, 0.00, 100.00, 100.00);
   IntegerRectangle : aliased constant Sf.Graphics.Rect.sfIntRect := (0, 0, 100, 100);

   FloatPoint : constant Sf.System.Vector2.sfVector2f := (10.00, 10.00);
   IntegerPoint : constant Sf.System.Vector2.sfVector2i := (10, 10);

   OutFloatPoint : constant Sf.System.Vector2.sfVector2f := (200.00, 10.00);
   OutIntegerPoint : constant Sf.System.Vector2.sfVector2i := (200, 10);

begin


   case
     Sf.Graphics.Rect.contains (rect => FloatRectangle'Access,
                                x    => FloatPoint.x,
                                y    => FloatPoint.y)
   is
      when Sf.sfTrue =>
         Put_Line ("OK: Floatpoint is inside.");

      when Sf.sfFalse =>
         Put_Line ("Fail: Floatpoint is outside.");
   end case;

   case
     Sf.Graphics.Rect.contains (rect => IntegerRectangle'Access,
                                x    => Integer (IntegerPoint.x),
                                y    => Integer (IntegerPoint.y))
   is
      when Sf.sfTrue =>
         Put_Line ("OK: Integerpoint is inside.");

      when Sf.sfFalse =>
         Put_Line ("Fail: Integerpoint is outside.");
   end case;


   case
     Sf.Graphics.Rect.contains (rect => FloatRectangle'Access,
                                x    => OutFloatPoint.x,
                                y    => OutFloatPoint.y)
   is
      when Sf.sfTrue =>
         Put_Line ("Fail: OutFloatpoint is inside.");

      when Sf.sfFalse =>
         Put_Line ("OK: OutFloatpoint is outside.");
   end case;

   case
     Sf.Graphics.Rect.contains (rect => IntegerRectangle'Access,
                                x    => Integer (OutIntegerPoint.x),
                                y    => Integer (OutIntegerPoint.y))
   is
      when Sf.sfTrue =>
         Put_Line ("Fail: OutIntegerpoint is inside.");

      when Sf.sfFalse =>
         Put_Line ("OK: OutIntegerpoint is outside.");
   end case;

end Main;