-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
sfRenderStates "constructors" from shaders and textures #20
Comments
Hi @Fabien-Chouteau, Yes, the CSFML is sometimes minimal and only includes what is needed for bindings, but not general useful stuff for facilitating use of the library. In version 2.5.2 they had to add a function returning the default. Constructors in the original C++ are always exported as |
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
@Fabien-Chouteau, could you confirm it works for you? Then we can close the issue. At the end I have chosen a |
Thanks @mgrojo, I works! I also realized that adding default values to the type sfRenderStates is record
blendMode : aliased Sf.Graphics.BlendMode.sfBlendMode := Sf.Graphics.BlendMode.sfBlendAlpha;
transform : aliased Sf.Graphics.Transform.sfTransform := Sf.Graphics.Transform.Identity;
texture : sfTexture_Ptr := null;
shader : sfShader_Ptr := null;
end record; RS : aliased sfRenderStates := (shader => My_Shader, others => <>); |
I tend to avoid the record initializations because I've seen sometimes they could lead to a performance issue. But since there are two access fields, I suppose there is already an initialization function for the record, so it might make sense to include the others. I don't know if having both styles is going to be too much, but I'll add this without removing the function, because I like that for consistency to other types and to the C++ class. |
This will let the user choose between an initialization expression or the call to the create function. See issue: sfRenderStates "constructors" from shaders and textures #20
@Fabien-Chouteau I plan to publish a new release, and apparently this is fixed. Feel free to comment and/or reopen this if there is something still missing. |
Hi @mgrojo, the C++ API has constructors to create a default RenderStates from a shader;
This is convenient when one uses RenderStates just to apply shaders.
I think it should be doable to have something similar in Ada:
The text was updated successfully, but these errors were encountered: