Welcome, Guest. Please login or register. Did you miss your activation email?

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - cjlucas

Pages: [1]
1
DotNet / Set* methods don't display for Sprite
« on: April 04, 2011, 11:47:20 am »
Alright, I see what you're saying now. This should probably be mentioned in the tutorials; there's almost nothing in there about the DotNet library, so I went off the assumption that it was going to be supplied with the same member interface.

2
DotNet / Set* methods don't display for Sprite
« on: April 04, 2011, 10:26:53 am »
Right, the post has more to do with the fact that the Set* methods are missing in the DotNet wrapper for the SFML. Here is some code you can put into Sprite.cs in order to get these exposed to DotNet:

Code: [Select]

            public void SetColor(byte red, byte green, byte blue, byte alpha)
            {
                sfSprite_SetColor(This, new Color(red, green, blue, alpha));
            }
            public void SetPosition(float x, float y)
            {
                sfSprite_SetPosition(This, x, y);
            }
            public void SetX(float x)
            {
                sfSprite_SetX(This, x);
            }
            public void SetY(float y)
            {
                sfSprite_SetY(This, y);
            }
            public void SetRotation(float Rotation)
            {
                sfSprite_SetRotation(This, Rotation);
            }
            public void SetCenter(float x, float y)
            {
                sfSprite_SetCenter(This, x, y);
            }
            public void SetScale(float x, float y)
            {
                sfSprite_SetScale(This, x, y);
            }
            public void SetScaleX(float x)
            {
                sfSprite_SetScaleX(This, x);
            }
            public void SetScaleY(float y)
            {
                sfSprite_SetScaleY(This, y);
            }
            public void SetBlendMode(BlendMode Mode)
            {
                sfSprite_SetBlendMode(This, Mode);
            }

            // Additional Imports
            [DllImport("csfml-graphics"), SuppressUnmanagedCodeSecurity]
            static extern void sfSprite_SetScaleX(IntPtr This, float x);

            [DllImport("csfml-graphics"), SuppressUnmanagedCodeSecurity]
            static extern void sfSprite_SetScaleY(IntPtr This, float y);

            [DllImport("csfml-graphics"), SuppressUnmanagedCodeSecurity]
            static extern void sfSprite_SetX(IntPtr This, float x);

            [DllImport("csfml-graphics"), SuppressUnmanagedCodeSecurity]
            static extern void sfSprite_SetY(IntPtr This, float y);


Every method was tested to see if it works. The only ones that I am not 100% sure of is the SetCenter and SetBlendMode because I don't have a clue what they're trying to do.

3
DotNet / Set* methods don't display for Sprite
« on: April 04, 2011, 09:16:40 am »
Code: [Select]

Sprite S = new Sprite("Image.Jpg");
S.SetPosition(10, 10);


In the tutorial this should work for the C++ version of SFML; however, this gives an error indicating that SetPosition doesn't exist. When I use intellisense, none of the Set* methods exist (or at least they're not public). This is a bit perplexing as it seems like you can alternatively move based on setting the S.Position; however, you cannot do the following:

Code: [Select]

S.Position.X = 10;
S.Position.Y = 10;


But you can do this...

Code: [Select]

S.Position = new Vector2(10f, 10f);


I'd really hate to think I'd have to create a new object every time I want to set the position, so I'd like someone to tell me whether I'm doing this wrong of fix this problem. Thanks in advance.

Pages: [1]