Well this took me a while to figure out but I eventually did it. This post shows the user how to export data from spine to use it in c++, since the agk help command does not explain this very well.
Let us start with spineboy which is the common import the spine produces. After you have created your figure these are the following steps to export the image as well as how to use it in c++
Steps:
1. Click on the spine menu
2. Click Export.
3. Click on Setting.
4. Change the settings to following export.
5. Put these files in the media folder of your game .atlas, png, and the Jason exports files in the media folder of the application that you are building. Notes on the .atlas file: Make sure the .atlas file is the same name as the png file. The png file should be all contained within on sprite sheet that is of size 1024 by 1024 or less to work properly for the import.
6. This is an example of how you code it in c++.
// Includes
#include "template.h"
#include <vector>
// Namespace
using namespace AGK;
#include "addhouse.h"
app App;
int tweentime = 0.2;
int spineboy;
void app::Begin(void)
{
agk::SetVirtualResolution(1024, 768);
//void addhouse1pic1(float xpos, float ypos)
//addhouse3pic1(100, 10);
int img=agk::LoadImage("media/spineboy.png");
spineboy=agk::LoadSkeleton2DFromSpineFile("media/spineboy.json",1,img,1);
agk::SetSkeleton2DPosition(spineboy, 200, 500);
agk::PlaySkeleton2DAnimation(1, "walk", 0, 1, 0.3);
// agk::CreateSprite(img);
}
void app::Loop (void)
{
if (agk::GetSkeleton2DIsAnimating(spineboy) == 0)
{
agk::PlaySkeleton2DAnimation(spineboy, "walk", 0, 1, tweentime);
}
//endif
//agk::Print(agk::ReadInteger(fille));
agk::Sync();
}
This code does not work unless you use these element in loading the spine file in c++. in the begin portion you have to use loadimage agk command to store the image you wish to use. agk:
laySkeleton2DAnimation see help file for more information about this command.
Developer of Space Chips, pianobasic, zipzapzoom, and vet pinball apps. Developed the tiled map engine seen on the showcase. Veteran for the military.