- SDLAda bindings + Circle and Ellipse to main scene

This commit is contained in:
Vovanium 2023-08-03 14:06:29 +03:00
parent bad48ac68f
commit 9fdb601669
21 changed files with 39 additions and 708 deletions

View File

@ -3,7 +3,7 @@
.PHONY : examples
examples : build/share/video/visi.bmp
gprbuild -P gpr/example_sdl.gpr
gprbuild -P gpr/example_sdl_minimal.gpr
build/share/video/% : examples/data/%
mkdir -p $(@D)

View File

@ -1,16 +0,0 @@
with "../gpr/video_sdl";
project Example_SDL extends "video_common" is
for Object_Dir use Object_Path;
for Exec_Dir use Exec_Path;
for Source_Dirs use (Source_Path & "/examples");
for Main use (
"example_sdl_raster.adb",
"example_sdl_render.adb",
"example_sdl_surface.adb");
package Linker is
for Default_Switches("Ada") use ("-lSDL2_image", "-lSDL2_ttf");
end Linker;
end Example_SDL;

View File

@ -1,17 +0,0 @@
with "video_base";
with "sdlada";
project Video_SDL extends "video_common" is
for Library_Name use "Video_SDL";
for Library_Kind use "static";
for Source_Dirs use (Source_Path & "/sdl");
for Object_Dir use Object_Path;
for Library_Dir use Library_Path;
package Linker is
for Linker_Options use ("-lSDL2");
end Linker;
end Video_SDL;

View File

@ -4,7 +4,7 @@ generic
with function From_Color (Color : Colors.Color) return Pixel is <>;
package Video.Pixels.Generic_Renderers.Color is
type Color_Renderer is limited new Renderer and Renderables.Color.Renderable with null record;
type Color_Renderer is limited new Renderer and Renderables.Color.Curve_Renderable with null record;
procedure Clear (
Target : in out Color_Renderer;

View File

@ -7,7 +7,7 @@ generic
with package Pixel_Renderables is new Video.Renderables.Paint_Renderables (Pixel);
package Video.Pixels.Generic_Renderers is
type Renderer (Target : access Pixel_Array) is limited new Pixel_Renderables.Renderable with null record;
type Renderer (Target : access Pixel_Array) is limited new Pixel_Renderables.Curve_Renderable with null record;
overriding function Bounding_Box (S : Renderer) return Integer_Geometry.Box
is (X => (S.Target'First (2), S.Target'Last (2) - 1), Y => (S.Target'First (1), S.Target'Last (1) - 1));

View File

@ -35,18 +35,32 @@ package Video.Renderables with Pure is
procedure Write_Pixel (
Target : in out Renderable;
A : in Integer_Geometry.Point;
A : in Point;
Paint : in Paint_Type) is abstract;
procedure Fill_Rectangle (
Target : in out Renderable;
Bounds : in Integer_Geometry.Box;
Bounds : in Box;
Paint : in Paint_Type) is abstract;
procedure Line (
Target : in out Renderable;
A, B : in Integer_Geometry.Point;
A, B : in Point;
Paint : in Paint_Type) is abstract;
type Curve_Renderable is limited interface and Renderable;
procedure Circle (
Target : in out Curve_Renderable;
Center : in Point;
Radius : in Distance;
Paint : in Paint_Type) is abstract;
procedure Ellipse (
Target : in out Curve_Renderable;
Bounds : in Box;
Paint : in Paint_Type) is abstract;
end Paint_Renderables;
end Video.Renderables;

View File

@ -1,7 +1,7 @@
with Video.Colors;
with Video.Integer_Geometry;
procedure Example_Scene (R : in out Video.Renderables.Color.Renderable'Class) is
procedure Example_Scene (R : in out Video.Renderables.Color.Curve_Renderable'Class) is
BB : constant Video.Integer_Geometry.Box := R.Bounding_Box;
Center : constant Video.Integer_Geometry.Point := Video.Integer_Geometry.Center (BB);
begin
@ -19,11 +19,22 @@ begin
end loop;
end loop;
for X in BB.X.First / 8 .. BB.X.Last / 8 loop
R.Line (
A => Center,
B => (X * 8, BB.Y.Last),
Paint => Video.Colors.Hex_6 (16#FFFFFF#));
end loop;
for X in BB.X.First / 8 .. BB.X.Last / 8 loop
R.Line (
A => Center,
B => (X * 8, BB.Y.Last),
Paint => Video.Colors.Hex_6 (16#FFFFFF#));
end loop;
for X in 0 .. 10 loop
R.Circle ((Center.X, Center.Y), X * 10,
Paint => Video.Colors.Hex_6 (16#FF00FF#));
end loop;
for X in 0 .. 10 loop
R.Ellipse (((Center.X - X * 20, Center.X + X * 20),
(Center.Y - 200 + X * 20, Center.Y + 200 - X * 20)),
Paint => Video.Colors.Hex_6 (16#00FFFF#));
end loop;
end Example_Scene;

View File

@ -1,3 +1,3 @@
with Video.Renderables.Color;
procedure Example_Scene (R : in out Video.Renderables.Color.Renderable'Class);
procedure Example_Scene (R : in out Video.Renderables.Color.Curve_Renderable'Class);

View File

@ -1,80 +0,0 @@
with Ada.Text_IO, Ada.Integer_Text_IO;
use Ada.Text_IO, Ada.Integer_Text_IO;
with Interfaces.C;
with SDL.Video.Windows.Makers;
with SDL.Video.Surfaces.Makers;
with SDL.Events.Events;
with SDL.Images.IO;
with Video.Colors;
with Video.Integer_Geometry;
with Video.SDL2.Surfaces;
with Video.Pixels.RGB.Renderers;
with Example_Scene;
procedure Example_SDL_Raster is
procedure Create_From_Array is new SDL.Video.Surfaces.Makers.Create_From_Array (
Element => Video.Pixels.RGB.RGB565_Pixel,
Index => Integer,
Element_Array => Video.Pixels.RGB.RGB565_Array);
Screen_Width : constant := 640;
Screen_Height : constant := 480;
Wnd : aliased SDL.Video.Windows.Window;
Screen : aliased Video.Pixels.RGB.RGB565_Array := (0 .. Screen_Height - 1 => (0 .. Screen_Width - 1 => <>));
Img : Video.SDL2.Surfaces.SDL_Surface;
Ev : SDL.Events.Events.Events;
use type SDL.Events.Event_Types;
begin
if not SDL.Initialise (Flags => SDL.Enable_Screen) then
raise Program_Error;
end if;
SDL.Video.Windows.Makers.Create (
Win => Wnd,
Title => "Raster Draw",
Position => SDL.Natural_Coordinates'(
SDL.Video.Windows.Centered_Window_Position,
SDL.Video.Windows.Centered_Window_Position),
Size => SDL.Positive_Sizes'(Screen_Width, Screen_Height),
Flags => 0);
Create_From_Array (Img.Data, Screen'Access,
Red_Mask => 16#F800#, Green_Mask => 16#07E0#, Blue_Mask => 16#001F#, Alpha_Mask => 0);
declare
Rend : Video.Pixels.RGB.Renderers.RGB565_Color_Renderers.Color_Renderer (Screen'Access);
begin
Example_Scene (Rend);
for X in 0 .. 10 loop
Rend.Circle ((Screen_Width / 2, Screen_Height / 2), X * 10,
Color => Video.Colors.Hex_6 (16#FF00FF#));
end loop;
for X in 0 .. 10 loop
Rend.Ellipse (((Screen_Width / 2 - X * 20, Screen_Width / 2 + X * 20),
(Screen_Height / 2 - 200 + X * 20, Screen_Height / 2 + 200 - X * 20)),
Color => Video.Colors.Hex_6 (16#00FFFF#));
end loop;
end;
declare
Surf : Video.SDL2.Surfaces.Window_Surface (Wnd'Access);
begin
Surf.Paste ((0, 0), Img);
end;
Wait : loop
while SDL.Events.Events.Poll (Ev) loop
exit Wait when Ev.Common.Event_Type = SDL.Events.Quit;
end loop;
end loop Wait;
Wnd.Finalize;
SDL.Finalise;
end Example_SDL_Raster;

View File

@ -1,56 +0,0 @@
with Ada.Text_IO, Ada.Integer_Text_IO;
use Ada.Text_IO, Ada.Integer_Text_IO;
with Interfaces.C;
with SDL.Video.Windows.Makers;
with SDL.Video.Renderers.Makers;
with SDL.Events.Events;
with SDL.Images.IO;
with Video.Colors;
with Video.Integer_Geometry;
with Video.SDL2.Renderers;
with Video.SDL2.Textures;
with Example_Scene;
procedure Example_SDL_Render is
Screen_Width : constant := 640;
Screen_Height : constant := 480;
Wnd : aliased SDL.Video.Windows.Window;
Ev : SDL.Events.Events.Events;
use type SDL.Events.Event_Types;
begin
if not SDL.Initialise (Flags => SDL.Enable_Screen) then
raise Program_Error;
end if;
SDL.Video.Windows.Makers.Create (
Win => Wnd,
Title => "Hello World",
Position => SDL.Natural_Coordinates'(
SDL.Video.Windows.Centered_Window_Position,
SDL.Video.Windows.Centered_Window_Position),
Size => SDL.Positive_Sizes'(Screen_Width, Screen_Height),
Flags => 0);
declare
Rend : Video.SDL2.Renderers.SDL_Renderer;
Img : Video.SDL2.Textures.SDL_Texture;
begin
SDL.Video.Renderers.Makers.Create (Rend.Data, Wnd);
Example_Scene (Rend);
-- SDL.Images.IO.Create (Img.Data, Rend.Data, "build/share/video/visi.bmp");
-- Rend.Paste ((10, 10), Img);
end;
Wait : loop
while SDL.Events.Events.Poll (Ev) loop
exit Wait when Ev.Common.Event_Type = SDL.Events.Quit;
end loop;
end loop Wait;
Wnd.Finalize;
SDL.Finalise;
end Example_SDL_Render;

View File

@ -1,29 +0,0 @@
with SDL.Video.Palettes;
package body Video.SDL2.Colors is
function To_SDL (Color : Video.Colors.Color) return SDL.Video.Palettes.Colour is
begin
return (
Red => SDL.Video.Palettes.Colour_Component (Video.Colors.To_8_Bit (Color.R)),
Green => SDL.Video.Palettes.Colour_Component (Video.Colors.To_8_Bit (Color.G)),
Blue => SDL.Video.Palettes.Colour_Component (Video.Colors.To_8_Bit (Color.B)),
Alpha => SDL.Video.Palettes.Colour_Component (Video.Colors.To_8_Bit (Color.A)));
end;
function To_Pixel (
Format : SDL.Video.Pixel_Formats.Pixel_Format_Access;
Color : Video.Colors.Color)
return Unsigned_32
is
begin
return SDL.Video.Pixel_Formats.To_Pixel (
Format => Format,
Red => SDL.Video.Palettes.Colour_Component (Video.Colors.To_8_Bit (Color.R)),
Green => SDL.Video.Palettes.Colour_Component (Video.Colors.To_8_Bit (Color.G)),
Blue => SDL.Video.Palettes.Colour_Component (Video.Colors.To_8_Bit (Color.B)),
Alpha => SDL.Video.Palettes.Colour_Component (Video.Colors.To_8_Bit (Color.A)));
end;
end Video.SDL2.Colors;

View File

@ -1,13 +0,0 @@
with Video.Colors;
with SDL.Video.Pixel_Formats;
with SDL.Video.Palettes;
package Video.SDL2.Colors is
function To_SDL (Color : Video.Colors.Color) return SDL.Video.Palettes.Colour;
function To_Pixel (
Format : SDL.Video.Pixel_Formats.Pixel_Format_Access;
Color : Video.Colors.Color)
return Unsigned_32;
end Video.SDL2.Colors;

View File

@ -1,37 +0,0 @@
with SDL.Video.Rectangles;
use type SDL.Coordinate;
use type SDL.Natural_Dimension;
with Video.Integer_Geometry;
use Video.Integer_Geometry;
package Video.SDL2.Rectangles is
function To_Interval (
X : SDL.Coordinate;
W : SDL.Natural_Dimension)
return Interval
is (First => Coordinate (X), Last => Coordinate (X + W));
function From_SDL (P : SDL.Video.Rectangles.Point) return Point
is (X => Coordinate (P.X), Y => Coordinate (P.Y));
function To_SDL (P : Point) return SDL.Video.Rectangles.Point
is (X => SDL.Coordinate (P.X), Y => SDL.Coordinate (P.Y));
function From_SDL (R : SDL.Sizes) return Box
is (X => (0, Coordinate (R.Width)), Y => (0, Coordinate (R.Height)));
function From_SDL (R : SDL.Video.Rectangles.Rectangle) return Box
is (X => To_Interval (R.X, R.Width), Y => To_Interval (R.Y, R.Height));
function To_SDL (B : Box) return SDL.Video.Rectangles.Rectangle is (
X => SDL.Coordinate (B.X.First),
Y => SDL.Coordinate (B.Y.First),
Width => SDL.Natural_Dimension (Length (B.X)),
Height => SDL.Natural_Dimension (Length (B.Y)));
function To_SDL_Line_Segment (A, B : Point) return SDL.Video.Rectangles.Line_Segment is (
Start => To_SDL (A),
Finish => To_SDL (B));
end Video.SDL2.Rectangles;

View File

@ -1,75 +0,0 @@
with SDL.Video.Rectangles;
with Video.Integer_Geometry;
with Video.SDL2.Rectangles;
with Video.SDL2.Colors;
use type Video.Integer_Geometry.Box;
package body Video.SDL2.Renderers is
procedure Finalize (Target : in out SDL_Renderer) is
begin
Target.Sync;
end Finalize;
procedure Sync (Target : in out SDL_Renderer) is
begin
Target.Data.Present;
end Sync;
function Bounding_Box (R : SDL_Renderer) return Integer_Geometry.Box is
Rect : SDL.Video.Rectangles.Rectangle;
begin
R.Data.Get_Viewport (Rect);
return Video.SDL2.Rectangles.From_SDL (Rect);
end Bounding_Box;
procedure Clear (
Target : in out SDL_Renderer;
Color : Video.Colors.Color)
is
begin
Target.Data.Set_Draw_Colour (Video.SDL2.Colors.To_SDL (Color));
Target.Data.Clear;
end Clear;
procedure Write_Pixel (
Target : in out SDL_Renderer;
A : Integer_Geometry.Point;
Color : Video.Colors.Color)
is
begin
Target.Data.Set_Draw_Colour (Video.SDL2.Colors.To_SDL (Color));
Target.Data.Draw (Rectangles.To_SDL (A));
end Write_Pixel;
procedure Fill_Rectangle (
Target : in out SDL_Renderer;
Bounds : Integer_Geometry.Box;
Color : Video.Colors.Color)
is
begin
Target.Data.Set_Draw_Colour (Video.SDL2.Colors.To_SDL (Color));
Target.Data.Fill (Rectangles.To_SDL (Bounds));
end Fill_Rectangle;
procedure Line (
Target : in out SDL_Renderer;
A, B : in Integer_Geometry.Point;
Paint : in Video.Colors.Color)
is
begin
Target.Data.Set_Draw_Colour (Video.SDL2.Colors.To_SDL (Paint));
Target.Data.Draw (Rectangles.To_SDL_Line_Segment (A, B));
end;
procedure Paste (
Target : in out SDL_Renderer;
A : Integer_Geometry.Point;
Source : Textures.SDL_Texture)
is
begin
Target.Data.Copy (Source.Data, Rectangles.To_SDL (Source.Bounding_Box + A));
end Paste;
end Video.SDL2.Renderers;

View File

@ -1,46 +0,0 @@
with Ada.Finalization;
with SDL.Video.Renderers;
with Video.Colors;
with Video.Integer_Geometry;
with Video.Renderables.Color;
with Video.SDL2.Textures;
package Video.SDL2.Renderers is
type SDL_Renderer is limited new Ada.Finalization.Limited_Controlled
and Video.Renderables.Color.Renderable
and Textures.Texture_Renderables.Sprite_Renderable with record
Data : SDL.Video.Renderers.Renderer;
end record;
overriding function Bounding_Box (R : SDL_Renderer) return Integer_Geometry.Box;
overriding procedure Clear (
Target : in out SDL_Renderer;
Color : in Video.Colors.Color);
overriding procedure Write_Pixel (
Target : in out SDL_Renderer;
A : in Integer_Geometry.Point;
Color : in Video.Colors.Color);
overriding procedure Fill_Rectangle (
Target : in out SDL_Renderer;
Bounds : in Integer_Geometry.Box;
Color : in Video.Colors.Color);
overriding procedure Line (
Target : in out SDL_Renderer;
A, B : in Integer_Geometry.Point;
Paint : in Video.Colors.Color);
overriding procedure Paste (
Target : in out SDL_Renderer;
A : in Integer_Geometry.Point;
Source : in Textures.SDL_Texture);
overriding procedure Finalize (Target : in out SDL_Renderer);
overriding procedure Sync (Target : in out SDL_Renderer);
end Video.SDL2.Renderers;

View File

@ -1,42 +0,0 @@
with SDL.Video.Rectangles;
with SDL.TTFs;
use type SDL.TTFs.Font_Measurements;
with Video.Integer_Geometry;
use Video.Integer_Geometry;
package body Video.SDL2.Surfaces.TTFs is
function Extent (
Target : TTF_on_Surface;
Text : String)
return Texts.Text_Extent
is
Sizes : constant SDL.Sizes := Target.Typeface.Size_Latin_1 (Text);
Ascent : constant SDL.TTFs.Font_Measurements := Target.Typeface.Ascent;
Extent : constant Texts.Text_Extent := (
Bounds => Rectangles.From_SDL (SDL.Video.Rectangles.Rectangle'(
X => Interfaces.C.int (-Ascent),
Y => 0,
Width => Sizes.Width,
Height => Sizes.Height)),
Advance => Rectangles.From_SDL ((X => Sizes.Width, Y => 0))
);
begin
return Extent;
end Extent;
procedure Write (
Target : in out TTF_on_Surface;
A : in Integer_Geometry.Point;
Text : in String)
is
Extent : Texts.Text_Extent := Target.Extent (Text);
Src : SDL_Surface;
begin
Src.Data := Target.Typeface.Render_Solid (Text => Text, Colour => Target.Foreground);
Target.Target.Paste (
A => A + (Extent.Bounds.X.First, Extent.Bounds.Y.First),
Source => Src);
end Write;
end Video.SDL2.Surfaces.TTFs;

View File

@ -1,22 +0,0 @@
with SDL.TTFs;
with SDL.Video.Palettes;
with Video.Texts;
package Video.SDL2.Surfaces.TTFs is
type TTF_on_Surface (Target : access SDL_Surface'Class) is limited new Video.Texts.String_Writables.Writable with record
Typeface : SDL.TTFs.Fonts;
Foreground : SDL.Video.Palettes.Colour;
end record;
overriding function Extent (
Target : TTF_on_Surface;
Text : String)
return Texts.Text_Extent;
overriding procedure Write (
Target : in out TTF_on_Surface;
A : in Integer_Geometry.Point;
Text : in String);
end Video.SDL2.Surfaces.TTFs;

View File

@ -1,147 +0,0 @@
with SDL.Video.Pixel_Formats;
with SDL.Video.Palettes;
with SDL.Video.Rectangles;
with Video.SDL2.Colors;
with Video.SDL2.Rectangles;
with Video.Algorithms.Generic_Line;
package body Video.SDL2.Surfaces is
use type Video.Integer_Geometry.Box;
function To_Paint (
Target : SDL_Surface;
Color : Video.Colors.Color)
return Unsigned_32
is
begin
return Colors.To_Pixel (Target.Data.Pixel_Format, Color);
end To_Paint;
procedure Clear (
Target : in out SDL_Surface;
Paint : Unsigned_32)
is
begin
Target.Data.Fill (
Area => (
X => 0,
Y => 0,
Width => Target.Data.Size.Width, Height => Target.Data.Size.Height),
Colour => Paint);
end Clear;
procedure Clear (
Target : in out SDL_Surface;
Color : Video.Colors.Color)
is
begin
Target.Data.Fill (
Area => (
X => 0,
Y => 0,
Width => Target.Data.Size.Width, Height => Target.Data.Size.Height),
Colour => Colors.To_Pixel (Target.Data.Pixel_Format, Color));
end Clear;
procedure Write_Pixel (
Target : in out SDL_Surface;
A : Integer_Geometry.Point;
Paint : Unsigned_32)
is
begin
Target.Data.Fill (
Area => (
X => SDL.Coordinate (A.X),
Y => SDL.Coordinate (A.Y),
Width => 1, Height => 1),
Colour => Paint);
end Write_Pixel;
procedure Write_Pixel (
Target : in out SDL_Surface;
A : Integer_Geometry.Point;
Color : Video.Colors.Color)
is
begin
Target.Data.Fill (
Area => (
X => SDL.Coordinate (A.X),
Y => SDL.Coordinate (A.Y),
Width => 1, Height => 1),
Colour => Colors.To_Pixel (Target.Data.Pixel_Format, Color));
end Write_Pixel;
procedure Fill_Rectangle (
Target : in out SDL_Surface;
Bounds : Integer_Geometry.Box;
Paint : Unsigned_32)
is
begin
Target.Data.Fill (
Area => Rectangles.To_SDL (Bounds),
Colour => Paint);
end Fill_Rectangle;
procedure Fill_Rectangle (
Target : in out SDL_Surface;
Bounds : Integer_Geometry.Box;
Color : Video.Colors.Color)
is
begin
Target.Data.Fill (
Area => Rectangles.To_SDL (Bounds),
Colour => Colors.To_Pixel (Target.Data.Pixel_Format, Color));
end Fill_Rectangle;
procedure Inner_Line is new Algorithms.Generic_Line (
Raster => SDL_Surface,
Paint => Interfaces.Unsigned_32,
Write_Pixel => Write_Pixel);
procedure Line (
Target : in out SDL_Surface;
A, B : in Integer_Geometry.Point;
Color : in Interfaces.Unsigned_32)
is
begin
Inner_Line (Target, A, B, A, B, Color);
end Line;
procedure Line (
Target : in out SDL_Surface;
A, B : in Integer_Geometry.Point;
Color : in Video.Colors.Color)
is
begin
Target.Line (A, B, Colors.To_Pixel (Target.Data.Pixel_Format, Color));
end Line;
procedure Paste (
Target : in out SDL_Surface;
A : Integer_Geometry.Point;
Source : Readable_Surface'Class)
is
B : Integer_Geometry.Box := Source.Bounding_Box;
S, T : SDL.Video.Rectangles.Rectangle;
begin
S := SDL2.Rectangles.To_SDL (B);
T := SDL2.Rectangles.To_SDL (B + A);
Target.Data.Blit (T, Source.Data, S);
end Paste;
procedure Initialize (S : in out Window_Surface) is
begin
S.Data := S.Window.Get_Surface;
end Initialize;
procedure Finalize (S : in out Window_Surface) is
begin
S.Sync;
end Finalize;
procedure Sync (S : in out Window_Surface) is
begin
S.Window.Update_Surface;
end Sync;
end Video.SDL2.Surfaces;

View File

@ -1,90 +0,0 @@
with Ada.Finalization;
with Video.Integer_Geometry;
with Video.Colors;
with Video.Renderables.Color;
with Video.Renderables.Generic_Sprite;
with Video.SDL2.Rectangles;
with SDL.Video.Surfaces;
with SDL.Video.Windows;
use type SDL.Dimension;
package Video.SDL2.Surfaces is
type Readable_Surface is limited new Ada.Finalization.Limited_Controlled with record
Data : SDL.Video.Surfaces.Surface;
end record;
function Bounding_Box (S : Readable_Surface) return Video.Integer_Geometry.Box
is (Rectangles.From_SDL (S.Data.Size));
package Surface_Renderables is new Renderables.Generic_Sprite (Readable_Surface'Class);
package Pixel_Renderables is new Video.Renderables.Paint_Renderables (Interfaces.Unsigned_32);
type SDL_Surface is limited new Readable_Surface
and Pixel_Renderables.Renderable
and Video.Renderables.Color.Renderable
and Surface_Renderables.Sprite_Renderable with null record;
function To_Paint (
Target : SDL_Surface;
Color : Video.Colors.Color)
return Interfaces.Unsigned_32;
overriding procedure Clear (
Target : in out SDL_Surface;
Paint : in Interfaces.Unsigned_32);
overriding procedure Clear (
Target : in out SDL_Surface;
Color : in Video.Colors.Color);
overriding procedure Write_Pixel (
Target : in out SDL_Surface;
A : in Integer_Geometry.Point;
Paint : in Interfaces.Unsigned_32);
overriding procedure Write_Pixel (
Target : in out SDL_Surface;
A : in Integer_Geometry.Point;
Color : in Video.Colors.Color);
overriding procedure Fill_Rectangle (
Target : in out SDL_Surface;
Bounds : in Integer_Geometry.Box;
Paint : in Interfaces.Unsigned_32);
overriding procedure Fill_Rectangle (
Target : in out SDL_Surface;
Bounds : in Integer_Geometry.Box;
Color : in Video.Colors.Color);
overriding procedure Line (
Target : in out SDL_Surface;
A, B : in Integer_Geometry.Point;
Color : in Interfaces.Unsigned_32);
overriding procedure Line (
Target : in out SDL_Surface;
A, B : in Integer_Geometry.Point;
Color : in Video.Colors.Color);
overriding procedure Paste (
Target : in out SDL_Surface;
A : Integer_Geometry.Point;
Source : Readable_Surface'Class);
--
type Window_Surface (Window : not null access SDL.Video.Windows.Window)
is limited new SDL_Surface with null record;
overriding procedure Initialize (S : in out Window_Surface);
overriding procedure Finalize (S : in out Window_Surface);
overriding procedure Sync (S : in out Window_Surface);
private
end Video.SDL2.Surfaces;

View File

@ -1,18 +0,0 @@
with SDL.Video.Textures;
with Video.Integer_Geometry;
with Video.Renderables.Generic_Sprite;
with Video.SDL2.Rectangles;
package Video.SDL2.Textures is
type SDL_Texture is tagged limited record
Data : SDL.Video.Textures.Texture;
end record;
function Bounding_Box (R : SDL_Texture) return Integer_Geometry.Box
is (Rectangles.From_SDL (R.Data.Get_Size));
package Texture_Renderables is new Renderables.Generic_Sprite (SDL_Texture);
end Video.SDL2.Textures;

View File

@ -1,6 +0,0 @@
with Interfaces.C;
use Interfaces;
package Video.SDL2 with Pure is
end Video.SDL2;