Video_library/examples/hello_world_sdl.adb

27 lines
996 B
Ada
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

with Ada.Text_IO, Ada.Integer_Text_IO;
use Ada.Text_IO, Ada.Integer_Text_IO;
with Interfaces.C;
with Video.Backends.SDL.Windows;
with Video.Backends.SDL.Surfaces;
with Video.Backends.SDL.Message_Boxes;
use Video.Backends.SDL;
procedure Hello_World_SDL is
Screen_Width : constant := 640;
Screen_Height : constant := 480;
Wnd : Windows.Window_Access;
Surf : Surfaces.Surface_Access;
Err : Error_Code;
begin
Wnd := Windows.Create_Window ("Hello World",
Width => Screen_Width, Height => Screen_Height);
Surf := Windows.Get_Window_Surface (Wnd);
Put (Integer (Surf.w)); Put (" × "); Put (Integer (Surf.h)); New_Line;
Put ("Pitch: "); Put (Integer (Surf.pitch)); New_Line;
Put ("Bits per pixel: "); Put (Integer (Surf.format.Bits_Per_Pixel)); New_Line;
Put ("Bytes per pixel: "); Put (Integer (Surf.format.Bytes_Per_Pixel)); New_Line;
Err := Message_Boxes.Show_Message_Box (Title => "Hello World", Message => "Greetz!");
end Hello_World_SDL;