Skip to content

Commit

Permalink
sfRenderStates "constructors" from shaders and textures (issue #20)
Browse files Browse the repository at this point in the history
The set of constructors in the C++ API is conflated into a create function
with all possible default values in the parameters. Documentation inspired
by the C++ version.

Also, a default function is declared reusing those defaults in order to
match the following change made in CSFML:
SFML/CSFML#178
  • Loading branch information
mgrojo committed Jul 8, 2023
1 parent 8e579c2 commit c84ec88
Showing 1 changed file with 37 additions and 0 deletions.
37 changes: 37 additions & 0 deletions include/sf-graphics-renderstates.ads
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,43 @@ package Sf.Graphics.RenderStates is
end record;
type sfRenderStates_Ptr is access all sfRenderStates;


--//////////////////////////////////////////////////////////
--/ @brief Construct a set of render states with all its attributes
--/
--/ @param blendMode Blend mode to use
--/ @param transform Transform to use
--/ @param texture Texture to use
--/ @param shader Shader to use
--/
--/ If you want to use a single specific render state,
--/ for example a shader, you can call create with only one of the parameters,
--/ and then pass the result to the draw subprogram.
--//////////////////////////////////////////////////////////
function create
(BlendMode : Sf.Graphics.BlendMode.sfBlendMode := Sf.Graphics.BlendMode.sfBlendAlpha;
Transform : Sf.Graphics.Transform.sfTransform := Sf.Graphics.Transform.Identity;
Texture : sfTexture_Ptr := null;
Shader : sfShader_Ptr := null) return sfRenderStates
is (blendMode => blendMode,
transform => transform,
texture => texture,
shader => shader);

--//////////////////////////////////////////////////////////
--/ @brief Construct a default set of render states
--/
--/ Constructing a default set of render states is equivalent
--/ to calling create without parameters.
--/ The default set defines:
--/ - the BlendAlpha blend mode
--/ - the identity transform
--/ - a null texture
--/ - a null shader
--/
--//////////////////////////////////////////////////////////
function default return sfRenderStates is (create);

private
pragma Convention (C_Pass_By_Copy, sfRenderStates);
pragma Convention (C, sfRenderStates_Ptr);
Expand Down

0 comments on commit c84ec88

Please sign in to comment.