48 lines
1.4 KiB
Ada
48 lines
1.4 KiB
Ada
with SDL.Video.Windows.Makers;
|
|
with SDL.Video.Renderers.Makers;
|
|
with SDL.Events.Events;
|
|
|
|
procedure Draw_A_Pixel is
|
|
|
|
Width : constant := 320;
|
|
Height : constant := 200;
|
|
|
|
Window : SDL.Video.Windows.Window;
|
|
Renderer : SDL.Video.Renderers.Renderer;
|
|
|
|
procedure Wait is
|
|
use type SDL.Events.Event_Types;
|
|
Event : SDL.Events.Events.Events;
|
|
begin
|
|
loop
|
|
while SDL.Events.Events.Poll (Event) loop
|
|
if Event.Common.Event_Type = SDL.Events.Quit then
|
|
return;
|
|
end if;
|
|
end loop;
|
|
delay 0.100;
|
|
end loop;
|
|
end Wait;
|
|
|
|
begin
|
|
if not SDL.Initialise (Flags => SDL.Enable_Screen) then
|
|
return;
|
|
end if;
|
|
|
|
SDL.Video.Windows.Makers.Create (Win => Window,
|
|
Title => "Draw a pixel",
|
|
Position => SDL.Natural_Coordinates'(X => 10, Y => 10),
|
|
Size => SDL.Positive_Sizes'(Width, Height),
|
|
Flags => 0);
|
|
SDL.Video.Renderers.Makers.Create (Renderer, Window.Get_Surface);
|
|
Renderer.Set_Draw_Colour ((0, 0, 0, 255));
|
|
Renderer.Fill (Rectangle => (0, 0, Width, Height));
|
|
Renderer.Set_Draw_Colour ((255, 0, 0, 255));
|
|
Renderer.Draw (Point => (100, 100));
|
|
Window.Update_Surface;
|
|
|
|
Wait;
|
|
Window.Finalize;
|
|
SDL.Finalise;
|
|
end Draw_A_Pixel;
|