Tilengine - The 2D retro graphics engine forum
TLN_SetSpritePivot with C# Binding - Printable Version

+- Tilengine - The 2D retro graphics engine forum (http://tilengine.org/forum)
+-- Forum: English forums (http://tilengine.org/forum/forumdisplay.php?fid=3)
+--- Forum: Support (http://tilengine.org/forum/forumdisplay.php?fid=7)
+--- Thread: TLN_SetSpritePivot with C# Binding (/showthread.php?tid=1083)



TLN_SetSpritePivot with C# Binding - Midnight Syntax - 04-01-2021

I wanted to move the pivots of my sprites around but I noticed that that C# binding didn't have the function implemented, I didn't think much of it and added it myself. For reference I put it in the Sprite struct and added it according to how you've implemented everything else. However when trying to call it I get: 

System.EntryPointNotFoundException: 'Unable to find an entry point named 'TLN_SetSpritePivot' in DLL 'Tilengine'.'


Is there a reason as to why the function isn't in the binding?

Here's the code I added for reference:
Code:
[DllImport("Tilengine")]
       [return: MarshalAs(UnmanagedType.I1)]
       private static extern bool TLN_SetSpritePivot(int nsprite, float px, float py);
.
.
.
.
.
/// <summary>
       ///
       /// </summary>
       /// <param name="nsprite"></param>
       /// <param name="px"></param>
       /// <param name="py"></param>
       public void SetPivot(int nsprite, float px, float py) {
           bool ok = TLN_SetSpritePivot(nsprite, px, py);
           Engine.ThrowException(ok);
       }



RE: TLN_SetSpritePivot with C# Binding - megamarc - 04-01-2021

Hi,
Binaries at itch.io weren't updated to 2.9.1, so they didn't had pivot implemented. Now I've just updated them, so you can grab them and have sprite pivot enabled.
Thanks for trying it!


RE: TLN_SetSpritePivot with C# Binding - Midnight Syntax - 04-02-2021

Updated and works, Thanks! Shy


RE: TLN_SetSpritePivot with C# Binding - megamarc - 04-02-2021

Great! Good to know   Smile