Hi Nate,
We're evaluating Spine tool, great tool, using skeleton way can save us more than 50% storage space. 😃
Currenly we need to translate our project from cocos2dx to my own new game engine, and the problem is my game engine doesn't use the vertex buffer thing in OpenGL to do rendering, but a software render library similar with GDI+ or cairo.
I think most of 2D software render library (gdi+, cairo, agg, .etc) have these APIs: Translate/Rotate/Scale/DrawClipImage.
I build a very simple sample codes using C# in the attachment (WRONG render result).
Following are the steps to run it:
1. Create a "Windows Form Application" project using Visual Studio. (I use VS2008)
2. Replace the generated file "Form1.cs" by the attachment file "Form1.txt", remember rename its extension to ".cs".
3. Reference "spine-csharp" library.
4. Copy sample data "data/spineboy.*" to the .EXE output folder. (I get these data from the project "spine-runtimes/spine-c/example" folder.)
Actually we don't need power functions, we just want to setup its position and do playback, that's all.
I'd spent 2 days in this issue with my poor matrix skeleton knowledge, but failed. 🙁
Could you help me to fix the character rendering issue?
Following are the render codes from the attachment Form1.cs file, if you want a quick preview. (WRONG render result):
private void DrawSkin(Graphics g)
{
foreach (Slot slot in skeleton.Slots)
{
if (slot.Attachment == null || slot.Attachment.GetType() != typeof(RegionAttachment))
continue;
RegionAttachment attach = (RegionAttachment)slot.Attachment;
AtlasRegion region = (AtlasRegion)attach.RendererObject;
g.ResetTransform();
g.TranslateTransform(charactorPosX, charactorPosY);
g.TranslateTransform(attach.X, attach.Y);
g.RotateTransform(attach.Rotation);
g.TranslateTransform(slot.Bone.WorldX, -slot.Bone.WorldY);
g.RotateTransform(slot.Bone.Rotation);
g.ScaleTransform(slot.Bone.ScaleX, slot.Bone.ScaleY);
Rectangle dstRC = new Rectangle(0, 0, region.width, region.height);
Rectangle srcRC = new Rectangle(region.x, region.y, region.width, region.height);
g.DrawImage((Image)region.page.rendererObject, dstRC, srcRC, GraphicsUnit.Pixel);
g.ResetTransform();
}
}