Superellipse: Difference between revisions
m
Ada: No use of SDL.Video.Surfaces
(Ada version) |
m (Ada: No use of SDL.Video.Surfaces) |
||
Line 19:
with SDL.Video.Windows.Makers;
with SDL.Video.
with SDL.Events.Events;
Line 28 ⟶ 26:
Width : constant := 600;
Height : constant := 600;
A : constant := 200.0;
B : constant := 200.0;
N : constant := 2.5;
Event : SDL.Events.Events.Events;
use SDL.C;▼
:= (X => Width / 2 + SDL.C.int (X),▼
procedure Draw_Superelipse
is
▲ use type SDL.C.int;
use Ada.Numerics.Elementary_Functions;
Xx, Yy : Float;
Line 59 ⟶ 46:
Yy := Float (Y - Height / 2);
if (abs (Xx / A)) ** N + (abs (Yy / B)) ** N in Legal_Range then
end if;
Line 84 ⟶ 72:
end if;
SDL.Video.Windows.Makers.Create (Win =>
Title => "Superelipse",
Position => SDL.Natural_Coordinates'(X => 10, Y => 10),
Size => SDL.Positive_Sizes'(Width, Height),
Flags => 0);
Renderer.Set_Draw_Colour ((0, 0, 0, 255));
Renderer.Set_Draw_Colour ((0, 220, 0, 255));
Draw_Superelipse;
Wait;
SDL.Finalise;
end Superelipse;</lang>
|