12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964 |
- /******************************************************************************
- * Spine Runtimes License Agreement
- * Last updated July 28, 2023. Replaces all prior versions.
- *
- * Copyright (c) 2013-2023, Esoteric Software LLC
- *
- * Integration of the Spine Runtimes into software or otherwise creating
- * derivative works of the Spine Runtimes is permitted under the terms and
- * conditions of Section 2 of the Spine Editor License Agreement:
- * http://esotericsoftware.com/spine-editor-license
- *
- * Otherwise, it is permitted to integrate the Spine Runtimes into software or
- * otherwise create derivative works of the Spine Runtimes (collectively,
- * "Products"), provided that each user of the Products must obtain their own
- * Spine Editor license and redistribution of the Products in any form must
- * include this license and copyright notice.
- *
- * THE SPINE RUNTIMES ARE PROVIDED BY ESOTERIC SOFTWARE LLC "AS IS" AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL ESOTERIC SOFTWARE LLC BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES,
- * BUSINESS INTERRUPTION, OR LOSS OF USE, DATA, OR PROFITS) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THE
- * SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *****************************************************************************/
- #include "spine-cpp-lite.h"
- #include <spine/spine.h>
- #include <spine/Version.h>
- #include <spine/Debug.h>
- using namespace spine;
- struct Block {
- int size;
- int allocated;
- uint8_t *memory;
- int free() {
- return size - allocated;
- }
- bool canFit(int numBytes) {
- return free() >= numBytes;
- }
- uint8_t *allocate(int numBytes) {
- uint8_t *ptr = memory + allocated;
- allocated += numBytes;
- return ptr;
- }
- };
- class BlockAllocator : public SpineObject {
- int initialBlockSize;
- Vector<Block> blocks;
- public:
- BlockAllocator(int initialBlockSize) : initialBlockSize(initialBlockSize) {
- blocks.add(newBlock(initialBlockSize));
- }
- ~BlockAllocator() {
- for (int i = 0, n = (int) blocks.size(); i < n; i++) {
- SpineExtension::free(blocks[i].memory, __FILE__, __LINE__);
- }
- }
- Block newBlock(int numBytes) {
- Block block = {MathUtil::max(initialBlockSize, numBytes), 0, nullptr};
- block.memory = SpineExtension::alloc<uint8_t>(block.size, __FILE__, __LINE__);
- return block;
- }
- template<typename T>
- T *allocate(size_t num) {
- return (T *) _allocate((int) (sizeof(T) * num));
- }
- void compress() {
- if (blocks.size() == 1) return;
- int totalSize = 0;
- for (int i = 0, n = blocks.size(); i < n; i++) {
- totalSize += blocks[i].size;
- SpineExtension::free(blocks[i].memory, __FILE__, __LINE__);
- }
- blocks.clear();
- blocks.add(newBlock(totalSize));
- }
- private:
- void *_allocate(int numBytes) {
- // 16-byte align allocations
- int alignedNumBytes = numBytes + (numBytes % 16 != 0 ? 16 - (numBytes % 16) : 0);
- Block *block = &blocks[blocks.size() - 1];
- if (!block->canFit(alignedNumBytes)) {
- blocks.add(newBlock(MathUtil::max(initialBlockSize, alignedNumBytes)));
- block = &blocks[blocks.size() - 1];
- }
- return block->allocate(alignedNumBytes);
- }
- };
- struct AnimationStateEvent {
- EventType type;
- TrackEntry *entry;
- Event *event;
- AnimationStateEvent(EventType type, TrackEntry *entry, Event *event) : type(type), entry(entry), event(event){};
- };
- struct EventListener : public AnimationStateListenerObject {
- Vector<AnimationStateEvent> events;
- void callback(AnimationState *state, EventType type, TrackEntry *entry, Event *event) {
- events.add(AnimationStateEvent(type, entry, event));
- SP_UNUSED(state);
- }
- };
- typedef struct _spine_atlas {
- void *atlas;
- utf8 **imagePaths;
- int32_t numImagePaths;
- utf8 *error;
- } _spine_atlas;
- typedef struct _spine_skeleton_data_result {
- spine_skeleton_data skeletonData;
- utf8 *error;
- } _spine_skeleton_data_result;
- typedef struct _spine_render_command {
- float *positions;
- float *uvs;
- int32_t *colors;
- int32_t *darkColors;
- int32_t numVertices;
- uint16_t *indices;
- int32_t numIndices;
- int32_t atlasPage;
- spine_blend_mode blendMode;
- struct _spine_render_command *next;
- } _spine_render_command;
- typedef struct _spine_bounds {
- float x, y, width, height;
- } _spine_bounds;
- typedef struct _spine_vector {
- float x, y;
- } _spine_vector;
- typedef struct _spine_skeleton_drawable : public SpineObject {
- spine_skeleton skeleton;
- spine_animation_state animationState;
- spine_animation_state_data animationStateData;
- spine_animation_state_events animationStateEvents;
- void *clipping;
- BlockAllocator *allocator;
- Vector<float> worldVertices;
- Vector<unsigned short> quadIndices;
- Vector<_spine_render_command *> renderCommands;
- _spine_skeleton_drawable() {
- quadIndices.add(0);
- quadIndices.add(1);
- quadIndices.add(2);
- quadIndices.add(2);
- quadIndices.add(3);
- quadIndices.add(0);
- }
- } _spine_skeleton_drawable;
- typedef struct _spine_skin_entry {
- int32_t slotIndex;
- utf8 *name;
- spine_attachment attachment;
- } _spine_skin_entry;
- typedef struct _spine_skin_entries {
- int32_t numEntries;
- _spine_skin_entry *entries;
- } _spine_skin_entries;
- static Color NULL_COLOR(0, 0, 0, 0);
- static SpineExtension *defaultExtension = nullptr;
- static DebugExtension *debugExtension = nullptr;
- static void initExtensions() {
- if (defaultExtension == nullptr) {
- defaultExtension = new DefaultSpineExtension();
- debugExtension = new DebugExtension(defaultExtension);
- }
- }
- spine::SpineExtension *spine::getDefaultExtension() {
- initExtensions();
- return defaultExtension;
- }
- void spine_enable_debug_extension(spine_bool enable) {
- initExtensions();
- SpineExtension::setInstance(enable ? debugExtension : defaultExtension);
- }
- int32_t spine_major_version() {
- return SPINE_MAJOR_VERSION;
- }
- int32_t spine_minor_version() {
- return SPINE_MINOR_VERSION;
- }
- void spine_report_leaks() {
- initExtensions();
- debugExtension->reportLeaks();
- fflush(stdout);
- }
- // Color
- float spine_color_get_r(spine_color color) {
- if (!color) return 0;
- return ((Color *) color)->r;
- }
- float spine_color_get_g(spine_color color) {
- if (!color) return 0;
- return ((Color *) color)->g;
- }
- float spine_color_get_b(spine_color color) {
- if (!color) return 0;
- return ((Color *) color)->b;
- }
- float spine_color_get_a(spine_color color) {
- if (!color) return 0;
- return ((Color *) color)->a;
- }
- // Bounds
- float spine_bounds_get_x(spine_bounds bounds) {
- if (!bounds) return 0;
- return ((_spine_bounds *) bounds)->x;
- }
- float spine_bounds_get_y(spine_bounds bounds) {
- if (!bounds) return 0;
- return ((_spine_bounds *) bounds)->y;
- }
- float spine_bounds_get_width(spine_bounds bounds) {
- if (!bounds) return 0;
- return ((_spine_bounds *) bounds)->width;
- }
- float spine_bounds_get_height(spine_bounds bounds) {
- if (!bounds) return 0;
- return ((_spine_bounds *) bounds)->height;
- }
- // Vector
- float spine_vector_get_x(spine_vector vector) {
- if (!vector) return 0;
- return ((_spine_vector *) vector)->x;
- }
- float spine_vector_get_y(spine_vector vector) {
- if (!vector) return 0;
- return ((_spine_vector *) vector)->y;
- }
- // Atlas
- spine_atlas spine_atlas_load(const utf8 *atlasData) {
- if (!atlasData) return nullptr;
- int32_t length = (int32_t) strlen(atlasData);
- auto atlas = new (__FILE__, __LINE__) Atlas(atlasData, length, "", (TextureLoader *) nullptr, false);
- _spine_atlas *result = SpineExtension::calloc<_spine_atlas>(1, __FILE__, __LINE__);
- result->atlas = atlas;
- result->numImagePaths = (int32_t) atlas->getPages().size();
- result->imagePaths = SpineExtension::calloc<utf8 *>(result->numImagePaths, __FILE__, __LINE__);
- for (int i = 0; i < result->numImagePaths; i++) {
- result->imagePaths[i] = (utf8 *) strdup(atlas->getPages()[i]->texturePath.buffer());
- }
- return (spine_atlas) result;
- }
- int32_t spine_atlas_get_num_image_paths(spine_atlas atlas) {
- if (!atlas) return 0;
- return ((_spine_atlas *) atlas)->numImagePaths;
- }
- spine_bool spine_atlas_is_pma(spine_atlas atlas) {
- if (!atlas) return 0;
- Atlas *_atlas = static_cast<Atlas *>(((_spine_atlas *) atlas)->atlas);
- if (_atlas->getPages().size() > 0) {
- return _atlas->getPages()[0]->pma;
- } else {
- return 0;
- }
- }
- utf8 *spine_atlas_get_image_path(spine_atlas atlas, int32_t index) {
- if (!atlas) return nullptr;
- return ((_spine_atlas *) atlas)->imagePaths[index];
- }
- utf8 *spine_atlas_get_error(spine_atlas atlas) {
- if (!atlas) return nullptr;
- return ((_spine_atlas *) atlas)->error;
- }
- void spine_atlas_dispose(spine_atlas atlas) {
- if (!atlas) return;
- _spine_atlas *_atlas = (_spine_atlas *) atlas;
- if (_atlas->atlas) delete (Atlas *) _atlas->atlas;
- if (_atlas->error) free(_atlas->error);
- for (int i = 0; i < _atlas->numImagePaths; i++) {
- free(_atlas->imagePaths[i]);
- }
- SpineExtension::free(_atlas->imagePaths, __FILE__, __LINE__);
- SpineExtension::free(_atlas, __FILE__, __LINE__);
- }
- // SkeletonData
- spine_skeleton_data_result spine_skeleton_data_load_json(spine_atlas atlas, const utf8 *skeletonData) {
- _spine_skeleton_data_result *result = SpineExtension::calloc<_spine_skeleton_data_result>(1, __FILE__, __LINE__);
- _spine_atlas *_atlas = (_spine_atlas *) atlas;
- Bone::setYDown(true);
- if (!_atlas) return (spine_skeleton_data_result) result;
- if (!_atlas->atlas) return (spine_skeleton_data_result) result;
- if (!skeletonData) return (spine_skeleton_data_result) result;
- SkeletonJson json((Atlas *) _atlas->atlas);
- SkeletonData *data = json.readSkeletonData(skeletonData);
- result->skeletonData = (spine_skeleton_data) data;
- if (!json.getError().isEmpty()) {
- result->error = (utf8 *) strdup(json.getError().buffer());
- }
- return (spine_skeleton_data_result) result;
- }
- spine_skeleton_data_result spine_skeleton_data_load_binary(spine_atlas atlas, const uint8_t *skeletonData, int32_t length) {
- _spine_skeleton_data_result *result = SpineExtension::calloc<_spine_skeleton_data_result>(1, __FILE__, __LINE__);
- _spine_atlas *_atlas = (_spine_atlas *) atlas;
- Bone::setYDown(true);
- if (!_atlas) return (spine_skeleton_data_result) result;
- if (!_atlas->atlas) return (spine_skeleton_data_result) result;
- if (!skeletonData) return (spine_skeleton_data_result) result;
- if (length <= 0) return (spine_skeleton_data_result) result;
- SkeletonBinary binary((Atlas *) _atlas->atlas);
- SkeletonData *data = binary.readSkeletonData(skeletonData, length);
- result->skeletonData = (spine_skeleton_data) data;
- if (!binary.getError().isEmpty()) {
- result->error = (utf8 *) strdup(binary.getError().buffer());
- }
- return (spine_skeleton_data_result) result;
- }
- utf8 *spine_skeleton_data_result_get_error(spine_skeleton_data_result result) {
- if (!result) return nullptr;
- return ((_spine_skeleton_data_result *) result)->error;
- }
- spine_skeleton_data spine_skeleton_data_result_get_data(spine_skeleton_data_result result) {
- if (!result) return nullptr;
- return ((_spine_skeleton_data_result *) result)->skeletonData;
- }
- void spine_skeleton_data_result_dispose(spine_skeleton_data_result result) {
- if (!result) return;
- _spine_skeleton_data_result *_result = (_spine_skeleton_data_result *) result;
- if (_result->error) SpineExtension::free(_result->error, __FILE__, __LINE__);
- SpineExtension::free(_result, __FILE__, __LINE__);
- }
- spine_bone_data spine_skeleton_data_find_bone(spine_skeleton_data data, const utf8 *name) {
- if (data == nullptr) return nullptr;
- SkeletonData *_data = (SkeletonData *) data;
- return (spine_bone_data) _data->findBone(name);
- }
- spine_slot_data spine_skeleton_data_find_slot(spine_skeleton_data data, const utf8 *name) {
- if (data == nullptr) return nullptr;
- SkeletonData *_data = (SkeletonData *) data;
- return (spine_slot_data) _data->findSlot(name);
- }
- spine_skin spine_skeleton_data_find_skin(spine_skeleton_data data, const utf8 *name) {
- if (data == nullptr) return nullptr;
- SkeletonData *_data = (SkeletonData *) data;
- return (spine_skin) _data->findSkin(name);
- }
- spine_event_data spine_skeleton_data_find_event(spine_skeleton_data data, const utf8 *name) {
- if (data == nullptr) return nullptr;
- SkeletonData *_data = (SkeletonData *) data;
- return (spine_event_data) _data->findEvent(name);
- }
- spine_animation spine_skeleton_data_find_animation(spine_skeleton_data data, const utf8 *name) {
- if (data == nullptr) return nullptr;
- SkeletonData *_data = (SkeletonData *) data;
- return (spine_animation) _data->findAnimation(name);
- }
- spine_ik_constraint_data spine_skeleton_data_find_ik_constraint(spine_skeleton_data data, const utf8 *name) {
- if (data == nullptr) return nullptr;
- SkeletonData *_data = (SkeletonData *) data;
- return (spine_ik_constraint_data) _data->findIkConstraint(name);
- }
- spine_transform_constraint_data spine_skeleton_data_find_transform_constraint(spine_skeleton_data data, const utf8 *name) {
- if (data == nullptr) return nullptr;
- SkeletonData *_data = (SkeletonData *) data;
- return (spine_transform_constraint_data) _data->findTransformConstraint(name);
- }
- spine_path_constraint_data spine_skeleton_data_find_path_constraint(spine_skeleton_data data, const utf8 *name) {
- if (data == nullptr) return nullptr;
- SkeletonData *_data = (SkeletonData *) data;
- return (spine_path_constraint_data) _data->findPathConstraint(name);
- }
- spine_physics_constraint_data spine_skeleton_data_find_physics_constraint(spine_skeleton_data data, const utf8 *name) {
- if (data == nullptr) return nullptr;
- SkeletonData *_data = (SkeletonData *) data;
- return (spine_physics_constraint_data) _data->findPhysicsConstraint(name);
- }
- const utf8 *spine_skeleton_data_get_name(spine_skeleton_data data) {
- if (data == nullptr) return nullptr;
- SkeletonData *_data = (SkeletonData *) data;
- return (utf8 *) _data->getName().buffer();
- }
- int32_t spine_skeleton_data_get_num_bones(spine_skeleton_data data) {
- if (data == nullptr) return 0;
- SkeletonData *_data = (SkeletonData *) data;
- return (int32_t) _data->getBones().size();
- }
- spine_bone_data *spine_skeleton_data_get_bones(spine_skeleton_data data) {
- if (data == nullptr) return nullptr;
- SkeletonData *_data = (SkeletonData *) data;
- return (spine_bone_data *) _data->getBones().buffer();
- }
- int32_t spine_skeleton_data_get_num_slots(spine_skeleton_data data) {
- if (data == nullptr) return 0;
- SkeletonData *_data = (SkeletonData *) data;
- return (int32_t) _data->getSlots().size();
- }
- spine_slot_data *spine_skeleton_data_get_slots(spine_skeleton_data data) {
- if (data == nullptr) return nullptr;
- SkeletonData *_data = (SkeletonData *) data;
- return (spine_slot_data *) _data->getSlots().buffer();
- }
- int32_t spine_skeleton_data_get_num_skins(spine_skeleton_data data) {
- if (data == nullptr) return 0;
- SkeletonData *_data = (SkeletonData *) data;
- return (int32_t) _data->getSkins().size();
- }
- spine_skin *spine_skeleton_data_get_skins(spine_skeleton_data data) {
- if (data == nullptr) return nullptr;
- SkeletonData *_data = (SkeletonData *) data;
- return (spine_skin *) _data->getSkins().buffer();
- }
- spine_skin spine_skeleton_data_get_default_skin(spine_skeleton_data data) {
- if (data == nullptr) return nullptr;
- SkeletonData *_data = (SkeletonData *) data;
- return (spine_skin) _data->getDefaultSkin();
- }
- void spine_skeleton_data_set_default_skin(spine_skeleton_data data, spine_skin skin) {
- if (data == nullptr) return;
- SkeletonData *_data = (SkeletonData *) data;
- _data->setDefaultSkin((Skin *) skin);
- }
- int32_t spine_skeleton_data_get_num_events(spine_skeleton_data data) {
- if (data == nullptr) return 0;
- SkeletonData *_data = (SkeletonData *) data;
- return (int32_t) _data->getEvents().size();
- }
- spine_event_data *spine_skeleton_data_get_events(spine_skeleton_data data) {
- if (data == nullptr) return nullptr;
- SkeletonData *_data = (SkeletonData *) data;
- return (spine_event_data *) _data->getEvents().buffer();
- }
- int32_t spine_skeleton_data_get_num_animations(spine_skeleton_data data) {
- if (data == nullptr) return 0;
- SkeletonData *_data = (SkeletonData *) data;
- return (int32_t) _data->getAnimations().size();
- }
- spine_animation *spine_skeleton_data_get_animations(spine_skeleton_data data) {
- if (data == nullptr) return nullptr;
- SkeletonData *_data = (SkeletonData *) data;
- return (spine_animation *) _data->getAnimations().buffer();
- }
- int32_t spine_skeleton_data_get_num_ik_constraints(spine_skeleton_data data) {
- if (data == nullptr) return 0;
- SkeletonData *_data = (SkeletonData *) data;
- return (int32_t) _data->getIkConstraints().size();
- }
- spine_ik_constraint_data *spine_skeleton_data_get_ik_constraints(spine_skeleton_data data) {
- if (data == nullptr) return nullptr;
- SkeletonData *_data = (SkeletonData *) data;
- return (spine_ik_constraint_data *) _data->getIkConstraints().buffer();
- }
- int32_t spine_skeleton_data_get_num_transform_constraints(spine_skeleton_data data) {
- if (data == nullptr) return 0;
- SkeletonData *_data = (SkeletonData *) data;
- return (int32_t) _data->getTransformConstraints().size();
- }
- spine_transform_constraint_data *spine_skeleton_data_get_transform_constraints(spine_skeleton_data data) {
- if (data == nullptr) return nullptr;
- SkeletonData *_data = (SkeletonData *) data;
- return (spine_transform_constraint_data *) _data->getTransformConstraints().buffer();
- }
- int32_t spine_skeleton_data_get_num_path_constraints(spine_skeleton_data data) {
- if (data == nullptr) return 0;
- SkeletonData *_data = (SkeletonData *) data;
- return (int32_t) _data->getPathConstraints().size();
- }
- spine_path_constraint_data *spine_skeleton_data_get_path_constraints(spine_skeleton_data data) {
- if (data == nullptr) return nullptr;
- SkeletonData *_data = (SkeletonData *) data;
- return (spine_path_constraint_data *) _data->getPathConstraints().buffer();
- }
- int32_t spine_skeleton_data_get_num_physics_constraints(spine_skeleton_data data) {
- if (data == nullptr) return 0;
- SkeletonData *_data = (SkeletonData *) data;
- return (int32_t) _data->getPhysicsConstraints().size();
- }
- spine_physics_constraint_data *spine_skeleton_data_get_physics_constraints(spine_skeleton_data data) {
- if (data == nullptr) return nullptr;
- SkeletonData *_data = (SkeletonData *) data;
- return (spine_physics_constraint_data *) _data->getPhysicsConstraints().buffer();
- }
- float spine_skeleton_data_get_x(spine_skeleton_data data) {
- if (data == nullptr) return 0;
- SkeletonData *_data = (SkeletonData *) data;
- return _data->getX();
- }
- void spine_skeleton_data_set_x(spine_skeleton_data data, float x) {
- if (data == nullptr) return;
- SkeletonData *_data = (SkeletonData *) data;
- _data->setX(x);
- }
- float spine_skeleton_data_get_y(spine_skeleton_data data) {
- if (data == nullptr) return 0;
- SkeletonData *_data = (SkeletonData *) data;
- return _data->getY();
- }
- void spine_skeleton_data_set_y(spine_skeleton_data data, float y) {
- if (data == nullptr) return;
- SkeletonData *_data = (SkeletonData *) data;
- _data->setY(y);
- }
- float spine_skeleton_data_get_width(spine_skeleton_data data) {
- if (data == nullptr) return 0;
- SkeletonData *_data = (SkeletonData *) data;
- return _data->getWidth();
- }
- void spine_skeleton_data_set_width(spine_skeleton_data data, float width) {
- if (data == nullptr) return;
- SkeletonData *_data = (SkeletonData *) data;
- _data->setWidth(width);
- }
- float spine_skeleton_data_get_height(spine_skeleton_data data) {
- if (data == nullptr) return 0;
- SkeletonData *_data = (SkeletonData *) data;
- return _data->getHeight();
- }
- void spine_skeleton_data_set_height(spine_skeleton_data data, float height) {
- if (data == nullptr) return;
- SkeletonData *_data = (SkeletonData *) data;
- _data->setHeight(height);
- }
- const utf8 *spine_skeleton_data_get_version(spine_skeleton_data data) {
- if (data == nullptr) return nullptr;
- SkeletonData *_data = (SkeletonData *) data;
- return (utf8 *) _data->getVersion().buffer();
- }
- const utf8 *spine_skeleton_data_get_hash(spine_skeleton_data data) {
- if (data == nullptr) return nullptr;
- SkeletonData *_data = (SkeletonData *) data;
- return (utf8 *) _data->getHash().buffer();
- }
- const utf8 *spine_skeleton_data_get_images_path(spine_skeleton_data data) {
- if (data == nullptr) return nullptr;
- SkeletonData *_data = (SkeletonData *) data;
- return (utf8 *) _data->getImagesPath().buffer();
- }
- const utf8 *spine_skeleton_data_get_audio_path(spine_skeleton_data data) {
- if (data == nullptr) return nullptr;
- SkeletonData *_data = (SkeletonData *) data;
- return (utf8 *) _data->getAudioPath().buffer();
- }
- float spine_skeleton_data_get_fps(spine_skeleton_data data) {
- if (data == nullptr) return 0;
- SkeletonData *_data = (SkeletonData *) data;
- return _data->getFps();
- }
- float spine_skeleton_data_get_reference_scale(spine_skeleton_data data) {
- if (data == nullptr) return 0;
- SkeletonData *_data = (SkeletonData *) data;
- return _data->getReferenceScale();
- }
- void spine_skeleton_data_dispose(spine_skeleton_data data) {
- if (!data) return;
- delete (SkeletonData *) data;
- }
- // RenderCommand
- static _spine_render_command *spine_render_command_create(BlockAllocator &allocator, int numVertices, int32_t numIndices, spine_blend_mode blendMode, int32_t pageIndex) {
- _spine_render_command *cmd = allocator.allocate<_spine_render_command>(1);
- cmd->positions = allocator.allocate<float>(numVertices << 1);
- cmd->uvs = allocator.allocate<float>(numVertices << 1);
- cmd->colors = allocator.allocate<int32_t>(numVertices);
- cmd->darkColors = allocator.allocate<int32_t>(numVertices);
- cmd->numVertices = numVertices;
- cmd->indices = allocator.allocate<uint16_t>(numIndices);
- cmd->numIndices = numIndices;
- cmd->blendMode = blendMode;
- cmd->atlasPage = pageIndex;
- cmd->next = nullptr;
- return cmd;
- }
- // SkeletonDrawable
- spine_skeleton_drawable spine_skeleton_drawable_create(spine_skeleton_data skeletonData) {
- _spine_skeleton_drawable *drawable = new (__FILE__, __LINE__) _spine_skeleton_drawable();
- drawable->skeleton = (spine_skeleton) new (__FILE__, __LINE__) Skeleton((SkeletonData *) skeletonData);
- AnimationStateData *stateData = new (__FILE__, __LINE__) AnimationStateData((SkeletonData *) skeletonData);
- drawable->animationStateData = (spine_animation_state_data) stateData;
- AnimationState *state = new (__FILE__, __LINE__) AnimationState(stateData);
- drawable->animationState = (spine_animation_state) state;
- state->setManualTrackEntryDisposal(true);
- EventListener *listener = new EventListener();
- drawable->animationStateEvents = (spine_animation_state_events) listener;
- state->setListener(listener);
- drawable->clipping = new (__FILE__, __LINE__) SkeletonClipping();
- drawable->allocator = new (__FILE__, __LINE__) BlockAllocator(2048);
- return (spine_skeleton_drawable) drawable;
- }
- void spine_skeleton_drawable_dispose(spine_skeleton_drawable drawable) {
- _spine_skeleton_drawable *_drawable = (_spine_skeleton_drawable *) drawable;
- if (!_drawable) return;
- if (_drawable->skeleton) delete (Skeleton *) _drawable->skeleton;
- if (_drawable->animationState) delete (AnimationState *) _drawable->animationState;
- if (_drawable->animationStateData) delete (AnimationStateData *) _drawable->animationStateData;
- if (_drawable->animationStateEvents) delete (Vector<AnimationStateEvent> *) (_drawable->animationStateEvents);
- if (_drawable->clipping) delete (SkeletonClipping *) _drawable->clipping;
- if (_drawable->allocator) delete (BlockAllocator *) _drawable->allocator;
- SpineExtension::free(drawable, __FILE__, __LINE__);
- }
- static _spine_render_command *batch_sub_commands(BlockAllocator &allocator, Vector<_spine_render_command *> &commands, int first, int last, int numVertices, int numIndices) {
- _spine_render_command *batched = spine_render_command_create(allocator, numVertices, numIndices, commands[first]->blendMode, commands[first]->atlasPage);
- float *positions = batched->positions;
- float *uvs = batched->uvs;
- int32_t *colors = batched->colors;
- int32_t *darkColors = batched->darkColors;
- uint16_t *indices = batched->indices;
- int indicesOffset = 0;
- for (int i = first; i <= last; i++) {
- _spine_render_command *cmd = commands[i];
- memcpy(positions, cmd->positions, sizeof(float) * 2 * cmd->numVertices);
- memcpy(uvs, cmd->uvs, sizeof(float) * 2 * cmd->numVertices);
- memcpy(colors, cmd->colors, sizeof(int32_t) * cmd->numVertices);
- memcpy(darkColors, cmd->darkColors, sizeof(int32_t) * cmd->numVertices);
- for (int ii = 0; ii < cmd->numIndices; ii++)
- indices[ii] = cmd->indices[ii] + indicesOffset;
- indicesOffset += cmd->numVertices;
- positions += 2 * cmd->numVertices;
- uvs += 2 * cmd->numVertices;
- colors += cmd->numVertices;
- darkColors += cmd->numVertices;
- indices += cmd->numIndices;
- }
- return batched;
- }
- static _spine_render_command *batch_commands(BlockAllocator &allocator, Vector<_spine_render_command *> &commands) {
- if (commands.size() == 0) return nullptr;
- _spine_render_command *root = nullptr;
- _spine_render_command *last = nullptr;
- _spine_render_command *first = commands[0];
- int startIndex = 0;
- int i = 1;
- int numVertices = first->numVertices;
- int numIndices = first->numIndices;
- while (i <= (int) commands.size()) {
- _spine_render_command *cmd = i < (int) commands.size() ? commands[i] : nullptr;
- if (cmd && cmd->numVertices == 0 && cmd->numIndices == 0) {
- i++;
- continue;
- }
- if (cmd != nullptr && cmd->atlasPage == first->atlasPage &&
- cmd->blendMode == first->blendMode &&
- cmd->colors[0] == first->colors[0] &&
- cmd->darkColors[0] == first->darkColors[0] &&
- numIndices + cmd->numIndices < 0xffff) {
- numVertices += cmd->numVertices;
- numIndices += cmd->numIndices;
- } else {
- _spine_render_command *batched = batch_sub_commands(allocator, commands, startIndex, i - 1, numVertices, numIndices);
- if (!last) {
- root = last = batched;
- } else {
- last->next = batched;
- last = batched;
- }
- if (i == (int) commands.size()) break;
- first = commands[i];
- startIndex = i;
- numVertices = first->numVertices;
- numIndices = first->numIndices;
- }
- i++;
- }
- return root;
- }
- spine_render_command spine_skeleton_drawable_render(spine_skeleton_drawable drawable) {
- _spine_skeleton_drawable *_drawable = (_spine_skeleton_drawable *) drawable;
- if (!_drawable) return nullptr;
- if (!_drawable->skeleton) return nullptr;
- _drawable->allocator->compress();
- _drawable->renderCommands.clear();
- SkeletonClipping &clipper = *(SkeletonClipping *) _drawable->clipping;
- Skeleton *skeleton = (Skeleton *) _drawable->skeleton;
- for (unsigned i = 0; i < skeleton->getSlots().size(); ++i) {
- Slot &slot = *skeleton->getDrawOrder()[i];
- Attachment *attachment = slot.getAttachment();
- if (!attachment) {
- clipper.clipEnd(slot);
- continue;
- }
- // Early out if the slot color is 0 or the bone is not active
- if (slot.getColor().a == 0 || !slot.getBone().isActive()) {
- clipper.clipEnd(slot);
- continue;
- }
- Vector<float> *worldVertices = &_drawable->worldVertices;
- Vector<unsigned short> *quadIndices = &_drawable->quadIndices;
- Vector<float> *vertices = worldVertices;
- int32_t verticesCount;
- Vector<float> *uvs;
- Vector<unsigned short> *indices;
- int32_t indicesCount;
- Color *attachmentColor;
- int32_t pageIndex;
- if (attachment->getRTTI().isExactly(RegionAttachment::rtti)) {
- RegionAttachment *regionAttachment = (RegionAttachment *) attachment;
- attachmentColor = ®ionAttachment->getColor();
- // Early out if the slot color is 0
- if (attachmentColor->a == 0) {
- clipper.clipEnd(slot);
- continue;
- }
- worldVertices->setSize(8, 0);
- regionAttachment->computeWorldVertices(slot, *worldVertices, 0, 2);
- verticesCount = 4;
- uvs = ®ionAttachment->getUVs();
- indices = quadIndices;
- indicesCount = 6;
- pageIndex = ((AtlasRegion *) regionAttachment->getRegion())->page->index;
- } else if (attachment->getRTTI().isExactly(MeshAttachment::rtti)) {
- MeshAttachment *mesh = (MeshAttachment *) attachment;
- attachmentColor = &mesh->getColor();
- // Early out if the slot color is 0
- if (attachmentColor->a == 0) {
- clipper.clipEnd(slot);
- continue;
- }
- worldVertices->setSize(mesh->getWorldVerticesLength(), 0);
- mesh->computeWorldVertices(slot, 0, mesh->getWorldVerticesLength(), worldVertices->buffer(), 0, 2);
- verticesCount = (int32_t) (mesh->getWorldVerticesLength() >> 1);
- uvs = &mesh->getUVs();
- indices = &mesh->getTriangles();
- indicesCount = (int32_t) indices->size();
- pageIndex = ((AtlasRegion *) mesh->getRegion())->page->index;
- } else if (attachment->getRTTI().isExactly(ClippingAttachment::rtti)) {
- ClippingAttachment *clip = (ClippingAttachment *) slot.getAttachment();
- clipper.clipStart(slot, clip);
- continue;
- } else
- continue;
- uint8_t r = static_cast<uint8_t>(skeleton->getColor().r * slot.getColor().r * attachmentColor->r * 255);
- uint8_t g = static_cast<uint8_t>(skeleton->getColor().g * slot.getColor().g * attachmentColor->g * 255);
- uint8_t b = static_cast<uint8_t>(skeleton->getColor().b * slot.getColor().b * attachmentColor->b * 255);
- uint8_t a = static_cast<uint8_t>(skeleton->getColor().a * slot.getColor().a * attachmentColor->a * 255);
- uint32_t color = (a << 24) | (r << 16) | (g << 8) | b;
- uint32_t darkColor = 0xff000000;
- if (slot.hasDarkColor()) {
- Color &slotDarkColor = slot.getDarkColor();
- darkColor = 0xff000000 | (static_cast<uint8_t>(slotDarkColor.r * 255) << 16) | (static_cast<uint8_t>(slotDarkColor.g * 255) << 8) | static_cast<uint8_t>(slotDarkColor.b * 255);
- }
- if (clipper.isClipping()) {
- clipper.clipTriangles(*worldVertices, *indices, *uvs, 2);
- vertices = &clipper.getClippedVertices();
- verticesCount = (int32_t) (clipper.getClippedVertices().size() >> 1);
- uvs = &clipper.getClippedUVs();
- indices = &clipper.getClippedTriangles();
- indicesCount = (int32_t) (clipper.getClippedTriangles().size());
- }
- _spine_render_command *cmd = spine_render_command_create(*_drawable->allocator, verticesCount, indicesCount, (spine_blend_mode) slot.getData().getBlendMode(), pageIndex);
- _drawable->renderCommands.add(cmd);
- memcpy(cmd->positions, vertices->buffer(), (verticesCount << 1) * sizeof(float));
- memcpy(cmd->uvs, uvs->buffer(), (verticesCount << 1) * sizeof(float));
- for (int ii = 0; ii < verticesCount; ii++) {
- cmd->colors[ii] = color;
- cmd->darkColors[ii] = darkColor;
- }
- memcpy(cmd->indices, indices->buffer(), indices->size() * sizeof(uint16_t));
- clipper.clipEnd(slot);
- }
- clipper.clipEnd();
- return (spine_render_command) batch_commands(*_drawable->allocator, _drawable->renderCommands);
- }
- spine_skeleton spine_skeleton_drawable_get_skeleton(spine_skeleton_drawable drawable) {
- if (!drawable) return nullptr;
- return ((_spine_skeleton_drawable *) drawable)->skeleton;
- }
- spine_animation_state spine_skeleton_drawable_get_animation_state(spine_skeleton_drawable drawable) {
- if (!drawable) return nullptr;
- return ((_spine_skeleton_drawable *) drawable)->animationState;
- }
- spine_animation_state_data spine_skeleton_drawable_get_animation_state_data(spine_skeleton_drawable drawable) {
- if (!drawable) return nullptr;
- return ((_spine_skeleton_drawable *) drawable)->animationStateData;
- }
- spine_animation_state_events spine_skeleton_drawable_get_animation_state_events(spine_skeleton_drawable drawable) {
- if (!drawable) return nullptr;
- return ((_spine_skeleton_drawable *) drawable)->animationStateEvents;
- }
- // Render command
- float *spine_render_command_get_positions(spine_render_command command) {
- if (!command) return nullptr;
- return ((_spine_render_command *) command)->positions;
- }
- float *spine_render_command_get_uvs(spine_render_command command) {
- if (!command) return nullptr;
- return ((_spine_render_command *) command)->uvs;
- }
- int32_t *spine_render_command_get_colors(spine_render_command command) {
- if (!command) return nullptr;
- return ((_spine_render_command *) command)->colors;
- }
- int32_t *spine_render_command_get_dark_colors(spine_render_command command) {
- if (!command) return nullptr;
- return ((_spine_render_command *) command)->darkColors;
- }
- int32_t spine_render_command_get_num_vertices(spine_render_command command) {
- if (!command) return 0;
- return ((_spine_render_command *) command)->numVertices;
- }
- uint16_t *spine_render_command_get_indices(spine_render_command command) {
- if (!command) return nullptr;
- return ((_spine_render_command *) command)->indices;
- }
- int32_t spine_render_command_get_num_indices(spine_render_command command) {
- if (!command) return 0;
- return ((_spine_render_command *) command)->numIndices;
- }
- int32_t spine_render_command_get_atlas_page(spine_render_command command) {
- if (!command) return 0;
- return ((_spine_render_command *) command)->atlasPage;
- }
- spine_blend_mode spine_render_command_get_blend_mode(spine_render_command command) {
- if (!command) return SPINE_BLEND_MODE_NORMAL;
- return ((_spine_render_command *) command)->blendMode;
- }
- spine_render_command spine_render_command_get_next(spine_render_command command) {
- if (!command) return nullptr;
- return (spine_render_command) ((_spine_render_command *) command)->next;
- }
- // Animation
- const utf8 *spine_animation_get_name(spine_animation animation) {
- if (animation == nullptr) return nullptr;
- Animation *_animation = (Animation *) animation;
- return (utf8 *) _animation->getName().buffer();
- }
- float spine_animation_get_duration(spine_animation animation) {
- if (animation == nullptr) return 0;
- Animation *_animation = (Animation *) animation;
- return _animation->getDuration();
- }
- // AnimationStateData
- spine_skeleton_data spine_animation_state_data_get_skeleton_data(spine_animation_state_data stateData) {
- if (stateData == nullptr) return nullptr;
- AnimationStateData *_stateData = (AnimationStateData *) stateData;
- return (spine_skeleton_data) _stateData->getSkeletonData();
- }
- float spine_animation_state_data_get_default_mix(spine_animation_state_data stateData) {
- if (stateData == nullptr) return 0;
- AnimationStateData *_stateData = (AnimationStateData *) stateData;
- return _stateData->getDefaultMix();
- }
- void spine_animation_state_data_set_default_mix(spine_animation_state_data stateData, float defaultMix) {
- if (stateData == nullptr) return;
- AnimationStateData *_stateData = (AnimationStateData *) stateData;
- _stateData->setDefaultMix(defaultMix);
- }
- void spine_animation_state_data_set_mix(spine_animation_state_data stateData, spine_animation from, spine_animation to, float duration) {
- if (stateData == nullptr) return;
- if (from == nullptr || to == nullptr) return;
- AnimationStateData *_stateData = (AnimationStateData *) stateData;
- _stateData->setMix((Animation *) from, (Animation *) to, duration);
- }
- float spine_animation_state_data_get_mix(spine_animation_state_data stateData, spine_animation from, spine_animation to) {
- if (stateData == nullptr) return 0;
- if (from == nullptr || to == nullptr) return 0;
- AnimationStateData *_stateData = (AnimationStateData *) stateData;
- return _stateData->getMix((Animation *) from, (Animation *) to);
- }
- void spine_animation_state_data_set_mix_by_name(spine_animation_state_data stateData, const utf8 *fromName, const utf8 *toName, float duration) {
- if (stateData == nullptr) return;
- if (fromName == nullptr || toName == nullptr) return;
- AnimationStateData *_stateData = (AnimationStateData *) stateData;
- _stateData->setMix(fromName, toName, duration);
- }
- float spine_animation_state_data_get_mix_by_name(spine_animation_state_data stateData, const utf8 *fromName, const utf8 *toName) {
- if (stateData == nullptr) return 0;
- AnimationStateData *_stateData = (AnimationStateData *) stateData;
- Animation *from = _stateData->getSkeletonData()->findAnimation(fromName);
- Animation *to = _stateData->getSkeletonData()->findAnimation(toName);
- if (from == nullptr || to == nullptr) return 0;
- return _stateData->getMix(from, to);
- }
- void spine_animation_state_data_clear(spine_animation_state_data stateData) {
- if (stateData == nullptr) return;
- AnimationStateData *_stateData = (AnimationStateData *) stateData;
- _stateData->clear();
- }
- // AnimationState
- void spine_animation_state_update(spine_animation_state state, float delta) {
- if (state == nullptr) return;
- AnimationState *_state = (AnimationState *) state;
- _state->update(delta);
- }
- void spine_animation_state_dispose_track_entry(spine_animation_state state, spine_track_entry entry) {
- if (state == nullptr) return;
- if (entry == nullptr) return;
- AnimationState *_state = (AnimationState *) state;
- _state->disposeTrackEntry((TrackEntry *) entry);
- }
- void spine_animation_state_apply(spine_animation_state state, spine_skeleton skeleton) {
- if (state == nullptr) return;
- AnimationState *_state = (AnimationState *) state;
- _state->apply(*(Skeleton *) skeleton);
- }
- void spine_animation_state_clear_tracks(spine_animation_state state) {
- if (state == nullptr) return;
- AnimationState *_state = (AnimationState *) state;
- _state->clearTracks();
- }
- int32_t spine_animation_state_get_num_tracks(spine_animation_state state) {
- if (state == nullptr) return 0;
- AnimationState *_state = (AnimationState *) state;
- return (int32_t) _state->getTracks().size();
- }
- void spine_animation_state_clear_track(spine_animation_state state, int32_t trackIndex) {
- if (state == nullptr) return;
- AnimationState *_state = (AnimationState *) state;
- _state->clearTrack(trackIndex);
- }
- spine_track_entry spine_animation_state_set_animation_by_name(spine_animation_state state, int32_t trackIndex, const utf8 *animationName, spine_bool loop) {
- if (state == nullptr) return nullptr;
- AnimationState *_state = (AnimationState *) state;
- return (spine_track_entry) _state->setAnimation(trackIndex, animationName, loop);
- }
- spine_track_entry spine_animation_state_set_animation(spine_animation_state state, int32_t trackIndex, spine_animation animation, spine_bool loop) {
- if (state == nullptr) return nullptr;
- AnimationState *_state = (AnimationState *) state;
- return (spine_track_entry) _state->setAnimation(trackIndex, (Animation *) animation, loop);
- }
- spine_track_entry spine_animation_state_add_animation_by_name(spine_animation_state state, int32_t trackIndex, const utf8 *animationName, spine_bool loop, float delay) {
- if (state == nullptr) return nullptr;
- AnimationState *_state = (AnimationState *) state;
- return (spine_track_entry) _state->addAnimation(trackIndex, animationName, loop, delay);
- }
- spine_track_entry spine_animation_state_add_animation(spine_animation_state state, int32_t trackIndex, spine_animation animation, spine_bool loop, float delay) {
- if (state == nullptr) return nullptr;
- AnimationState *_state = (AnimationState *) state;
- return (spine_track_entry) _state->addAnimation(trackIndex, (Animation *) animation, loop, delay);
- }
- spine_track_entry spine_animation_state_set_empty_animation(spine_animation_state state, int32_t trackIndex, float mixDuration) {
- if (state == nullptr) return nullptr;
- AnimationState *_state = (AnimationState *) state;
- return (spine_track_entry) _state->setEmptyAnimation(trackIndex, mixDuration);
- }
- spine_track_entry spine_animation_state_add_empty_animation(spine_animation_state state, int32_t trackIndex, float mixDuration, float delay) {
- if (state == nullptr) return nullptr;
- AnimationState *_state = (AnimationState *) state;
- return (spine_track_entry) _state->addEmptyAnimation(trackIndex, mixDuration, delay);
- }
- void spine_animation_state_set_empty_animations(spine_animation_state state, float mixDuration) {
- if (state == nullptr) return;
- AnimationState *_state = (AnimationState *) state;
- _state->setEmptyAnimations(mixDuration);
- }
- spine_track_entry spine_animation_state_get_current(spine_animation_state state, int32_t trackIndex) {
- if (state == nullptr) return nullptr;
- AnimationState *_state = (AnimationState *) state;
- return (spine_track_entry) _state->getCurrent(trackIndex);
- }
- spine_animation_state_data spine_animation_state_get_data(spine_animation_state state) {
- if (state == nullptr) return nullptr;
- AnimationState *_state = (AnimationState *) state;
- return (spine_animation_state_data) _state->getData();
- }
- float spine_animation_state_get_time_scale(spine_animation_state state) {
- if (state == nullptr) return 0;
- AnimationState *_state = (AnimationState *) state;
- return _state->getTimeScale();
- }
- void spine_animation_state_set_time_scale(spine_animation_state state, float timeScale) {
- if (state == nullptr) return;
- AnimationState *_state = (AnimationState *) state;
- _state->setTimeScale(timeScale);
- }
- int32_t spine_animation_state_events_get_num_events(spine_animation_state_events events) {
- if (events == nullptr) return 0;
- EventListener *_events = (EventListener *) events;
- return (int32_t) _events->events.size();
- }
- spine_event_type spine_animation_state_events_get_event_type(spine_animation_state_events events, int32_t index) {
- if (events == nullptr) return SPINE_EVENT_TYPE_DISPOSE;
- if (index < 0) return SPINE_EVENT_TYPE_DISPOSE;
- EventListener *_events = (EventListener *) events;
- if (index >= (int) _events->events.size()) return SPINE_EVENT_TYPE_DISPOSE;
- return (spine_event_type) _events->events[index].type;
- }
- spine_track_entry spine_animation_state_events_get_track_entry(spine_animation_state_events events, int32_t index) {
- if (events == nullptr) return nullptr;
- EventListener *_events = (EventListener *) events;
- if (index >= (int) _events->events.size()) return nullptr;
- return (spine_track_entry) _events->events[index].entry;
- }
- spine_event spine_animation_state_events_get_event(spine_animation_state_events events, int32_t index) {
- if (events == nullptr) return nullptr;
- EventListener *_events = (EventListener *) events;
- if (index >= (int) _events->events.size()) return nullptr;
- return (spine_event) _events->events[index].event;
- }
- void spine_animation_state_events_reset(spine_animation_state_events events) {
- if (events == nullptr) return;
- EventListener *_events = (EventListener *) events;
- _events->events.clear();
- }
- // TrackEntry
- int32_t spine_track_entry_get_track_index(spine_track_entry entry) {
- if (entry == nullptr) return 0;
- TrackEntry *_entry = (TrackEntry *) entry;
- return _entry->getTrackIndex();
- }
- spine_animation spine_track_entry_get_animation(spine_track_entry entry) {
- if (entry == nullptr) return nullptr;
- TrackEntry *_entry = (TrackEntry *) entry;
- return (spine_animation) _entry->getAnimation();
- }
- spine_track_entry spine_track_entry_get_previous(spine_track_entry entry) {
- if (entry == nullptr) return nullptr;
- TrackEntry *_entry = (TrackEntry *) entry;
- return (spine_track_entry) _entry->getPrevious();
- }
- spine_bool spine_track_entry_get_loop(spine_track_entry entry) {
- if (entry == nullptr) return 0;
- TrackEntry *_entry = (TrackEntry *) entry;
- return _entry->getLoop() ? -1 : 0;
- }
- void spine_track_entry_set_loop(spine_track_entry entry, spine_bool loop) {
- if (entry == nullptr) return;
- TrackEntry *_entry = (TrackEntry *) entry;
- _entry->setLoop(loop);
- }
- spine_bool spine_track_entry_get_hold_previous(spine_track_entry entry) {
- if (entry == nullptr) return 0;
- TrackEntry *_entry = (TrackEntry *) entry;
- return _entry->getHoldPrevious() ? -1 : 0;
- }
- void spine_track_entry_set_hold_previous(spine_track_entry entry, spine_bool holdPrevious) {
- if (entry == nullptr) return;
- TrackEntry *_entry = (TrackEntry *) entry;
- _entry->setHoldPrevious(holdPrevious);
- }
- spine_bool spine_track_entry_get_reverse(spine_track_entry entry) {
- if (entry == nullptr) return 0;
- TrackEntry *_entry = (TrackEntry *) entry;
- return _entry->getReverse() ? -1 : 0;
- }
- void spine_track_entry_set_reverse(spine_track_entry entry, spine_bool reverse) {
- if (entry == nullptr) return;
- TrackEntry *_entry = (TrackEntry *) entry;
- _entry->setReverse(reverse);
- }
- spine_bool spine_track_entry_get_shortest_rotation(spine_track_entry entry) {
- if (entry == nullptr) return 0;
- TrackEntry *_entry = (TrackEntry *) entry;
- return _entry->getShortestRotation() ? -1 : 0;
- }
- void spine_track_entry_set_shortest_rotation(spine_track_entry entry, spine_bool shortestRotation) {
- if (entry == nullptr) return;
- TrackEntry *_entry = (TrackEntry *) entry;
- _entry->setShortestRotation(shortestRotation);
- }
- float spine_track_entry_get_delay(spine_track_entry entry) {
- if (entry == nullptr) return 0;
- TrackEntry *_entry = (TrackEntry *) entry;
- return _entry->getDelay();
- }
- void spine_track_entry_set_delay(spine_track_entry entry, float delay) {
- if (entry == nullptr) return;
- TrackEntry *_entry = (TrackEntry *) entry;
- _entry->setDelay(delay);
- }
- float spine_track_entry_get_track_time(spine_track_entry entry) {
- if (entry == nullptr) return 0;
- TrackEntry *_entry = (TrackEntry *) entry;
- return _entry->getTrackTime();
- }
- void spine_track_entry_set_track_time(spine_track_entry entry, float trackTime) {
- if (entry == nullptr) return;
- TrackEntry *_entry = (TrackEntry *) entry;
- _entry->setTrackTime(trackTime);
- }
- float spine_track_entry_get_track_end(spine_track_entry entry) {
- if (entry == nullptr) return 0;
- TrackEntry *_entry = (TrackEntry *) entry;
- return _entry->getTrackEnd();
- }
- void spine_track_entry_set_track_end(spine_track_entry entry, float trackEnd) {
- if (entry == nullptr) return;
- TrackEntry *_entry = (TrackEntry *) entry;
- _entry->setTrackEnd(trackEnd);
- }
- float spine_track_entry_get_animation_start(spine_track_entry entry) {
- if (entry == nullptr) return 0;
- TrackEntry *_entry = (TrackEntry *) entry;
- return _entry->getAnimationStart();
- }
- void spine_track_entry_set_animation_start(spine_track_entry entry, float animationStart) {
- if (entry == nullptr) return;
- TrackEntry *_entry = (TrackEntry *) entry;
- _entry->setAnimationStart(animationStart);
- }
- float spine_track_entry_get_animation_end(spine_track_entry entry) {
- if (entry == nullptr) return 0;
- TrackEntry *_entry = (TrackEntry *) entry;
- return _entry->getAnimationEnd();
- }
- void spine_track_entry_set_animation_end(spine_track_entry entry, float animationEnd) {
- if (entry == nullptr) return;
- TrackEntry *_entry = (TrackEntry *) entry;
- _entry->setAnimationEnd(animationEnd);
- }
- float spine_track_entry_get_animation_last(spine_track_entry entry) {
- if (entry == nullptr) return 0;
- TrackEntry *_entry = (TrackEntry *) entry;
- return _entry->getAnimationLast();
- }
- void spine_track_entry_set_animation_last(spine_track_entry entry, float animationLast) {
- if (entry == nullptr) return;
- TrackEntry *_entry = (TrackEntry *) entry;
- _entry->setAnimationLast(animationLast);
- }
- float spine_track_entry_get_animation_time(spine_track_entry entry) {
- if (entry == nullptr) return 0;
- TrackEntry *_entry = (TrackEntry *) entry;
- return _entry->getAnimationTime();
- }
- float spine_track_entry_get_time_scale(spine_track_entry entry) {
- if (entry == nullptr) return 0;
- TrackEntry *_entry = (TrackEntry *) entry;
- return _entry->getTimeScale();
- }
- void spine_track_entry_set_time_scale(spine_track_entry entry, float timeScale) {
- if (entry == nullptr) return;
- TrackEntry *_entry = (TrackEntry *) entry;
- _entry->setTimeScale(timeScale);
- }
- float spine_track_entry_get_alpha(spine_track_entry entry) {
- if (entry == nullptr) return 0;
- TrackEntry *_entry = (TrackEntry *) entry;
- return _entry->getAlpha();
- }
- void spine_track_entry_set_alpha(spine_track_entry entry, float alpha) {
- if (entry == nullptr) return;
- TrackEntry *_entry = (TrackEntry *) entry;
- _entry->setAlpha(alpha);
- }
- float spine_track_entry_get_event_threshold(spine_track_entry entry) {
- if (entry == nullptr) return 0;
- TrackEntry *_entry = (TrackEntry *) entry;
- return _entry->getEventThreshold();
- }
- void spine_track_entry_set_event_threshold(spine_track_entry entry, float eventThreshold) {
- if (entry == nullptr) return;
- TrackEntry *_entry = (TrackEntry *) entry;
- _entry->setEventThreshold(eventThreshold);
- }
- float spine_track_entry_get_alpha_attachment_threshold(spine_track_entry entry) {
- if (entry == nullptr) return 0;
- TrackEntry *_entry = (TrackEntry *) entry;
- return _entry->getAlphaAttachmentThreshold();
- }
- void spine_track_entry_set_alpha_attachment_threshold(spine_track_entry entry, float attachmentThreshold) {
- if (entry == nullptr) return;
- TrackEntry *_entry = (TrackEntry *) entry;
- _entry->setAlphaAttachmentThreshold(attachmentThreshold);
- }
- float spine_track_entry_get_mix_attachment_threshold(spine_track_entry entry) {
- if (entry == nullptr) return 0;
- TrackEntry *_entry = (TrackEntry *) entry;
- return _entry->getMixAttachmentThreshold();
- }
- void spine_track_entry_set_mix_attachment_threshold(spine_track_entry entry, float attachmentThreshold) {
- if (entry == nullptr) return;
- TrackEntry *_entry = (TrackEntry *) entry;
- _entry->setMixAttachmentThreshold(attachmentThreshold);
- }
- float spine_track_entry_get_mix_draw_order_threshold(spine_track_entry entry) {
- if (entry == nullptr) return 0;
- TrackEntry *_entry = (TrackEntry *) entry;
- return _entry->getMixDrawOrderThreshold();
- }
- void spine_track_entry_set_mix_draw_order_threshold(spine_track_entry entry, float drawOrderThreshold) {
- if (entry == nullptr) return;
- TrackEntry *_entry = (TrackEntry *) entry;
- _entry->setMixDrawOrderThreshold(drawOrderThreshold);
- }
- spine_track_entry spine_track_entry_get_next(spine_track_entry entry) {
- if (entry == nullptr) return nullptr;
- TrackEntry *_entry = (TrackEntry *) entry;
- return (spine_track_entry) _entry->getNext();
- }
- spine_bool spine_track_entry_is_complete(spine_track_entry entry) {
- if (entry == nullptr) return 0;
- TrackEntry *_entry = (TrackEntry *) entry;
- return _entry->isComplete() ? -1 : 0;
- }
- float spine_track_entry_get_mix_time(spine_track_entry entry) {
- if (entry == nullptr) return 0;
- TrackEntry *_entry = (TrackEntry *) entry;
- return _entry->getMixTime();
- }
- void spine_track_entry_set_mix_time(spine_track_entry entry, float mixTime) {
- if (entry == nullptr) return;
- TrackEntry *_entry = (TrackEntry *) entry;
- _entry->setMixTime(mixTime);
- }
- float spine_track_entry_get_mix_duration(spine_track_entry entry) {
- if (entry == nullptr) return 0;
- TrackEntry *_entry = (TrackEntry *) entry;
- return _entry->getMixDuration();
- }
- void spine_track_entry_set_mix_duration(spine_track_entry entry, float mixDuration) {
- if (entry == nullptr) return;
- TrackEntry *_entry = (TrackEntry *) entry;
- _entry->setMixDuration(mixDuration);
- }
- spine_mix_blend spine_track_entry_get_mix_blend(spine_track_entry entry) {
- if (entry == nullptr) return SPINE_MIX_BLEND_SETUP;
- TrackEntry *_entry = (TrackEntry *) entry;
- return (spine_mix_blend) _entry->getMixBlend();
- }
- void spine_track_entry_set_mix_blend(spine_track_entry entry, spine_mix_blend mixBlend) {
- if (entry == nullptr) return;
- TrackEntry *_entry = (TrackEntry *) entry;
- _entry->setMixBlend((MixBlend) mixBlend);
- }
- spine_track_entry spine_track_entry_get_mixing_from(spine_track_entry entry) {
- if (entry == nullptr) return nullptr;
- TrackEntry *_entry = (TrackEntry *) entry;
- return (spine_track_entry) _entry->getMixingFrom();
- }
- spine_track_entry spine_track_entry_get_mixing_to(spine_track_entry entry) {
- if (entry == nullptr) return nullptr;
- TrackEntry *_entry = (TrackEntry *) entry;
- return (spine_track_entry) _entry->getMixingTo();
- }
- void spine_track_entry_reset_rotation_directions(spine_track_entry entry) {
- if (entry == nullptr) return;
- TrackEntry *_entry = (TrackEntry *) entry;
- _entry->resetRotationDirections();
- }
- float spine_track_entry_get_track_complete(spine_track_entry entry) {
- if (entry == nullptr) return 0;
- TrackEntry *_entry = (TrackEntry *) entry;
- return _entry->getTrackComplete();
- }
- spine_bool spine_track_entry_was_applied(spine_track_entry entry) {
- if (entry == nullptr) return false;
- TrackEntry *_entry = (TrackEntry *) entry;
- return _entry->wasApplied();
- }
- spine_bool spine_track_entry_is_next_ready(spine_track_entry entry) {
- if (entry == nullptr) return false;
- TrackEntry *_entry = (TrackEntry *) entry;
- return _entry->isNextReady();
- }
- // Skeleton
- void spine_skeleton_update_cache(spine_skeleton skeleton) {
- if (skeleton == nullptr) return;
- Skeleton *_skeleton = (Skeleton *) skeleton;
- _skeleton->updateCache();
- }
- void spine_skeleton_update_world_transform(spine_skeleton skeleton, spine_physics physics) {
- if (skeleton == nullptr) return;
- Skeleton *_skeleton = (Skeleton *) skeleton;
- _skeleton->updateWorldTransform((spine::Physics) physics);
- }
- void spine_skeleton_update_world_transform_bone(spine_skeleton skeleton, spine_physics physics, spine_bone parent) {
- if (skeleton == nullptr) return;
- if (parent == nullptr) return;
- Skeleton *_skeleton = (Skeleton *) skeleton;
- Bone *_bone = (Bone *) parent;
- _skeleton->updateWorldTransform((spine::Physics) physics, _bone);
- }
- void spine_skeleton_set_to_setup_pose(spine_skeleton skeleton) {
- if (skeleton == nullptr) return;
- Skeleton *_skeleton = (Skeleton *) skeleton;
- _skeleton->setToSetupPose();
- }
- void spine_skeleton_set_bones_to_setup_pose(spine_skeleton skeleton) {
- if (skeleton == nullptr) return;
- Skeleton *_skeleton = (Skeleton *) skeleton;
- _skeleton->setBonesToSetupPose();
- }
- void spine_skeleton_set_slots_to_setup_pose(spine_skeleton skeleton) {
- if (skeleton == nullptr) return;
- Skeleton *_skeleton = (Skeleton *) skeleton;
- _skeleton->setSlotsToSetupPose();
- }
- spine_bone spine_skeleton_find_bone(spine_skeleton skeleton, const utf8 *boneName) {
- if (skeleton == nullptr) return nullptr;
- Skeleton *_skeleton = (Skeleton *) skeleton;
- return (spine_bone) _skeleton->findBone(boneName);
- }
- spine_slot spine_skeleton_find_slot(spine_skeleton skeleton, const utf8 *slotName) {
- if (skeleton == nullptr) return nullptr;
- Skeleton *_skeleton = (Skeleton *) skeleton;
- return (spine_slot) _skeleton->findSlot(slotName);
- }
- void spine_skeleton_set_skin_by_name(spine_skeleton skeleton, const utf8 *skinName) {
- if (skeleton == nullptr) return;
- Skeleton *_skeleton = (Skeleton *) skeleton;
- _skeleton->setSkin(skinName);
- }
- void spine_skeleton_set_skin(spine_skeleton skeleton, spine_skin skin) {
- if (skeleton == nullptr) return;
- if (skin == nullptr) return;
- Skeleton *_skeleton = (Skeleton *) skeleton;
- _skeleton->setSkin((Skin *) skin);
- }
- spine_attachment spine_skeleton_get_attachment_by_name(spine_skeleton skeleton, const utf8 *slotName, const utf8 *attachmentName) {
- if (skeleton == nullptr) return nullptr;
- Skeleton *_skeleton = (Skeleton *) skeleton;
- return (spine_attachment) _skeleton->getAttachment(slotName, attachmentName);
- }
- spine_attachment spine_skeleton_get_attachment(spine_skeleton skeleton, int32_t slotIndex, const utf8 *attachmentName) {
- if (skeleton == nullptr) return nullptr;
- Skeleton *_skeleton = (Skeleton *) skeleton;
- return (spine_attachment) _skeleton->getAttachment(slotIndex, attachmentName);
- }
- void spine_skeleton_set_attachment(spine_skeleton skeleton, const utf8 *slotName, const utf8 *attachmentName) {
- if (skeleton == nullptr) return;
- Skeleton *_skeleton = (Skeleton *) skeleton;
- return _skeleton->setAttachment(slotName, attachmentName);
- }
- spine_ik_constraint spine_skeleton_find_ik_constraint(spine_skeleton skeleton, const utf8 *constraintName) {
- if (skeleton == nullptr) return nullptr;
- Skeleton *_skeleton = (Skeleton *) skeleton;
- return (spine_ik_constraint) _skeleton->findIkConstraint(constraintName);
- }
- spine_transform_constraint spine_skeleton_find_transform_constraint(spine_skeleton skeleton, const utf8 *constraintName) {
- if (skeleton == nullptr) return nullptr;
- Skeleton *_skeleton = (Skeleton *) skeleton;
- return (spine_transform_constraint) _skeleton->findTransformConstraint(constraintName);
- }
- spine_path_constraint spine_skeleton_find_path_constraint(spine_skeleton skeleton, const utf8 *constraintName) {
- if (skeleton == nullptr) return nullptr;
- Skeleton *_skeleton = (Skeleton *) skeleton;
- return (spine_path_constraint) _skeleton->findPathConstraint(constraintName);
- }
- spine_physics_constraint spine_skeleton_find_physics_constraint(spine_skeleton skeleton, const utf8 *constraintName) {
- if (skeleton == nullptr) return nullptr;
- Skeleton *_skeleton = (Skeleton *) skeleton;
- return (spine_physics_constraint) _skeleton->findPhysicsConstraint(constraintName);
- }
- _spine_bounds tmp_bounds;
- spine_bounds spine_skeleton_get_bounds(spine_skeleton skeleton) {
- _spine_bounds *bounds = &tmp_bounds;
- if (skeleton == nullptr) return (spine_bounds) bounds;
- Skeleton *_skeleton = (Skeleton *) skeleton;
- Vector<float> vertices;
- SkeletonClipping clipper;
- _skeleton->getBounds(bounds->x, bounds->y, bounds->width, bounds->height, vertices, &clipper);
- return (spine_bounds) bounds;
- }
- spine_bone spine_skeleton_get_root_bone(spine_skeleton skeleton) {
- if (skeleton == nullptr) return nullptr;
- Skeleton *_skeleton = (Skeleton *) skeleton;
- return (spine_bone) _skeleton->getRootBone();
- }
- spine_skeleton_data spine_skeleton_get_data(spine_skeleton skeleton) {
- if (skeleton == nullptr) return nullptr;
- Skeleton *_skeleton = (Skeleton *) skeleton;
- return (spine_skeleton_data) _skeleton->getData();
- }
- int32_t spine_skeleton_get_num_bones(spine_skeleton skeleton) {
- if (skeleton == nullptr) return 0;
- Skeleton *_skeleton = (Skeleton *) skeleton;
- return (int32_t) _skeleton->getBones().size();
- }
- spine_bone *spine_skeleton_get_bones(spine_skeleton skeleton) {
- if (skeleton == nullptr) return nullptr;
- Skeleton *_skeleton = (Skeleton *) skeleton;
- return (spine_bone *) _skeleton->getBones().buffer();
- }
- int32_t spine_skeleton_get_num_slots(spine_skeleton skeleton) {
- if (skeleton == nullptr) return 0;
- Skeleton *_skeleton = (Skeleton *) skeleton;
- return (int32_t) _skeleton->getSlots().size();
- }
- spine_slot *spine_skeleton_get_slots(spine_skeleton skeleton) {
- if (skeleton == nullptr) return nullptr;
- Skeleton *_skeleton = (Skeleton *) skeleton;
- return (spine_slot *) _skeleton->getSlots().buffer();
- }
- int32_t spine_skeleton_get_num_draw_order(spine_skeleton skeleton) {
- if (skeleton == nullptr) return 0;
- Skeleton *_skeleton = (Skeleton *) skeleton;
- return (int32_t) _skeleton->getDrawOrder().size();
- }
- spine_slot *spine_skeleton_get_draw_order(spine_skeleton skeleton) {
- if (skeleton == nullptr) return nullptr;
- Skeleton *_skeleton = (Skeleton *) skeleton;
- return (spine_slot *) _skeleton->getDrawOrder().buffer();
- }
- int32_t spine_skeleton_get_num_ik_constraints(spine_skeleton skeleton) {
- if (skeleton == nullptr) return 0;
- Skeleton *_skeleton = (Skeleton *) skeleton;
- return (int32_t) _skeleton->getIkConstraints().size();
- }
- spine_ik_constraint *spine_skeleton_get_ik_constraints(spine_skeleton skeleton) {
- if (skeleton == nullptr) return nullptr;
- Skeleton *_skeleton = (Skeleton *) skeleton;
- return (spine_ik_constraint *) _skeleton->getIkConstraints().buffer();
- }
- int32_t spine_skeleton_get_num_transform_constraints(spine_skeleton skeleton) {
- if (skeleton == nullptr) return 0;
- Skeleton *_skeleton = (Skeleton *) skeleton;
- return (int32_t) _skeleton->getTransformConstraints().size();
- }
- spine_transform_constraint *spine_skeleton_get_transform_constraints(spine_skeleton skeleton) {
- if (skeleton == nullptr) return nullptr;
- Skeleton *_skeleton = (Skeleton *) skeleton;
- return (spine_transform_constraint *) _skeleton->getTransformConstraints().buffer();
- }
- int32_t spine_skeleton_get_num_path_constraints(spine_skeleton skeleton) {
- if (skeleton == nullptr) return 0;
- Skeleton *_skeleton = (Skeleton *) skeleton;
- return (int32_t) _skeleton->getPathConstraints().size();
- }
- spine_path_constraint *spine_skeleton_get_path_constraints(spine_skeleton skeleton) {
- if (skeleton == nullptr) return nullptr;
- Skeleton *_skeleton = (Skeleton *) skeleton;
- return (spine_path_constraint *) _skeleton->getPathConstraints().buffer();
- }
- int32_t spine_skeleton_get_num_physics_constraints(spine_skeleton skeleton) {
- if (skeleton == nullptr) return 0;
- Skeleton *_skeleton = (Skeleton *) skeleton;
- return (int32_t) _skeleton->getPhysicsConstraints().size();
- }
- spine_physics_constraint *spine_skeleton_get_physics_constraints(spine_skeleton skeleton) {
- if (skeleton == nullptr) return nullptr;
- Skeleton *_skeleton = (Skeleton *) skeleton;
- return (spine_physics_constraint *) _skeleton->getPhysicsConstraints().buffer();
- }
- spine_skin spine_skeleton_get_skin(spine_skeleton skeleton) {
- if (skeleton == nullptr) return nullptr;
- Skeleton *_skeleton = (Skeleton *) skeleton;
- return (spine_skin) _skeleton->getSkin();
- }
- spine_color spine_skeleton_get_color(spine_skeleton skeleton) {
- if (skeleton == nullptr) return (spine_color) &NULL_COLOR;
- Skeleton *_skeleton = (Skeleton *) skeleton;
- return (spine_color) &_skeleton->getColor();
- }
- void spine_skeleton_set_color(spine_skeleton skeleton, float r, float g, float b, float a) {
- if (skeleton == nullptr) return;
- Skeleton *_skeleton = (Skeleton *) skeleton;
- _skeleton->getColor().set(r, g, b, a);
- }
- void spine_skeleton_set_position(spine_skeleton skeleton, float x, float y) {
- if (skeleton == nullptr) return;
- Skeleton *_skeleton = (Skeleton *) skeleton;
- _skeleton->setPosition(x, y);
- }
- float spine_skeleton_get_x(spine_skeleton skeleton) {
- if (skeleton == nullptr) return 0;
- Skeleton *_skeleton = (Skeleton *) skeleton;
- return _skeleton->getX();
- }
- void spine_skeleton_set_x(spine_skeleton skeleton, float x) {
- if (skeleton == nullptr) return;
- Skeleton *_skeleton = (Skeleton *) skeleton;
- _skeleton->setX(x);
- }
- float spine_skeleton_get_y(spine_skeleton skeleton) {
- if (skeleton == nullptr) return 0;
- Skeleton *_skeleton = (Skeleton *) skeleton;
- return _skeleton->getY();
- }
- void spine_skeleton_set_y(spine_skeleton skeleton, float y) {
- if (skeleton == nullptr) return;
- Skeleton *_skeleton = (Skeleton *) skeleton;
- _skeleton->setY(y);
- }
- void spine_skeleton_set_scale(spine_skeleton skeleton, float scaleX, float scaleY) {
- if (skeleton == nullptr) return;
- Skeleton *_skeleton = (Skeleton *) skeleton;
- _skeleton->setScaleX(scaleX);
- _skeleton->setScaleY(scaleY);
- }
- float spine_skeleton_get_scale_x(spine_skeleton skeleton) {
- if (skeleton == nullptr) return 0;
- Skeleton *_skeleton = (Skeleton *) skeleton;
- return _skeleton->getScaleX();
- }
- void spine_skeleton_set_scale_x(spine_skeleton skeleton, float scaleX) {
- if (skeleton == nullptr) return;
- Skeleton *_skeleton = (Skeleton *) skeleton;
- _skeleton->setScaleX(scaleX);
- }
- float spine_skeleton_get_scale_y(spine_skeleton skeleton) {
- if (skeleton == nullptr) return 0;
- Skeleton *_skeleton = (Skeleton *) skeleton;
- return _skeleton->getScaleY();
- }
- void spine_skeleton_set_scale_y(spine_skeleton skeleton, float scaleY) {
- if (skeleton == nullptr) return;
- Skeleton *_skeleton = (Skeleton *) skeleton;
- _skeleton->setScaleY(scaleY);
- }
- float spine_skeleton_get_time(spine_skeleton skeleton) {
- if (skeleton == nullptr) return 0;
- Skeleton *_skeleton = (Skeleton *) skeleton;
- return _skeleton->getTime();
- }
- void spine_skeleton_set_time(spine_skeleton skeleton, float time) {
- if (skeleton == nullptr) return;
- Skeleton *_skeleton = (Skeleton *) skeleton;
- _skeleton->setTime(time);
- }
- void spine_skeleton_update(spine_skeleton skeleton, float delta) {
- if (skeleton == nullptr) return;
- Skeleton *_skeleton = (Skeleton *) skeleton;
- _skeleton->update(delta);
- }
- // EventData
- const utf8 *spine_event_data_get_name(spine_event_data event) {
- if (event == nullptr) return nullptr;
- EventData *_event = (EventData *) event;
- return (utf8 *) _event->getName().buffer();
- }
- int32_t spine_event_data_get_int_value(spine_event_data event) {
- if (event == nullptr) return 0;
- EventData *_event = (EventData *) event;
- return _event->getIntValue();
- }
- void spine_event_data_set_int_value(spine_event_data event, int32_t value) {
- if (event == nullptr) return;
- EventData *_event = (EventData *) event;
- _event->setIntValue(value);
- }
- float spine_event_data_get_float_value(spine_event_data event) {
- if (event == nullptr) return 0;
- EventData *_event = (EventData *) event;
- return _event->getFloatValue();
- }
- void spine_event_data_set_float_value(spine_event_data event, float value) {
- if (event == nullptr) return;
- EventData *_event = (EventData *) event;
- _event->setFloatValue(value);
- }
- const utf8 *spine_event_data_get_string_value(spine_event_data event) {
- if (event == nullptr) return nullptr;
- EventData *_event = (EventData *) event;
- return (utf8 *) _event->getStringValue().buffer();
- }
- void spine_event_data_set_string_value(spine_event_data event, const utf8 *value) {
- if (event == nullptr) return;
- EventData *_event = (EventData *) event;
- _event->setStringValue(value);
- }
- const utf8 *spine_event_data_get_audio_path(spine_event_data event) {
- if (event == nullptr) return nullptr;
- EventData *_event = (EventData *) event;
- return (utf8 *) _event->getAudioPath().buffer();
- }
- float spine_event_data_get_volume(spine_event_data event) {
- if (event == nullptr) return 0;
- EventData *_event = (EventData *) event;
- return _event->getVolume();
- }
- void spine_event_data_set_volume(spine_event_data event, float volume) {
- if (event == nullptr) return;
- EventData *_event = (EventData *) event;
- _event->setVolume(volume);
- }
- float spine_event_data_get_balance(spine_event_data event) {
- if (event == nullptr) return 0;
- EventData *_event = (EventData *) event;
- return _event->getBalance();
- }
- void spine_event_data_set_balance(spine_event_data event, float balance) {
- if (event == nullptr) return;
- EventData *_event = (EventData *) event;
- _event->setBalance(balance);
- }
- // Event
- spine_event_data spine_event_get_data(spine_event event) {
- if (event == nullptr) return nullptr;
- Event *_event = (Event *) event;
- return (spine_event_data) &_event->getData();
- }
- float spine_event_get_time(spine_event event) {
- if (event == nullptr) return 0;
- Event *_event = (Event *) event;
- return _event->getTime();
- }
- int32_t spine_event_get_int_value(spine_event event) {
- if (event == nullptr) return 0;
- Event *_event = (Event *) event;
- return _event->getIntValue();
- }
- void spine_event_set_int_value(spine_event event, int32_t value) {
- if (event == nullptr) return;
- Event *_event = (Event *) event;
- _event->setIntValue(value);
- }
- float spine_event_get_float_value(spine_event event) {
- if (event == nullptr) return 0;
- Event *_event = (Event *) event;
- return _event->getFloatValue();
- }
- void spine_event_set_float_value(spine_event event, float value) {
- if (event == nullptr) return;
- Event *_event = (Event *) event;
- _event->setFloatValue(value);
- }
- const utf8 *spine_event_get_string_value(spine_event event) {
- if (event == nullptr) return nullptr;
- Event *_event = (Event *) event;
- return (utf8 *) _event->getStringValue().buffer();
- }
- void spine_event_set_string_value(spine_event event, const utf8 *value) {
- if (event == nullptr) return;
- Event *_event = (Event *) event;
- _event->setStringValue(value);
- }
- float spine_event_get_volume(spine_event event) {
- if (event == nullptr) return 0;
- Event *_event = (Event *) event;
- return _event->getVolume();
- }
- void spine_event_set_volume(spine_event event, float volume) {
- if (event == nullptr) return;
- Event *_event = (Event *) event;
- _event->setVolume(volume);
- }
- float spine_event_get_balance(spine_event event) {
- if (event == nullptr) return 0;
- Event *_event = (Event *) event;
- return _event->getBalance();
- }
- void spine_event_set_balance(spine_event event, float balance) {
- if (event == nullptr) return;
- Event *_event = (Event *) event;
- _event->setBalance(balance);
- }
- // SlotData
- int32_t spine_slot_data_get_index(spine_slot_data slot) {
- if (slot == nullptr) return 0;
- SlotData *_slot = (SlotData *) slot;
- return _slot->getIndex();
- }
- const utf8 *spine_slot_data_get_name(spine_slot_data slot) {
- if (slot == nullptr) return nullptr;
- SlotData *_slot = (SlotData *) slot;
- return (utf8 *) _slot->getName().buffer();
- }
- spine_bone_data spine_slot_data_get_bone_data(spine_slot_data slot) {
- if (slot == nullptr) return nullptr;
- SlotData *_slot = (SlotData *) slot;
- return (spine_bone_data) &_slot->getBoneData();
- }
- spine_color spine_slot_data_get_color(spine_slot_data slot) {
- if (slot == nullptr) return (spine_color) &NULL_COLOR;
- SlotData *_slot = (SlotData *) slot;
- return (spine_color) &_slot->getColor();
- }
- void spine_slot_data_set_color(spine_slot_data slot, float r, float g, float b, float a) {
- if (slot == nullptr) return;
- SlotData *_slot = (SlotData *) slot;
- _slot->getColor().set(r, g, b, a);
- }
- spine_color spine_slot_data_get_dark_color(spine_slot_data slot) {
- if (slot == nullptr) return (spine_color) &NULL_COLOR;
- SlotData *_slot = (SlotData *) slot;
- return (spine_color) &_slot->getDarkColor();
- }
- void spine_slot_data_set_dark_color(spine_slot_data slot, float r, float g, float b, float a) {
- if (slot == nullptr) return;
- SlotData *_slot = (SlotData *) slot;
- _slot->getDarkColor().set(r, g, b, a);
- }
- spine_bool spine_slot_data_get_has_dark_color(spine_slot_data slot) {
- if (slot == nullptr) return 0;
- SlotData *_slot = (SlotData *) slot;
- return _slot->hasDarkColor() ? -1 : 0;
- }
- void spine_slot_data_set_has_dark_color(spine_slot_data slot, spine_bool hasDarkColor) {
- if (slot == nullptr) return;
- SlotData *_slot = (SlotData *) slot;
- _slot->setHasDarkColor(hasDarkColor);
- }
- const utf8 *spine_slot_data_get_attachment_name(spine_slot_data slot) {
- if (slot == nullptr) return nullptr;
- SlotData *_slot = (SlotData *) slot;
- return (utf8 *) _slot->getAttachmentName().buffer();
- }
- void spine_slot_data_set_attachment_name(spine_slot_data slot, const utf8 *attachmentName) {
- if (slot == nullptr) return;
- SlotData *_slot = (SlotData *) slot;
- _slot->setAttachmentName(attachmentName);
- }
- spine_blend_mode spine_slot_data_get_blend_mode(spine_slot_data slot) {
- if (slot == nullptr) return SPINE_BLEND_MODE_NORMAL;
- SlotData *_slot = (SlotData *) slot;
- return (spine_blend_mode) _slot->getBlendMode();
- }
- void spine_slot_data_set_blend_mode(spine_slot_data slot, spine_blend_mode blendMode) {
- if (slot == nullptr) return;
- SlotData *_slot = (SlotData *) slot;
- _slot->setBlendMode((BlendMode) blendMode);
- }
- spine_bool spine_slot_data_is_visible(spine_slot_data slot) {
- if (slot == nullptr) return false;
- SlotData *_slot = (SlotData *) slot;
- return _slot->isVisible();
- }
- void spine_slot_data_set_visible(spine_slot_data slot, spine_bool visible) {
- if (slot == nullptr) return;
- SlotData *_slot = (SlotData *) slot;
- _slot->setVisible(visible);
- }
- // Slot
- void spine_slot_set_to_setup_pose(spine_slot slot) {
- if (slot == nullptr) return;
- Slot *_slot = (Slot *) slot;
- _slot->setToSetupPose();
- }
- spine_slot_data spine_slot_get_data(spine_slot slot) {
- if (slot == nullptr) return nullptr;
- Slot *_slot = (Slot *) slot;
- return (spine_slot_data) &_slot->getData();
- }
- spine_bone spine_slot_get_bone(spine_slot slot) {
- if (slot == nullptr) return nullptr;
- Slot *_slot = (Slot *) slot;
- return (spine_bone) &_slot->getBone();
- }
- spine_skeleton spine_slot_get_skeleton(spine_slot slot) {
- if (slot == nullptr) return nullptr;
- Slot *_slot = (Slot *) slot;
- return (spine_skeleton) &_slot->getSkeleton();
- }
- spine_color spine_slot_get_color(spine_slot slot) {
- if (slot == nullptr) return (spine_color) &NULL_COLOR;
- Slot *_slot = (Slot *) slot;
- return (spine_color) &_slot->getColor();
- }
- void spine_slot_set_color(spine_slot slot, float r, float g, float b, float a) {
- if (slot == nullptr) return;
- Slot *_slot = (Slot *) slot;
- _slot->getColor().set(r, g, b, a);
- }
- spine_color spine_slot_get_dark_color(spine_slot slot) {
- if (slot == nullptr) return (spine_color) &NULL_COLOR;
- Slot *_slot = (Slot *) slot;
- return (spine_color) &_slot->getDarkColor();
- }
- void spine_slot_set_dark_color(spine_slot slot, float r, float g, float b, float a) {
- if (slot == nullptr) return;
- Slot *_slot = (Slot *) slot;
- _slot->getDarkColor().set(r, g, b, a);
- }
- spine_bool spine_slot_has_dark_color(spine_slot slot) {
- if (slot == nullptr) return 0;
- Slot *_slot = (Slot *) slot;
- return _slot->hasDarkColor() ? -1 : 0;
- }
- spine_attachment spine_slot_get_attachment(spine_slot slot) {
- if (slot == nullptr) return nullptr;
- Slot *_slot = (Slot *) slot;
- return (spine_attachment) _slot->getAttachment();
- }
- void spine_slot_set_attachment(spine_slot slot, spine_attachment attachment) {
- if (slot == nullptr) return;
- Slot *_slot = (Slot *) slot;
- _slot->setAttachment((Attachment *) attachment);
- }
- int32_t spine_slot_get_sequence_index(spine_slot slot) {
- if (slot == nullptr) return 0;
- Slot *_slot = (Slot *) slot;
- return _slot->getSequenceIndex();
- }
- void spine_slot_set_sequence_index(spine_slot slot, int32_t sequenceIndex) {
- if (slot == nullptr) return;
- Slot *_slot = (Slot *) slot;
- _slot->setSequenceIndex(sequenceIndex);
- }
- // BoneData
- int32_t spine_bone_data_get_index(spine_bone_data data) {
- if (data == nullptr) return 0;
- BoneData *_data = (BoneData *) data;
- return _data->getIndex();
- }
- const utf8 *spine_bone_data_get_name(spine_bone_data data) {
- if (data == nullptr) return nullptr;
- BoneData *_data = (BoneData *) data;
- return (utf8 *) _data->getName().buffer();
- }
- spine_bone_data spine_bone_data_get_parent(spine_bone_data data) {
- if (data == nullptr) return nullptr;
- BoneData *_data = (BoneData *) data;
- return (spine_bone_data) _data->getParent();
- }
- float spine_bone_data_get_length(spine_bone_data data) {
- if (data == nullptr) return 0;
- BoneData *_data = (BoneData *) data;
- return _data->getLength();
- }
- void spine_bone_data_set_length(spine_bone_data data, float length) {
- if (data == nullptr) return;
- BoneData *_data = (BoneData *) data;
- _data->setLength(length);
- }
- float spine_bone_data_get_x(spine_bone_data data) {
- if (data == nullptr) return 0;
- BoneData *_data = (BoneData *) data;
- return _data->getX();
- }
- void spine_bone_data_set_x(spine_bone_data data, float x) {
- if (data == nullptr) return;
- BoneData *_data = (BoneData *) data;
- _data->setX(x);
- }
- float spine_bone_data_get_y(spine_bone_data data) {
- if (data == nullptr) return 0;
- BoneData *_data = (BoneData *) data;
- return _data->getY();
- }
- void spine_bone_data_set_y(spine_bone_data data, float y) {
- if (data == nullptr) return;
- BoneData *_data = (BoneData *) data;
- _data->setY(y);
- }
- float spine_bone_data_get_rotation(spine_bone_data data) {
- if (data == nullptr) return 0;
- BoneData *_data = (BoneData *) data;
- return _data->getRotation();
- }
- void spine_bone_data_set_rotation(spine_bone_data data, float rotation) {
- if (data == nullptr) return;
- BoneData *_data = (BoneData *) data;
- _data->setRotation(rotation);
- }
- float spine_bone_data_get_scale_x(spine_bone_data data) {
- if (data == nullptr) return 0;
- BoneData *_data = (BoneData *) data;
- return _data->getScaleX();
- }
- void spine_bone_data_set_scale_x(spine_bone_data data, float scaleX) {
- if (data == nullptr) return;
- BoneData *_data = (BoneData *) data;
- _data->setScaleX(scaleX);
- }
- float spine_bone_data_get_scale_y(spine_bone_data data) {
- if (data == nullptr) return 0;
- BoneData *_data = (BoneData *) data;
- return _data->getScaleY();
- }
- void spine_bone_data_set_scale_y(spine_bone_data data, float scaleY) {
- if (data == nullptr) return;
- BoneData *_data = (BoneData *) data;
- _data->setScaleY(scaleY);
- }
- float spine_bone_data_get_shear_x(spine_bone_data data) {
- if (data == nullptr) return 0;
- BoneData *_data = (BoneData *) data;
- return _data->getShearX();
- }
- void spine_bone_data_set_shear_x(spine_bone_data data, float shearX) {
- if (data == nullptr) return;
- BoneData *_data = (BoneData *) data;
- _data->setShearX(shearX);
- }
- float spine_bone_data_get_shear_y(spine_bone_data data) {
- if (data == nullptr) return 0;
- BoneData *_data = (BoneData *) data;
- return _data->getShearY();
- }
- void spine_bone_data_set_shear_y(spine_bone_data data, float y) {
- if (data == nullptr) return;
- BoneData *_data = (BoneData *) data;
- _data->setShearY(y);
- }
- spine_inherit spine_bone_data_get_inherit(spine_bone_data data) {
- if (data == nullptr) return SPINE_INHERIT_NORMAL;
- BoneData *_data = (BoneData *) data;
- return (spine_inherit) _data->getInherit();
- }
- void spine_bone_data_set_inherit(spine_bone_data data, spine_inherit inherit) {
- if (data == nullptr) return;
- BoneData *_data = (BoneData *) data;
- _data->setInherit((Inherit) inherit);
- }
- spine_bool spine_bone_data_get_is_skin_required(spine_bone_data data) {
- if (data == nullptr) return 0;
- BoneData *_data = (BoneData *) data;
- return _data->isSkinRequired() ? -1 : 0;
- }
- void spine_bone_data_set_is_skin_required(spine_bone_data data, spine_bool isSkinRequired) {
- if (data == nullptr) return;
- BoneData *_data = (BoneData *) data;
- _data->setSkinRequired(isSkinRequired);
- }
- spine_color spine_bone_data_get_color(spine_bone_data data) {
- if (data == nullptr) return (spine_color) &NULL_COLOR;
- BoneData *_data = (BoneData *) data;
- return (spine_color) &_data->getColor();
- }
- void spine_bone_data_set_color(spine_bone_data data, float r, float g, float b, float a) {
- if (data == nullptr) return;
- BoneData *_data = (BoneData *) data;
- _data->getColor().set(r, g, b, a);
- }
- spine_bool spine_bone_data_is_visible(spine_bone_data data) {
- if (data == nullptr) return false;
- BoneData *_data = (BoneData *) data;
- return _data->isVisible();
- }
- void spine_bone_data_set_visible(spine_bone_data data, spine_bool isVisible) {
- if (data == nullptr) return;
- BoneData *_data = (BoneData *) data;
- _data->setVisible(isVisible);
- }
- // Bone
- void spine_bone_set_is_y_down(spine_bool yDown) {
- Bone::setYDown(yDown);
- }
- spine_bool spine_bone_get_is_y_down() {
- return Bone::isYDown() ? -1 : 0;
- }
- void spine_bone_update(spine_bone bone) {
- if (bone == nullptr) return;
- Bone *_bone = (Bone *) bone;
- _bone->update(spine::Physics_Update);
- }
- void spine_bone_update_world_transform(spine_bone bone) {
- if (bone == nullptr) return;
- Bone *_bone = (Bone *) bone;
- _bone->updateWorldTransform();
- }
- void spine_bone_update_world_transform_with(spine_bone bone, float x, float y, float rotation, float scaleX, float scaleY, float shearX, float shearY) {
- if (bone == nullptr) return;
- Bone *_bone = (Bone *) bone;
- _bone->updateWorldTransform(x, y, rotation, scaleX, scaleY, shearX, shearY);
- }
- void spine_bone_update_applied_transform(spine_bone bone) {
- if (bone == nullptr) return;
- Bone *_bone = (Bone *) bone;
- _bone->updateAppliedTransform();
- }
- void spine_bone_set_to_setup_pose(spine_bone bone) {
- if (bone == nullptr) return;
- Bone *_bone = (Bone *) bone;
- _bone->setToSetupPose();
- }
- _spine_vector tmp_vector;
- spine_vector spine_bone_world_to_local(spine_bone bone, float worldX, float worldY) {
- _spine_vector *coords = &tmp_vector;
- if (bone == nullptr) return (spine_vector) coords;
- Bone *_bone = (Bone *) bone;
- _bone->worldToLocal(worldX, worldY, coords->x, coords->y);
- return (spine_vector) coords;
- }
- spine_vector spine_bone_world_to_parent(spine_bone bone, float worldX, float worldY) {
- _spine_vector *coords = &tmp_vector;
- if (bone == nullptr) return (spine_vector) coords;
- Bone *_bone = (Bone *) bone;
- _bone->worldToParent(worldX, worldY, coords->x, coords->y);
- return (spine_vector) coords;
- }
- spine_vector spine_bone_local_to_world(spine_bone bone, float localX, float localY) {
- _spine_vector *coords = &tmp_vector;
- if (bone == nullptr) return (spine_vector) coords;
- Bone *_bone = (Bone *) bone;
- _bone->localToWorld(localX, localY, coords->x, coords->y);
- return (spine_vector) coords;
- }
- spine_vector spine_bone_parent_to_world(spine_bone bone, float localX, float localY) {
- _spine_vector *coords = &tmp_vector;
- if (bone == nullptr) return (spine_vector) coords;
- Bone *_bone = (Bone *) bone;
- _bone->parentToWorld(localX, localY, coords->x, coords->y);
- return (spine_vector) coords;
- }
- float spine_bone_world_to_local_rotation(spine_bone bone, float worldRotation) {
- if (bone == nullptr) return 0;
- Bone *_bone = (Bone *) bone;
- return _bone->worldToLocalRotation(worldRotation);
- }
- float spine_bone_local_to_world_rotation(spine_bone bone, float localRotation) {
- if (bone == nullptr) return 0;
- Bone *_bone = (Bone *) bone;
- return _bone->localToWorldRotation(localRotation);
- }
- void spine_bone_rotate_world(spine_bone bone, float degrees) {
- if (bone == nullptr) return;
- Bone *_bone = (Bone *) bone;
- _bone->rotateWorld(degrees);
- }
- float spine_bone_get_world_to_local_rotation_x(spine_bone bone) {
- if (bone == nullptr) return 0;
- Bone *_bone = (Bone *) bone;
- return _bone->getWorldToLocalRotationX();
- }
- float spine_bone_get_world_to_local_rotation_y(spine_bone bone) {
- if (bone == nullptr) return 0;
- Bone *_bone = (Bone *) bone;
- return _bone->getWorldToLocalRotationY();
- }
- spine_bone_data spine_bone_get_data(spine_bone bone) {
- if (bone == nullptr) return nullptr;
- Bone *_bone = (Bone *) bone;
- return (spine_bone_data) &_bone->getData();
- }
- spine_skeleton spine_bone_get_skeleton(spine_bone bone) {
- if (bone == nullptr) return nullptr;
- Bone *_bone = (Bone *) bone;
- return (spine_skeleton) &_bone->getSkeleton();
- }
- spine_bone spine_bone_get_parent(spine_bone bone) {
- if (bone == nullptr) return nullptr;
- Bone *_bone = (Bone *) bone;
- return (spine_bone) _bone->getParent();
- }
- int32_t spine_bone_get_num_children(spine_bone bone) {
- if (bone == nullptr) return 0;
- Bone *_bone = (Bone *) bone;
- return (int32_t) _bone->getChildren().size();
- }
- spine_bone *spine_bone_get_children(spine_bone bone) {
- if (bone == nullptr) return nullptr;
- Bone *_bone = (Bone *) bone;
- return (spine_bone *) _bone->getChildren().buffer();
- }
- float spine_bone_get_x(spine_bone bone) {
- if (bone == nullptr) return 0;
- Bone *_bone = (Bone *) bone;
- return _bone->getX();
- }
- void spine_bone_set_x(spine_bone bone, float x) {
- if (bone == nullptr) return;
- Bone *_bone = (Bone *) bone;
- _bone->setX(x);
- }
- float spine_bone_get_y(spine_bone bone) {
- if (bone == nullptr) return 0;
- Bone *_bone = (Bone *) bone;
- return _bone->getY();
- }
- void spine_bone_set_y(spine_bone bone, float y) {
- if (bone == nullptr) return;
- Bone *_bone = (Bone *) bone;
- _bone->setY(y);
- }
- float spine_bone_get_rotation(spine_bone bone) {
- if (bone == nullptr) return 0;
- Bone *_bone = (Bone *) bone;
- return _bone->getRotation();
- }
- void spine_bone_set_rotation(spine_bone bone, float rotation) {
- if (bone == nullptr) return;
- Bone *_bone = (Bone *) bone;
- _bone->setRotation(rotation);
- }
- float spine_bone_get_scale_x(spine_bone bone) {
- if (bone == nullptr) return 0;
- Bone *_bone = (Bone *) bone;
- return _bone->getScaleX();
- }
- void spine_bone_set_scale_x(spine_bone bone, float scaleX) {
- if (bone == nullptr) return;
- Bone *_bone = (Bone *) bone;
- _bone->setScaleX(scaleX);
- }
- float spine_bone_get_scale_y(spine_bone bone) {
- if (bone == nullptr) return 0;
- Bone *_bone = (Bone *) bone;
- return _bone->getScaleY();
- }
- void spine_bone_set_scale_y(spine_bone bone, float scaleY) {
- if (bone == nullptr) return;
- Bone *_bone = (Bone *) bone;
- _bone->setScaleY(scaleY);
- }
- float spine_bone_get_shear_x(spine_bone bone) {
- if (bone == nullptr) return 0;
- Bone *_bone = (Bone *) bone;
- return _bone->getShearX();
- }
- void spine_bone_set_shear_x(spine_bone bone, float shearX) {
- if (bone == nullptr) return;
- Bone *_bone = (Bone *) bone;
- _bone->setShearX(shearX);
- }
- float spine_bone_get_shear_y(spine_bone bone) {
- if (bone == nullptr) return 0;
- Bone *_bone = (Bone *) bone;
- return _bone->getShearY();
- }
- void spine_bone_set_shear_y(spine_bone bone, float shearY) {
- if (bone == nullptr) return;
- Bone *_bone = (Bone *) bone;
- _bone->setShearY(shearY);
- }
- float spine_bone_get_applied_rotation(spine_bone bone) {
- if (bone == nullptr) return 0;
- Bone *_bone = (Bone *) bone;
- return _bone->getAppliedRotation();
- }
- void spine_bone_set_applied_rotation(spine_bone bone, float rotation) {
- if (bone == nullptr) return;
- Bone *_bone = (Bone *) bone;
- _bone->setAppliedRotation(rotation);
- }
- float spine_bone_get_a_x(spine_bone bone) {
- if (bone == nullptr) return 0;
- Bone *_bone = (Bone *) bone;
- return _bone->getAX();
- }
- void spine_bone_set_a_x(spine_bone bone, float x) {
- if (bone == nullptr) return;
- Bone *_bone = (Bone *) bone;
- _bone->setAX(x);
- }
- float spine_bone_get_a_y(spine_bone bone) {
- if (bone == nullptr) return 0;
- Bone *_bone = (Bone *) bone;
- return _bone->getAY();
- }
- void spine_bone_set_a_y(spine_bone bone, float y) {
- if (bone == nullptr) return;
- Bone *_bone = (Bone *) bone;
- _bone->setAY(y);
- }
- float spine_bone_get_a_scale_x(spine_bone bone) {
- if (bone == nullptr) return 0;
- Bone *_bone = (Bone *) bone;
- return _bone->getAScaleX();
- }
- void spine_bone_set_a_scale_x(spine_bone bone, float scaleX) {
- if (bone == nullptr) return;
- Bone *_bone = (Bone *) bone;
- _bone->setAScaleX(scaleX);
- }
- float spine_bone_get_a_scale_y(spine_bone bone) {
- if (bone == nullptr) return 0;
- Bone *_bone = (Bone *) bone;
- return _bone->getAScaleY();
- }
- void spine_bone_set_a_scale_y(spine_bone bone, float scaleY) {
- if (bone == nullptr) return;
- Bone *_bone = (Bone *) bone;
- _bone->setAScaleY(scaleY);
- }
- float spine_bone_get_a_shear_x(spine_bone bone) {
- if (bone == nullptr) return 0;
- Bone *_bone = (Bone *) bone;
- return _bone->getAShearX();
- }
- void spine_bone_set_a_shear_x(spine_bone bone, float shearX) {
- if (bone == nullptr) return;
- Bone *_bone = (Bone *) bone;
- _bone->setAShearX(shearX);
- }
- float spine_bone_get_a_shear_y(spine_bone bone) {
- if (bone == nullptr) return 0;
- Bone *_bone = (Bone *) bone;
- return _bone->getAShearY();
- }
- void spine_bone_set_a_shear_y(spine_bone bone, float shearY) {
- if (bone == nullptr) return;
- Bone *_bone = (Bone *) bone;
- _bone->setAShearY(shearY);
- }
- float spine_bone_get_a(spine_bone bone) {
- if (bone == nullptr) return 0;
- Bone *_bone = (Bone *) bone;
- return _bone->getA();
- }
- void spine_bone_set_a(spine_bone bone, float a) {
- if (bone == nullptr) return;
- Bone *_bone = (Bone *) bone;
- _bone->setA(a);
- }
- float spine_bone_get_b(spine_bone bone) {
- if (bone == nullptr) return 0;
- Bone *_bone = (Bone *) bone;
- return _bone->getB();
- }
- void spine_bone_set_b(spine_bone bone, float b) {
- if (bone == nullptr) return;
- Bone *_bone = (Bone *) bone;
- _bone->setB(b);
- }
- float spine_bone_get_c(spine_bone bone) {
- if (bone == nullptr) return 0;
- Bone *_bone = (Bone *) bone;
- return _bone->getC();
- }
- void spine_bone_set_c(spine_bone bone, float c) {
- if (bone == nullptr) return;
- Bone *_bone = (Bone *) bone;
- _bone->setC(c);
- }
- float spine_bone_get_d(spine_bone bone) {
- if (bone == nullptr) return 0;
- Bone *_bone = (Bone *) bone;
- return _bone->getD();
- }
- void spine_bone_set_d(spine_bone bone, float d) {
- if (bone == nullptr) return;
- Bone *_bone = (Bone *) bone;
- _bone->setD(d);
- }
- float spine_bone_get_world_x(spine_bone bone) {
- if (bone == nullptr) return 0;
- Bone *_bone = (Bone *) bone;
- return _bone->getWorldX();
- }
- void spine_bone_set_world_x(spine_bone bone, float worldX) {
- if (bone == nullptr) return;
- Bone *_bone = (Bone *) bone;
- _bone->setWorldX(worldX);
- }
- float spine_bone_get_world_y(spine_bone bone) {
- if (bone == nullptr) return 0;
- Bone *_bone = (Bone *) bone;
- return _bone->getWorldY();
- }
- void spine_bone_set_world_y(spine_bone bone, float worldY) {
- if (bone == nullptr) return;
- Bone *_bone = (Bone *) bone;
- _bone->setWorldY(worldY);
- }
- float spine_bone_get_world_rotation_x(spine_bone bone) {
- if (bone == nullptr) return 0;
- Bone *_bone = (Bone *) bone;
- return _bone->getWorldRotationX();
- }
- float spine_bone_get_world_rotation_y(spine_bone bone) {
- if (bone == nullptr) return 0;
- Bone *_bone = (Bone *) bone;
- return _bone->getWorldToLocalRotationY();
- }
- float spine_bone_get_world_scale_x(spine_bone bone) {
- if (bone == nullptr) return 0;
- Bone *_bone = (Bone *) bone;
- return _bone->getWorldScaleX();
- }
- float spine_bone_get_world_scale_y(spine_bone bone) {
- if (bone == nullptr) return 0;
- Bone *_bone = (Bone *) bone;
- return _bone->getWorldScaleY();
- }
- spine_bool spine_bone_get_is_active(spine_bone bone) {
- if (bone == nullptr) return 0;
- Bone *_bone = (Bone *) bone;
- return _bone->isActive() ? -1 : 0;
- }
- void spine_bone_set_is_active(spine_bone bone, spine_bool isActive) {
- if (bone == nullptr) return;
- Bone *_bone = (Bone *) bone;
- _bone->setActive(isActive);
- }
- spine_inherit spine_bone_get_inherit(spine_bone bone) {
- if (bone == nullptr) return SPINE_INHERIT_NORMAL;
- Bone *_bone = (Bone *) bone;
- return (spine_inherit) _bone->getInherit();
- }
- void spine_bone_set_inherit(spine_bone bone, spine_inherit inherit) {
- if (bone == nullptr) return;
- Bone *_bone = (Bone *) bone;
- _bone->setInherit((spine::Inherit) inherit);
- }
- // Attachment
- const utf8 *spine_attachment_get_name(spine_attachment attachment) {
- if (attachment == nullptr) return nullptr;
- Attachment *_attachment = (Attachment *) attachment;
- return (utf8 *) _attachment->getName().buffer();
- }
- spine_attachment_type spine_attachment_get_type(spine_attachment attachment) {
- if (attachment == nullptr) return SPINE_ATTACHMENT_REGION;
- Attachment *_attachment = (Attachment *) attachment;
- if (_attachment->getRTTI().isExactly(RegionAttachment::rtti)) {
- return SPINE_ATTACHMENT_REGION;
- } else if (_attachment->getRTTI().isExactly(MeshAttachment::rtti)) {
- return SPINE_ATTACHMENT_MESH;
- } else if (_attachment->getRTTI().isExactly(ClippingAttachment::rtti)) {
- return SPINE_ATTACHMENT_CLIPPING;
- } else if (_attachment->getRTTI().isExactly(BoundingBoxAttachment::rtti)) {
- return SPINE_ATTACHMENT_BOUNDING_BOX;
- } else if (_attachment->getRTTI().isExactly(PathAttachment::rtti)) {
- return SPINE_ATTACHMENT_PATH;
- } else if (_attachment->getRTTI().isExactly(PointAttachment::rtti)) {
- return SPINE_ATTACHMENT_POINT;
- } else {
- return SPINE_ATTACHMENT_REGION;
- }
- }
- spine_attachment spine_attachment_copy(spine_attachment attachment) {
- if (attachment == nullptr) return nullptr;
- Attachment *_attachment = (Attachment *) attachment;
- return (spine_attachment) _attachment->copy();
- }
- void spine_attachment_dispose(spine_attachment attachment) {
- if (attachment == nullptr) return;
- Attachment *_attachment = (Attachment *) attachment;
- delete _attachment;
- }
- // PointAttachment
- spine_vector spine_point_attachment_compute_world_position(spine_point_attachment attachment, spine_bone bone) {
- _spine_vector *result = &tmp_vector;
- if (attachment == nullptr) return (spine_vector) result;
- PointAttachment *_attachment = (PointAttachment *) attachment;
- _attachment->computeWorldPosition(*(Bone *) bone, result->x, result->y);
- return (spine_vector) result;
- }
- float spine_point_attachment_compute_world_rotation(spine_point_attachment attachment, spine_bone bone) {
- if (attachment == nullptr) return 0;
- PointAttachment *_attachment = (PointAttachment *) attachment;
- return _attachment->computeWorldRotation(*(Bone *) bone);
- }
- float spine_point_attachment_get_x(spine_point_attachment attachment) {
- if (attachment == nullptr) return 0;
- PointAttachment *_attachment = (PointAttachment *) attachment;
- return _attachment->getX();
- }
- void spine_point_attachment_set_x(spine_point_attachment attachment, float x) {
- if (attachment == nullptr) return;
- PointAttachment *_attachment = (PointAttachment *) attachment;
- _attachment->setX(x);
- }
- float spine_point_attachment_get_y(spine_point_attachment attachment) {
- if (attachment == nullptr) return 0;
- PointAttachment *_attachment = (PointAttachment *) attachment;
- return _attachment->getY();
- }
- void spine_point_attachment_set_y(spine_point_attachment attachment, float y) {
- if (attachment == nullptr) return;
- PointAttachment *_attachment = (PointAttachment *) attachment;
- _attachment->setY(y);
- }
- float spine_point_attachment_get_rotation(spine_point_attachment attachment) {
- if (attachment == nullptr) return 0;
- PointAttachment *_attachment = (PointAttachment *) attachment;
- return _attachment->getRotation();
- }
- void spine_point_attachment_set_rotation(spine_point_attachment attachment, float rotation) {
- if (attachment == nullptr) return;
- PointAttachment *_attachment = (PointAttachment *) attachment;
- _attachment->setRotation(rotation);
- }
- spine_color spine_point_attachment_get_color(spine_point_attachment attachment) {
- if (attachment == nullptr) return (spine_color) &NULL_COLOR;
- PointAttachment *_attachment = (PointAttachment *) attachment;
- return (spine_color) &_attachment->getColor();
- }
- void spine_point_attachment_set_color(spine_point_attachment attachment, float r, float g, float b, float a) {
- if (attachment == nullptr) return;
- PointAttachment *_attachment = (PointAttachment *) attachment;
- _attachment->getColor().set(r, g, b, a);
- }
- // RegionAttachment
- void spine_region_attachment_update_region(spine_region_attachment attachment) {
- if (attachment == nullptr) return;
- RegionAttachment *_attachment = (RegionAttachment *) attachment;
- _attachment->updateRegion();
- }
- void spine_region_attachment_compute_world_vertices(spine_region_attachment attachment, spine_slot slot, float *worldVertices) {
- if (attachment == nullptr) return;
- RegionAttachment *_attachment = (RegionAttachment *) attachment;
- _attachment->computeWorldVertices(*(Slot *) slot, worldVertices, 0);
- }
- float spine_region_attachment_get_x(spine_region_attachment attachment) {
- if (attachment == nullptr) return 0;
- RegionAttachment *_attachment = (RegionAttachment *) attachment;
- return _attachment->getX();
- }
- void spine_region_attachment_set_x(spine_region_attachment attachment, float x) {
- if (attachment == nullptr) return;
- RegionAttachment *_attachment = (RegionAttachment *) attachment;
- _attachment->setX(x);
- }
- float spine_region_attachment_get_y(spine_region_attachment attachment) {
- if (attachment == nullptr) return 0;
- RegionAttachment *_attachment = (RegionAttachment *) attachment;
- return _attachment->getY();
- }
- void spine_region_attachment_set_y(spine_region_attachment attachment, float y) {
- if (attachment == nullptr) return;
- RegionAttachment *_attachment = (RegionAttachment *) attachment;
- _attachment->setY(y);
- }
- float spine_region_attachment_get_rotation(spine_region_attachment attachment) {
- if (attachment == nullptr) return 0;
- RegionAttachment *_attachment = (RegionAttachment *) attachment;
- return _attachment->getRotation();
- }
- void spine_region_attachment_set_rotation(spine_region_attachment attachment, float rotation) {
- if (attachment == nullptr) return;
- RegionAttachment *_attachment = (RegionAttachment *) attachment;
- _attachment->setRotation(rotation);
- }
- float spine_region_attachment_get_scale_x(spine_region_attachment attachment) {
- if (attachment == nullptr) return 0;
- RegionAttachment *_attachment = (RegionAttachment *) attachment;
- return _attachment->getScaleX();
- }
- void spine_region_attachment_set_scale_x(spine_region_attachment attachment, float scaleX) {
- if (attachment == nullptr) return;
- RegionAttachment *_attachment = (RegionAttachment *) attachment;
- _attachment->setScaleX(scaleX);
- }
- float spine_region_attachment_get_scale_y(spine_region_attachment attachment) {
- if (attachment == nullptr) return 0;
- RegionAttachment *_attachment = (RegionAttachment *) attachment;
- return _attachment->getScaleY();
- }
- void spine_region_attachment_set_scale_y(spine_region_attachment attachment, float scaleY) {
- if (attachment == nullptr) return;
- RegionAttachment *_attachment = (RegionAttachment *) attachment;
- _attachment->setScaleY(scaleY);
- }
- float spine_region_attachment_get_width(spine_region_attachment attachment) {
- if (attachment == nullptr) return 0;
- RegionAttachment *_attachment = (RegionAttachment *) attachment;
- return _attachment->getWidth();
- }
- void spine_region_attachment_set_width(spine_region_attachment attachment, float width) {
- if (attachment == nullptr) return;
- RegionAttachment *_attachment = (RegionAttachment *) attachment;
- _attachment->setWidth(width);
- }
- float spine_region_attachment_get_height(spine_region_attachment attachment) {
- if (attachment == nullptr) return 0;
- RegionAttachment *_attachment = (RegionAttachment *) attachment;
- return _attachment->getHeight();
- }
- void spine_region_attachment_set_height(spine_region_attachment attachment, float height) {
- if (attachment == nullptr) return;
- RegionAttachment *_attachment = (RegionAttachment *) attachment;
- _attachment->setHeight(height);
- }
- spine_color spine_region_attachment_get_color(spine_region_attachment attachment) {
- if (attachment == nullptr) return (spine_color) &NULL_COLOR;
- RegionAttachment *_attachment = (RegionAttachment *) attachment;
- return (spine_color) &_attachment->getColor();
- }
- void spine_region_attachment_set_color(spine_region_attachment attachment, float r, float g, float b, float a) {
- if (attachment == nullptr) return;
- RegionAttachment *_attachment = (RegionAttachment *) attachment;
- _attachment->getColor().set(r, g, b, a);
- }
- const utf8 *spine_region_attachment_get_path(spine_region_attachment attachment) {
- if (attachment == nullptr) return nullptr;
- RegionAttachment *_attachment = (RegionAttachment *) attachment;
- return (utf8 *) _attachment->getPath().buffer();
- }
- spine_texture_region spine_region_attachment_get_region(spine_region_attachment attachment) {
- if (attachment == nullptr) return nullptr;
- RegionAttachment *_attachment = (RegionAttachment *) attachment;
- return (spine_texture_region) _attachment->getRegion();
- }
- spine_sequence spine_region_attachment_get_sequence(spine_region_attachment attachment) {
- if (attachment == nullptr) return nullptr;
- RegionAttachment *_attachment = (RegionAttachment *) attachment;
- return (spine_sequence) _attachment->getSequence();
- }
- int32_t spine_region_attachment_get_num_offset(spine_region_attachment attachment) {
- if (attachment == nullptr) return 0;
- RegionAttachment *_attachment = (RegionAttachment *) attachment;
- return (int32_t) _attachment->getOffset().size();
- }
- float *spine_region_attachment_get_offset(spine_region_attachment attachment) {
- if (attachment == nullptr) return nullptr;
- RegionAttachment *_attachment = (RegionAttachment *) attachment;
- return _attachment->getOffset().buffer();
- }
- int32_t spine_region_attachment_get_num_uvs(spine_region_attachment attachment) {
- if (attachment == nullptr) return 0;
- RegionAttachment *_attachment = (RegionAttachment *) attachment;
- return (int32_t) _attachment->getUVs().size();
- }
- float *spine_region_attachment_get_uvs(spine_region_attachment attachment) {
- if (attachment == nullptr) return nullptr;
- RegionAttachment *_attachment = (RegionAttachment *) attachment;
- return _attachment->getUVs().buffer();
- }
- // VertexAttachment
- int32_t spine_vertex_attachment_get_world_vertices_length(spine_vertex_attachment attachment) {
- if (attachment == nullptr) return 0;
- VertexAttachment *_attachment = (VertexAttachment *) attachment;
- return (int32_t) _attachment->getWorldVerticesLength();
- }
- void spine_vertex_attachment_compute_world_vertices(spine_vertex_attachment attachment, spine_slot slot, float *worldVertices) {
- if (attachment == nullptr) return;
- VertexAttachment *_attachment = (VertexAttachment *) attachment;
- _attachment->computeWorldVertices(*(Slot *) slot, worldVertices);
- }
- int32_t spine_vertex_attachment_get_num_bones(spine_vertex_attachment attachment) {
- if (attachment == nullptr) return 0;
- VertexAttachment *_attachment = (VertexAttachment *) attachment;
- return (int32_t) _attachment->getBones().size();
- }
- int32_t *spine_vertex_attachment_get_bones(spine_vertex_attachment attachment) {
- if (attachment == nullptr) return nullptr;
- VertexAttachment *_attachment = (VertexAttachment *) attachment;
- return _attachment->getBones().buffer();
- }
- // VertexAttachment
- int32_t spine_vertex_attachment_get_num_vertices(spine_vertex_attachment attachment) {
- if (attachment == nullptr) return 0;
- VertexAttachment *_attachment = (VertexAttachment *) attachment;
- return (int32_t) _attachment->getVertices().size();
- }
- float *spine_vertex_attachment_get_vertices(spine_vertex_attachment attachment) {
- if (attachment == nullptr) return nullptr;
- VertexAttachment *_attachment = (VertexAttachment *) attachment;
- return _attachment->getVertices().buffer();
- }
- spine_attachment spine_vertex_attachment_get_timeline_attachment(spine_vertex_attachment attachment) {
- if (attachment == nullptr) return nullptr;
- VertexAttachment *_attachment = (VertexAttachment *) attachment;
- return (spine_attachment) _attachment->getTimelineAttachment();
- }
- void spine_vertex_attachment_set_timeline_attachment(spine_vertex_attachment attachment, spine_attachment timelineAttachment) {
- if (attachment == nullptr) return;
- VertexAttachment *_attachment = (VertexAttachment *) attachment;
- _attachment->setTimelineAttachment((Attachment *) timelineAttachment);
- }
- // MeshAttachment
- void spine_mesh_attachment_update_region(spine_mesh_attachment attachment) {
- if (attachment == nullptr) return;
- MeshAttachment *_attachment = (MeshAttachment *) attachment;
- _attachment->updateRegion();
- }
- int32_t spine_mesh_attachment_get_hull_length(spine_mesh_attachment attachment) {
- if (attachment == nullptr) return 0;
- MeshAttachment *_attachment = (MeshAttachment *) attachment;
- return _attachment->getHullLength();
- }
- void spine_mesh_attachment_set_hull_length(spine_mesh_attachment attachment, int32_t hullLength) {
- if (attachment == nullptr) return;
- MeshAttachment *_attachment = (MeshAttachment *) attachment;
- _attachment->setHullLength(hullLength);
- }
- int32_t spine_mesh_attachment_get_num_region_uvs(spine_mesh_attachment attachment) {
- if (attachment == nullptr) return 0;
- MeshAttachment *_attachment = (MeshAttachment *) attachment;
- return (int32_t) _attachment->getRegionUVs().size();
- }
- float *spine_mesh_attachment_get_region_uvs(spine_mesh_attachment attachment) {
- if (attachment == nullptr) return nullptr;
- MeshAttachment *_attachment = (MeshAttachment *) attachment;
- return _attachment->getRegionUVs().buffer();
- }
- int32_t spine_mesh_attachment_get_num_uvs(spine_mesh_attachment attachment) {
- if (attachment == nullptr) return 0;
- MeshAttachment *_attachment = (MeshAttachment *) attachment;
- return (int32_t) _attachment->getUVs().size();
- }
- float *spine_mesh_attachment_get_uvs(spine_mesh_attachment attachment) {
- if (attachment == nullptr) return 0;
- MeshAttachment *_attachment = (MeshAttachment *) attachment;
- return _attachment->getUVs().buffer();
- }
- int32_t spine_mesh_attachment_get_num_triangles(spine_mesh_attachment attachment) {
- if (attachment == nullptr) return 0;
- MeshAttachment *_attachment = (MeshAttachment *) attachment;
- return (int32_t) _attachment->getTriangles().size();
- }
- uint16_t *spine_mesh_attachment_get_triangles(spine_mesh_attachment attachment) {
- if (attachment == nullptr) return nullptr;
- MeshAttachment *_attachment = (MeshAttachment *) attachment;
- return _attachment->getTriangles().buffer();
- }
- spine_color spine_mesh_attachment_get_color(spine_mesh_attachment attachment) {
- if (attachment == nullptr) return (spine_color) &NULL_COLOR;
- MeshAttachment *_attachment = (MeshAttachment *) attachment;
- return (spine_color) &_attachment->getColor();
- }
- void spine_mesh_attachment_set_color(spine_mesh_attachment attachment, float r, float g, float b, float a) {
- if (attachment == nullptr) return;
- MeshAttachment *_attachment = (MeshAttachment *) attachment;
- _attachment->getColor().set(r, g, b, a);
- }
- const utf8 *spine_mesh_attachment_get_path(spine_mesh_attachment attachment) {
- if (attachment == nullptr) return nullptr;
- MeshAttachment *_attachment = (MeshAttachment *) attachment;
- return (utf8 *) _attachment->getPath().buffer();
- }
- spine_texture_region spine_mesh_attachment_get_region(spine_mesh_attachment attachment) {
- if (attachment == nullptr) return nullptr;
- MeshAttachment *_attachment = (MeshAttachment *) attachment;
- return (spine_texture_region) _attachment->getRegion();
- }
- spine_sequence spine_mesh_attachment_get_sequence(spine_mesh_attachment attachment) {
- if (attachment == nullptr) return nullptr;
- MeshAttachment *_attachment = (MeshAttachment *) attachment;
- return (spine_sequence) _attachment->getSequence();
- }
- spine_mesh_attachment spine_mesh_attachment_get_parent_mesh(spine_mesh_attachment attachment) {
- if (attachment == nullptr) return nullptr;
- MeshAttachment *_attachment = (MeshAttachment *) attachment;
- return (spine_mesh_attachment) _attachment->getParentMesh();
- }
- void spine_mesh_attachment_set_parent_mesh(spine_mesh_attachment attachment, spine_mesh_attachment parentMesh) {
- if (attachment == nullptr) return;
- MeshAttachment *_attachment = (MeshAttachment *) attachment;
- _attachment->setParentMesh((MeshAttachment *) parentMesh);
- }
- int32_t spine_mesh_attachment_get_num_edges(spine_mesh_attachment attachment) {
- if (attachment == nullptr) return 0;
- MeshAttachment *_attachment = (MeshAttachment *) attachment;
- return (int32_t) _attachment->getEdges().size();
- }
- unsigned short *spine_mesh_attachment_get_edges(spine_mesh_attachment attachment) {
- if (attachment == nullptr) return nullptr;
- MeshAttachment *_attachment = (MeshAttachment *) attachment;
- return _attachment->getEdges().buffer();
- }
- float spine_mesh_attachment_get_width(spine_mesh_attachment attachment) {
- if (attachment == nullptr) return 0;
- MeshAttachment *_attachment = (MeshAttachment *) attachment;
- return _attachment->getWidth();
- }
- void spine_mesh_attachment_set_width(spine_mesh_attachment attachment, float width) {
- if (attachment == nullptr) return;
- MeshAttachment *_attachment = (MeshAttachment *) attachment;
- _attachment->setWidth(width);
- }
- float spine_mesh_attachment_get_height(spine_mesh_attachment attachment) {
- if (attachment == nullptr) return 0;
- MeshAttachment *_attachment = (MeshAttachment *) attachment;
- return _attachment->getHeight();
- }
- void spine_mesh_attachment_set_height(spine_mesh_attachment attachment, float height) {
- if (attachment == nullptr) return;
- MeshAttachment *_attachment = (MeshAttachment *) attachment;
- _attachment->setHeight(height);
- }
- // ClippingAttachment
- spine_slot_data spine_clipping_attachment_get_end_slot(spine_clipping_attachment attachment) {
- if (attachment == nullptr) return nullptr;
- ClippingAttachment *_attachment = (ClippingAttachment *) attachment;
- return (spine_slot_data) _attachment->getEndSlot();
- }
- void spine_clipping_attachment_set_end_slot(spine_clipping_attachment attachment, spine_slot_data endSlot) {
- if (attachment == nullptr) return;
- ClippingAttachment *_attachment = (ClippingAttachment *) attachment;
- _attachment->setEndSlot((SlotData *) endSlot);
- }
- spine_color spine_clipping_attachment_get_color(spine_clipping_attachment attachment) {
- if (attachment == nullptr) return (spine_color) &NULL_COLOR;
- ClippingAttachment *_attachment = (ClippingAttachment *) attachment;
- return (spine_color) &_attachment->getColor();
- }
- void spine_clipping_attachment_set_color(spine_clipping_attachment attachment, float r, float g, float b, float a) {
- if (attachment == nullptr) return;
- ClippingAttachment *_attachment = (ClippingAttachment *) attachment;
- _attachment->getColor().set(r, g, b, a);
- }
- // BoundingBoxAttachment
- spine_color spine_bounding_box_attachment_get_color(spine_bounding_box_attachment attachment) {
- if (attachment == nullptr) return (spine_color) &NULL_COLOR;
- BoundingBoxAttachment *_attachment = (BoundingBoxAttachment *) attachment;
- return (spine_color) &_attachment->getColor();
- }
- void spine_bounding_box_attachment_set_color(spine_bounding_box_attachment attachment, float r, float g, float b, float a) {
- if (attachment == nullptr) return;
- BoundingBoxAttachment *_attachment = (BoundingBoxAttachment *) attachment;
- _attachment->getColor().set(r, g, b, a);
- }
- // PathAttachment
- int32_t spine_path_attachment_get_num_lengths(spine_path_attachment attachment) {
- if (attachment == nullptr) return 0;
- PathAttachment *_attachment = (PathAttachment *) attachment;
- return (int32_t) _attachment->getLengths().size();
- }
- float *spine_path_attachment_get_lengths(spine_path_attachment attachment) {
- if (attachment == nullptr) return nullptr;
- PathAttachment *_attachment = (PathAttachment *) attachment;
- return _attachment->getLengths().buffer();
- }
- spine_bool spine_path_attachment_get_is_closed(spine_path_attachment attachment) {
- if (attachment == nullptr) return 0;
- PathAttachment *_attachment = (PathAttachment *) attachment;
- return _attachment->isClosed() ? -1 : 0;
- }
- void spine_path_attachment_set_is_closed(spine_path_attachment attachment, spine_bool isClosed) {
- if (attachment == nullptr) return;
- PathAttachment *_attachment = (PathAttachment *) attachment;
- _attachment->setClosed(isClosed);
- }
- spine_bool spine_path_attachment_get_is_constant_speed(spine_path_attachment attachment) {
- if (attachment == nullptr) return 0;
- PathAttachment *_attachment = (PathAttachment *) attachment;
- return _attachment->isConstantSpeed() ? -1 : 0;
- }
- void spine_path_attachment_set_is_constant_speed(spine_path_attachment attachment, spine_bool isConstantSpeed) {
- if (attachment == nullptr) return;
- PathAttachment *_attachment = (PathAttachment *) attachment;
- _attachment->setConstantSpeed(isConstantSpeed);
- }
- spine_color spine_path_attachment_get_color(spine_path_attachment attachment) {
- if (attachment == nullptr) return (spine_color) &NULL_COLOR;
- PathAttachment *_attachment = (PathAttachment *) attachment;
- return (spine_color) &_attachment->getColor();
- }
- void spine_path_attachment_set_color(spine_path_attachment attachment, float r, float g, float b, float a) {
- if (attachment == nullptr) return;
- PathAttachment *_attachment = (PathAttachment *) attachment;
- _attachment->getColor().set(r, g, b, a);
- }
- // Skin
- void spine_skin_set_attachment(spine_skin skin, int32_t slotIndex, const utf8 *name, spine_attachment attachment) {
- if (skin == nullptr) return;
- Skin *_skin = (Skin *) skin;
- _skin->setAttachment(slotIndex, name, (Attachment *) attachment);
- }
- spine_attachment spine_skin_get_attachment(spine_skin skin, int32_t slotIndex, const utf8 *name) {
- if (skin == nullptr) return nullptr;
- Skin *_skin = (Skin *) skin;
- return (spine_attachment) _skin->getAttachment(slotIndex, name);
- }
- void spine_skin_remove_attachment(spine_skin skin, int32_t slotIndex, const utf8 *name) {
- if (skin == nullptr) return;
- Skin *_skin = (Skin *) skin;
- _skin->removeAttachment(slotIndex, name);
- }
- const utf8 *spine_skin_get_name(spine_skin skin) {
- if (skin == nullptr) return nullptr;
- Skin *_skin = (Skin *) skin;
- return (utf8 *) _skin->getName().buffer();
- }
- void spine_skin_add_skin(spine_skin skin, spine_skin other) {
- if (skin == nullptr) return;
- if (other == nullptr) return;
- Skin *_skin = (Skin *) skin;
- _skin->addSkin((Skin *) other);
- }
- void spine_skin_copy_skin(spine_skin skin, spine_skin other) {
- if (skin == nullptr) return;
- if (other == nullptr) return;
- Skin *_skin = (Skin *) skin;
- _skin->copySkin((Skin *) other);
- }
- spine_skin_entries spine_skin_get_entries(spine_skin skin) {
- if (skin == nullptr) return nullptr;
- Skin *_skin = (Skin *) skin;
- _spine_skin_entries *entries = SpineExtension::getInstance()->calloc<_spine_skin_entries>(1, __FILE__, __LINE__);
- {
- Skin::AttachmentMap::Entries mapEntries = _skin->getAttachments();
- while (mapEntries.hasNext()) entries->numEntries++;
- }
- {
- entries->entries = SpineExtension::getInstance()->calloc<_spine_skin_entry>(entries->numEntries, __FILE__, __LINE__);
- Skin::AttachmentMap::Entries mapEntries = _skin->getAttachments();
- int32_t i = 0;
- while (mapEntries.hasNext()) {
- Skin::AttachmentMap::Entry entry = mapEntries.next();
- entries->entries[i++] = {(int32_t) entry._slotIndex, (utf8 *) entry._name.buffer(), (spine_attachment) entry._attachment};
- }
- }
- return (spine_skin_entries) entries;
- }
- int32_t spine_skin_entries_get_num_entries(spine_skin_entries entries) {
- if (!entries) return 0;
- return ((_spine_skin_entries *) entries)->numEntries;
- }
- spine_skin_entry spine_skin_entries_get_entry(spine_skin_entries entries, int32_t index) {
- if (!entries) return 0;
- return (spine_skin_entry) & ((_spine_skin_entries *) entries)->entries[index];
- }
- void spine_skin_entries_dispose(spine_skin_entries entries) {
- if (entries == nullptr) return;
- SpineExtension::getInstance()->free(((_spine_skin_entries *) entries)->entries, __FILE__, __LINE__);
- SpineExtension::getInstance()->free(entries, __FILE__, __LINE__);
- }
- int32_t spine_skin_entry_get_slot_index(spine_skin_entry entry) {
- if (!entry) return 0;
- return ((_spine_skin_entry *) entry)->slotIndex;
- }
- utf8 *spine_skin_entry_get_name(spine_skin_entry entry) {
- if (!entry) return nullptr;
- return ((_spine_skin_entry *) entry)->name;
- }
- spine_attachment spine_skin_entry_get_attachment(spine_skin_entry entry) {
- if (!entry) return nullptr;
- return ((_spine_skin_entry *) entry)->attachment;
- }
- int32_t spine_skin_get_num_bones(spine_skin skin) {
- if (skin == nullptr) return 0;
- Skin *_skin = (Skin *) skin;
- return (int32_t) _skin->getBones().size();
- }
- spine_bone_data *spine_skin_get_bones(spine_skin skin) {
- if (skin == nullptr) return nullptr;
- Skin *_skin = (Skin *) skin;
- return (spine_bone_data *) _skin->getBones().buffer();
- }
- int32_t spine_skin_get_num_constraints(spine_skin skin) {
- if (skin == nullptr) return 0;
- Skin *_skin = (Skin *) skin;
- return (int32_t) _skin->getConstraints().size();
- }
- spine_constraint_data *spine_skin_get_constraints(spine_skin skin) {
- if (skin == nullptr) return nullptr;
- Skin *_skin = (Skin *) skin;
- return (spine_constraint_data *) _skin->getConstraints().buffer();
- }
- spine_skin spine_skin_create(const utf8 *name) {
- if (name == nullptr) return nullptr;
- return (spine_skin) new (__FILE__, __LINE__) Skin(name);
- }
- void spine_skin_dispose(spine_skin skin) {
- if (skin == nullptr) return;
- Skin *_skin = (Skin *) skin;
- delete _skin;
- }
- // ConstraintData
- spine_constraint_type spine_constraint_data_get_type(spine_constraint_data data) {
- if (data == nullptr) return SPINE_CONSTRAINT_IK;
- ConstraintData *_data = (ConstraintData *) data;
- if (_data->getRTTI().isExactly(IkConstraintData::rtti)) {
- return SPINE_CONSTRAINT_IK;
- } else if (_data->getRTTI().isExactly(TransformConstraintData::rtti)) {
- return SPINE_CONSTRAINT_TRANSFORM;
- } else if (_data->getRTTI().isExactly(PathConstraintData::rtti)) {
- return SPINE_CONSTRAINT_PATH;
- } else {
- return SPINE_CONSTRAINT_IK;
- }
- }
- const utf8 *spine_constraint_data_get_name(spine_constraint_data data) {
- if (data == nullptr) return nullptr;
- ConstraintData *_data = (ConstraintData *) data;
- return (utf8 *) _data->getName().buffer();
- }
- uint64_t spine_constraint_data_get_order(spine_constraint_data data) {
- if (data == nullptr) return 0;
- ConstraintData *_data = (ConstraintData *) data;
- return (uint64_t) _data->getOrder();
- }
- void spine_constraint_data_set_order(spine_constraint_data data, uint64_t order) {
- if (data == nullptr) return;
- ConstraintData *_data = (ConstraintData *) data;
- _data->setOrder((size_t) order);
- }
- spine_bool spine_constraint_data_get_is_skin_required(spine_constraint_data data) {
- if (data == nullptr) return 0;
- ConstraintData *_data = (ConstraintData *) data;
- return _data->isSkinRequired() ? -1 : 0;
- }
- void spine_constraint_data_set_is_skin_required(spine_constraint_data data, spine_bool isSkinRequired) {
- if (data == nullptr) return;
- ConstraintData *_data = (ConstraintData *) data;
- _data->setSkinRequired(isSkinRequired);
- }
- // IkConstraintData
- int32_t spine_ik_constraint_data_get_num_bones(spine_ik_constraint_data data) {
- if (data == nullptr) return 0;
- IkConstraintData *_data = (IkConstraintData *) data;
- return (int32_t) _data->getBones().size();
- }
- spine_bone_data *spine_ik_constraint_data_get_bones(spine_ik_constraint_data data) {
- if (data == nullptr) return nullptr;
- IkConstraintData *_data = (IkConstraintData *) data;
- return (spine_bone_data *) _data->getBones().buffer();
- }
- spine_bone_data spine_ik_constraint_data_get_target(spine_ik_constraint_data data) {
- if (data == nullptr) return nullptr;
- IkConstraintData *_data = (IkConstraintData *) data;
- return (spine_bone_data) _data->getTarget();
- }
- void spine_ik_constraint_data_set_target(spine_ik_constraint_data data, spine_bone_data target) {
- if (data == nullptr) return;
- IkConstraintData *_data = (IkConstraintData *) data;
- _data->setTarget((BoneData *) target);
- }
- int32_t spine_ik_constraint_data_get_bend_direction(spine_ik_constraint_data data) {
- if (data == nullptr) return 1;
- IkConstraintData *_data = (IkConstraintData *) data;
- return _data->getBendDirection();
- }
- void spine_ik_constraint_data_set_bend_direction(spine_ik_constraint_data data, int32_t bendDirection) {
- if (data == nullptr) return;
- IkConstraintData *_data = (IkConstraintData *) data;
- _data->setBendDirection(bendDirection);
- }
- spine_bool spine_ik_constraint_data_get_compress(spine_ik_constraint_data data) {
- if (data == nullptr) return 0;
- IkConstraintData *_data = (IkConstraintData *) data;
- return _data->getCompress() ? -1 : 0;
- }
- void spine_ik_constraint_data_set_compress(spine_ik_constraint_data data, spine_bool compress) {
- if (data == nullptr) return;
- IkConstraintData *_data = (IkConstraintData *) data;
- _data->setCompress(compress);
- }
- spine_bool spine_ik_constraint_data_get_stretch(spine_ik_constraint_data data) {
- if (data == nullptr) return 0;
- IkConstraintData *_data = (IkConstraintData *) data;
- return _data->getStretch() ? -1 : 0;
- }
- void spine_ik_constraint_data_set_stretch(spine_ik_constraint_data data, spine_bool stretch) {
- if (data == nullptr) return;
- IkConstraintData *_data = (IkConstraintData *) data;
- _data->setStretch(stretch);
- }
- spine_bool spine_ik_constraint_data_get_uniform(spine_ik_constraint_data data) {
- if (data == nullptr) return 0;
- IkConstraintData *_data = (IkConstraintData *) data;
- return _data->getUniform() ? -1 : 0;
- }
- void spine_ik_constraint_data_set_uniform(spine_ik_constraint_data data, spine_bool uniform) {
- if (data == nullptr) return;
- IkConstraintData *_data = (IkConstraintData *) data;
- _data->setUniform(uniform);
- }
- float spine_ik_constraint_data_get_mix(spine_ik_constraint_data data) {
- if (data == nullptr) return 0;
- IkConstraintData *_data = (IkConstraintData *) data;
- return _data->getMix();
- }
- void spine_ik_constraint_data_set_mix(spine_ik_constraint_data data, float mix) {
- if (data == nullptr) return;
- IkConstraintData *_data = (IkConstraintData *) data;
- _data->setMix(mix);
- }
- float spine_ik_constraint_data_get_softness(spine_ik_constraint_data data) {
- if (data == nullptr) return 0;
- IkConstraintData *_data = (IkConstraintData *) data;
- return _data->getSoftness();
- }
- void spine_ik_constraint_data_set_softness(spine_ik_constraint_data data, float softness) {
- if (data == nullptr) return;
- IkConstraintData *_data = (IkConstraintData *) data;
- _data->setSoftness(softness);
- }
- // IKConstraint
- void spine_ik_constraint_update(spine_ik_constraint constraint) {
- if (constraint == nullptr) return;
- IkConstraint *_constraint = (IkConstraint *) constraint;
- _constraint->update(spine::Physics_Update);
- }
- int32_t spine_ik_constraint_get_order(spine_ik_constraint constraint) {
- if (constraint == nullptr) return 0;
- IkConstraint *_constraint = (IkConstraint *) constraint;
- return _constraint->getOrder();
- }
- spine_ik_constraint_data spine_ik_constraint_get_data(spine_ik_constraint constraint) {
- if (constraint == nullptr) return nullptr;
- IkConstraint *_constraint = (IkConstraint *) constraint;
- return (spine_ik_constraint_data) &_constraint->getData();
- }
- int32_t spine_ik_constraint_get_num_bones(spine_ik_constraint constraint) {
- if (constraint == nullptr) return 0;
- IkConstraint *_constraint = (IkConstraint *) constraint;
- return (int32_t) _constraint->getBones().size();
- }
- spine_bone *spine_ik_constraint_get_bones(spine_ik_constraint constraint) {
- if (constraint == nullptr) return nullptr;
- IkConstraint *_constraint = (IkConstraint *) constraint;
- return (spine_bone *) _constraint->getBones().buffer();
- }
- spine_bone spine_ik_constraint_get_target(spine_ik_constraint constraint) {
- if (constraint == nullptr) return nullptr;
- IkConstraint *_constraint = (IkConstraint *) constraint;
- return (spine_bone) _constraint->getTarget();
- }
- void spine_ik_constraint_set_target(spine_ik_constraint constraint, spine_bone target) {
- if (constraint == nullptr) return;
- IkConstraint *_constraint = (IkConstraint *) constraint;
- _constraint->setTarget((Bone *) target);
- }
- int32_t spine_ik_constraint_get_bend_direction(spine_ik_constraint constraint) {
- if (constraint == nullptr) return 1;
- IkConstraint *_constraint = (IkConstraint *) constraint;
- return _constraint->getBendDirection();
- }
- void spine_ik_constraint_set_bend_direction(spine_ik_constraint constraint, int32_t bendDirection) {
- if (constraint == nullptr) return;
- IkConstraint *_constraint = (IkConstraint *) constraint;
- _constraint->setBendDirection(bendDirection);
- }
- spine_bool spine_ik_constraint_get_compress(spine_ik_constraint constraint) {
- if (constraint == nullptr) return 0;
- IkConstraint *_constraint = (IkConstraint *) constraint;
- return _constraint->getCompress() ? -1 : 0;
- }
- void spine_ik_constraint_set_compress(spine_ik_constraint constraint, spine_bool compress) {
- if (constraint == nullptr) return;
- IkConstraint *_constraint = (IkConstraint *) constraint;
- _constraint->setCompress(compress);
- }
- spine_bool spine_ik_constraint_get_stretch(spine_ik_constraint constraint) {
- if (constraint == nullptr) return 0;
- IkConstraint *_constraint = (IkConstraint *) constraint;
- return _constraint->getStretch() ? -1 : 0;
- }
- void spine_ik_constraint_set_stretch(spine_ik_constraint constraint, spine_bool stretch) {
- if (constraint == nullptr) return;
- IkConstraint *_constraint = (IkConstraint *) constraint;
- _constraint->setStretch(stretch);
- }
- float spine_ik_constraint_get_mix(spine_ik_constraint constraint) {
- if (constraint == nullptr) return 0;
- IkConstraint *_constraint = (IkConstraint *) constraint;
- return _constraint->getMix();
- }
- void spine_ik_constraint_set_mix(spine_ik_constraint constraint, float mix) {
- if (constraint == nullptr) return;
- IkConstraint *_constraint = (IkConstraint *) constraint;
- _constraint->setMix(mix);
- }
- float spine_ik_constraint_get_softness(spine_ik_constraint constraint) {
- if (constraint == nullptr) return 0;
- IkConstraint *_constraint = (IkConstraint *) constraint;
- return _constraint->getSoftness();
- }
- void spine_ik_constraint_set_softness(spine_ik_constraint constraint, float softness) {
- if (constraint == nullptr) return;
- IkConstraint *_constraint = (IkConstraint *) constraint;
- _constraint->setSoftness(softness);
- }
- spine_bool spine_ik_constraint_get_is_active(spine_ik_constraint constraint) {
- if (constraint == nullptr) return 0;
- IkConstraint *_constraint = (IkConstraint *) constraint;
- return _constraint->isActive() ? -1 : 0;
- }
- void spine_ik_constraint_set_is_active(spine_ik_constraint constraint, spine_bool isActive) {
- if (constraint == nullptr) return;
- IkConstraint *_constraint = (IkConstraint *) constraint;
- _constraint->setActive(isActive);
- }
- // TransformConstraintData
- int32_t spine_transform_constraint_data_get_num_bones(spine_transform_constraint_data data) {
- if (data == nullptr) return 0;
- TransformConstraintData *_data = (TransformConstraintData *) data;
- return (int32_t) _data->getBones().size();
- }
- spine_bone_data *spine_transform_constraint_data_get_bones(spine_transform_constraint_data data) {
- if (data == nullptr) return nullptr;
- TransformConstraintData *_data = (TransformConstraintData *) data;
- return (spine_bone_data *) _data->getBones().buffer();
- }
- spine_bone_data spine_transform_constraint_data_get_target(spine_transform_constraint_data data) {
- if (data == nullptr) return nullptr;
- TransformConstraintData *_data = (TransformConstraintData *) data;
- return (spine_bone_data) _data->getTarget();
- }
- void spine_transform_constraint_data_set_target(spine_transform_constraint_data data, spine_bone_data target) {
- if (data == nullptr) return;
- TransformConstraintData *_data = (TransformConstraintData *) data;
- _data->setTarget((BoneData *) target);
- }
- float spine_transform_constraint_data_get_mix_rotate(spine_transform_constraint_data data) {
- if (data == nullptr) return 0;
- TransformConstraintData *_data = (TransformConstraintData *) data;
- return _data->getMixRotate();
- }
- void spine_transform_constraint_data_set_mix_rotate(spine_transform_constraint_data data, float mixRotate) {
- if (data == nullptr) return;
- TransformConstraintData *_data = (TransformConstraintData *) data;
- _data->setMixRotate(mixRotate);
- }
- float spine_transform_constraint_data_get_mix_x(spine_transform_constraint_data data) {
- if (data == nullptr) return 0;
- TransformConstraintData *_data = (TransformConstraintData *) data;
- return _data->getMixX();
- }
- void spine_transform_constraint_data_set_mix_x(spine_transform_constraint_data data, float mixX) {
- if (data == nullptr) return;
- TransformConstraintData *_data = (TransformConstraintData *) data;
- _data->setMixX(mixX);
- }
- float spine_transform_constraint_data_get_mix_y(spine_transform_constraint_data data) {
- if (data == nullptr) return 0;
- TransformConstraintData *_data = (TransformConstraintData *) data;
- return _data->getMixY();
- }
- void spine_transform_constraint_data_set_mix_y(spine_transform_constraint_data data, float mixY) {
- if (data == nullptr) return;
- TransformConstraintData *_data = (TransformConstraintData *) data;
- _data->setMixY(mixY);
- }
- float spine_transform_constraint_data_get_mix_scale_x(spine_transform_constraint_data data) {
- if (data == nullptr) return 0;
- TransformConstraintData *_data = (TransformConstraintData *) data;
- return _data->getMixScaleX();
- }
- void spine_transform_constraint_data_set_mix_scale_x(spine_transform_constraint_data data, float mixScaleX) {
- if (data == nullptr) return;
- TransformConstraintData *_data = (TransformConstraintData *) data;
- _data->setMixScaleX(mixScaleX);
- }
- float spine_transform_constraint_data_get_mix_scale_y(spine_transform_constraint_data data) {
- if (data == nullptr) return 0;
- TransformConstraintData *_data = (TransformConstraintData *) data;
- return _data->getMixScaleY();
- }
- void spine_transform_constraint_data_set_mix_scale_y(spine_transform_constraint_data data, float mixScaleY) {
- if (data == nullptr) return;
- TransformConstraintData *_data = (TransformConstraintData *) data;
- _data->setMixScaleY(mixScaleY);
- }
- float spine_transform_constraint_data_get_mix_shear_y(spine_transform_constraint_data data) {
- if (data == nullptr) return 0;
- TransformConstraintData *_data = (TransformConstraintData *) data;
- return _data->getMixShearY();
- }
- void spine_transform_constraint_data_set_mix_shear_y(spine_transform_constraint_data data, float mixShearY) {
- if (data == nullptr) return;
- TransformConstraintData *_data = (TransformConstraintData *) data;
- _data->setMixShearY(mixShearY);
- }
- float spine_transform_constraint_data_get_offset_rotation(spine_transform_constraint_data data) {
- if (data == nullptr) return 0;
- TransformConstraintData *_data = (TransformConstraintData *) data;
- return _data->getOffsetRotation();
- }
- void spine_transform_constraint_data_set_offset_rotation(spine_transform_constraint_data data, float offsetRotation) {
- if (data == nullptr) return;
- TransformConstraintData *_data = (TransformConstraintData *) data;
- _data->setOffsetRotation(offsetRotation);
- }
- float spine_transform_constraint_data_get_offset_x(spine_transform_constraint_data data) {
- if (data == nullptr) return 0;
- TransformConstraintData *_data = (TransformConstraintData *) data;
- return _data->getOffsetX();
- }
- void spine_transform_constraint_data_set_offset_x(spine_transform_constraint_data data, float offsetX) {
- if (data == nullptr) return;
- TransformConstraintData *_data = (TransformConstraintData *) data;
- _data->setOffsetX(offsetX);
- }
- float spine_transform_constraint_data_get_offset_y(spine_transform_constraint_data data) {
- if (data == nullptr) return 0;
- TransformConstraintData *_data = (TransformConstraintData *) data;
- return _data->getOffsetY();
- }
- void spine_transform_constraint_data_set_offset_y(spine_transform_constraint_data data, float offsetY) {
- if (data == nullptr) return;
- TransformConstraintData *_data = (TransformConstraintData *) data;
- _data->setOffsetY(offsetY);
- }
- float spine_transform_constraint_data_get_offset_scale_x(spine_transform_constraint_data data) {
- if (data == nullptr) return 0;
- TransformConstraintData *_data = (TransformConstraintData *) data;
- return _data->getOffsetScaleX();
- }
- void spine_transform_constraint_data_set_offset_scale_x(spine_transform_constraint_data data, float offsetScaleX) {
- if (data == nullptr) return;
- TransformConstraintData *_data = (TransformConstraintData *) data;
- _data->setOffsetScaleX(offsetScaleX);
- }
- float spine_transform_constraint_data_get_offset_scale_y(spine_transform_constraint_data data) {
- if (data == nullptr) return 0;
- TransformConstraintData *_data = (TransformConstraintData *) data;
- return _data->getOffsetScaleY();
- }
- void spine_transform_constraint_data_set_offset_scale_y(spine_transform_constraint_data data, float offsetScaleY) {
- if (data == nullptr) return;
- TransformConstraintData *_data = (TransformConstraintData *) data;
- _data->setOffsetScaleY(offsetScaleY);
- }
- float spine_transform_constraint_data_get_offset_shear_y(spine_transform_constraint_data data) {
- if (data == nullptr) return 0;
- TransformConstraintData *_data = (TransformConstraintData *) data;
- return _data->getOffsetShearY();
- }
- void spine_transform_constraint_data_set_offset_shear_y(spine_transform_constraint_data data, float offsetShearY) {
- if (data == nullptr) return;
- TransformConstraintData *_data = (TransformConstraintData *) data;
- _data->setOffsetShearY(offsetShearY);
- }
- spine_bool spine_transform_constraint_data_get_is_relative(spine_transform_constraint_data data) {
- if (data == nullptr) return 0;
- TransformConstraintData *_data = (TransformConstraintData *) data;
- return _data->isRelative() ? -1 : 0;
- }
- void spine_transform_constraint_data_set_is_relative(spine_transform_constraint_data data, spine_bool isRelative) {
- if (data == nullptr) return;
- TransformConstraintData *_data = (TransformConstraintData *) data;
- _data->setRelative(isRelative);
- }
- spine_bool spine_transform_constraint_data_get_is_local(spine_transform_constraint_data data) {
- if (data == nullptr) return 0;
- TransformConstraintData *_data = (TransformConstraintData *) data;
- return _data->isLocal() ? -1 : 0;
- }
- void spine_transform_constraint_data_set_is_local(spine_transform_constraint_data data, spine_bool isLocal) {
- if (data == nullptr) return;
- TransformConstraintData *_data = (TransformConstraintData *) data;
- _data->setLocal(isLocal);
- }
- // TransformConstraint
- void spine_transform_constraint_update(spine_transform_constraint constraint) {
- if (constraint == nullptr) return;
- TransformConstraint *_constraint = (TransformConstraint *) constraint;
- _constraint->update(spine::Physics_Update);
- }
- int32_t spine_transform_constraint_get_order(spine_transform_constraint constraint) {
- if (constraint == nullptr) return 0;
- TransformConstraint *_constraint = (TransformConstraint *) constraint;
- return _constraint->getOrder();
- }
- spine_transform_constraint_data spine_transform_constraint_get_data(spine_transform_constraint constraint) {
- if (constraint == nullptr) return nullptr;
- TransformConstraint *_constraint = (TransformConstraint *) constraint;
- return (spine_transform_constraint_data) &_constraint->getData();
- }
- int32_t spine_transform_constraint_get_num_bones(spine_transform_constraint constraint) {
- if (constraint == nullptr) return 0;
- TransformConstraint *_constraint = (TransformConstraint *) constraint;
- return (int32_t) _constraint->getBones().size();
- }
- spine_bone *spine_transform_constraint_get_bones(spine_transform_constraint constraint) {
- if (constraint == nullptr) return nullptr;
- TransformConstraint *_constraint = (TransformConstraint *) constraint;
- return (spine_bone *) _constraint->getBones().buffer();
- }
- spine_bone spine_transform_constraint_get_target(spine_transform_constraint constraint) {
- if (constraint == nullptr) return nullptr;
- TransformConstraint *_constraint = (TransformConstraint *) constraint;
- return (spine_bone) _constraint->getTarget();
- }
- void spine_transform_constraint_set_target(spine_transform_constraint constraint, spine_bone target) {
- if (constraint == nullptr) return;
- TransformConstraint *_constraint = (TransformConstraint *) constraint;
- _constraint->setTarget((Bone *) target);
- }
- float spine_transform_constraint_get_mix_rotate(spine_transform_constraint constraint) {
- if (constraint == nullptr) return 0;
- TransformConstraint *_constraint = (TransformConstraint *) constraint;
- return _constraint->getMixRotate();
- }
- void spine_transform_constraint_set_mix_rotate(spine_transform_constraint constraint, float mixRotate) {
- if (constraint == nullptr) return;
- TransformConstraint *_constraint = (TransformConstraint *) constraint;
- _constraint->setMixRotate(mixRotate);
- }
- float spine_transform_constraint_get_mix_x(spine_transform_constraint constraint) {
- if (constraint == nullptr) return 0;
- TransformConstraint *_constraint = (TransformConstraint *) constraint;
- return _constraint->getMixX();
- }
- void spine_transform_constraint_set_mix_x(spine_transform_constraint constraint, float mixX) {
- if (constraint == nullptr) return;
- TransformConstraint *_constraint = (TransformConstraint *) constraint;
- _constraint->setMixX(mixX);
- }
- float spine_transform_constraint_get_mix_y(spine_transform_constraint constraint) {
- if (constraint == nullptr) return 0;
- TransformConstraint *_constraint = (TransformConstraint *) constraint;
- return _constraint->getMixY();
- }
- void spine_transform_constraint_set_mix_y(spine_transform_constraint constraint, float mixY) {
- if (constraint == nullptr) return;
- TransformConstraint *_constraint = (TransformConstraint *) constraint;
- _constraint->setMixY(mixY);
- }
- float spine_transform_constraint_get_mix_scale_x(spine_transform_constraint constraint) {
- if (constraint == nullptr) return 0;
- TransformConstraint *_constraint = (TransformConstraint *) constraint;
- return _constraint->getMixScaleX();
- }
- void spine_transform_constraint_set_mix_scale_x(spine_transform_constraint constraint, float mixScaleX) {
- if (constraint == nullptr) return;
- TransformConstraint *_constraint = (TransformConstraint *) constraint;
- _constraint->setMixScaleX(mixScaleX);
- }
- float spine_transform_constraint_get_mix_scale_y(spine_transform_constraint constraint) {
- if (constraint == nullptr) return 0;
- TransformConstraint *_constraint = (TransformConstraint *) constraint;
- return _constraint->getMixScaleY();
- }
- void spine_transform_constraint_set_mix_scale_y(spine_transform_constraint constraint, float mixScaleY) {
- if (constraint == nullptr) return;
- TransformConstraint *_constraint = (TransformConstraint *) constraint;
- _constraint->setMixScaleY(mixScaleY);
- }
- float spine_transform_constraint_get_mix_shear_y(spine_transform_constraint constraint) {
- if (constraint == nullptr) return 0;
- TransformConstraint *_constraint = (TransformConstraint *) constraint;
- return _constraint->getMixShearY();
- }
- void spine_transform_constraint_set_mix_shear_y(spine_transform_constraint constraint, float mixShearY) {
- if (constraint == nullptr) return;
- TransformConstraint *_constraint = (TransformConstraint *) constraint;
- _constraint->setMixShearY(mixShearY);
- }
- spine_bool spine_transform_constraint_get_is_active(spine_transform_constraint constraint) {
- if (constraint == nullptr) return 0;
- TransformConstraint *_constraint = (TransformConstraint *) constraint;
- return _constraint->isActive() ? -1 : 0;
- }
- void spine_transform_constraint_set_is_active(spine_transform_constraint constraint, spine_bool isActive) {
- if (constraint == nullptr) return;
- TransformConstraint *_constraint = (TransformConstraint *) constraint;
- _constraint->setActive(isActive);
- }
- // PathConstraintData
- int32_t spine_path_constraint_data_get_num_bones(spine_path_constraint_data data) {
- if (data == nullptr) return 0;
- PathConstraintData *_data = (PathConstraintData *) data;
- return (int32_t) _data->getBones().size();
- }
- spine_bone_data *spine_path_constraint_data_get_bones(spine_path_constraint_data data) {
- if (data == nullptr) return nullptr;
- PathConstraintData *_data = (PathConstraintData *) data;
- return (spine_bone_data *) _data->getBones().buffer();
- }
- spine_slot_data spine_path_constraint_data_get_target(spine_path_constraint_data data) {
- if (data == nullptr) return nullptr;
- PathConstraintData *_data = (PathConstraintData *) data;
- return (spine_slot_data) _data->getTarget();
- }
- void spine_path_constraint_data_set_target(spine_path_constraint_data data, spine_slot_data target) {
- if (data == nullptr) return;
- PathConstraintData *_data = (PathConstraintData *) data;
- _data->setTarget((SlotData *) target);
- }
- spine_position_mode spine_path_constraint_data_get_position_mode(spine_path_constraint_data data) {
- if (data == nullptr) return SPINE_POSITION_MODE_FIXED;
- PathConstraintData *_data = (PathConstraintData *) data;
- return (spine_position_mode) _data->getPositionMode();
- }
- void spine_path_constraint_data_set_position_mode(spine_path_constraint_data data, spine_position_mode positionMode) {
- if (data == nullptr) return;
- PathConstraintData *_data = (PathConstraintData *) data;
- _data->setPositionMode((PositionMode) positionMode);
- }
- spine_spacing_mode spine_path_constraint_data_get_spacing_mode(spine_path_constraint_data data) {
- if (data == nullptr) return SPINE_SPACING_MODE_LENGTH;
- PathConstraintData *_data = (PathConstraintData *) data;
- return (spine_spacing_mode) _data->getSpacingMode();
- }
- void spine_path_constraint_data_set_spacing_mode(spine_path_constraint_data data, spine_spacing_mode spacingMode) {
- if (data == nullptr) return;
- PathConstraintData *_data = (PathConstraintData *) data;
- _data->setSpacingMode((SpacingMode) spacingMode);
- }
- spine_rotate_mode spine_path_constraint_data_get_rotate_mode(spine_path_constraint_data data) {
- if (data == nullptr) return SPINE_ROTATE_MODE_TANGENT;
- PathConstraintData *_data = (PathConstraintData *) data;
- return (spine_rotate_mode) _data->getRotateMode();
- }
- void spine_path_constraint_data_set_rotate_mode(spine_path_constraint_data data, spine_rotate_mode rotateMode) {
- if (data == nullptr) return;
- PathConstraintData *_data = (PathConstraintData *) data;
- _data->setRotateMode((RotateMode) rotateMode);
- }
- float spine_path_constraint_data_get_offset_rotation(spine_path_constraint_data data) {
- if (data == nullptr) return 0;
- PathConstraintData *_data = (PathConstraintData *) data;
- return _data->getOffsetRotation();
- }
- void spine_path_constraint_data_set_offset_rotation(spine_path_constraint_data data, float offsetRotation) {
- if (data == nullptr) return;
- PathConstraintData *_data = (PathConstraintData *) data;
- _data->setOffsetRotation(offsetRotation);
- }
- float spine_path_constraint_data_get_position(spine_path_constraint_data data) {
- if (data == nullptr) return 0;
- PathConstraintData *_data = (PathConstraintData *) data;
- return _data->getPosition();
- }
- void spine_path_constraint_data_set_position(spine_path_constraint_data data, float position) {
- if (data == nullptr) return;
- PathConstraintData *_data = (PathConstraintData *) data;
- _data->setPosition(position);
- }
- float spine_path_constraint_data_get_spacing(spine_path_constraint_data data) {
- if (data == nullptr) return 0;
- PathConstraintData *_data = (PathConstraintData *) data;
- return _data->getSpacing();
- }
- void spine_path_constraint_data_set_spacing(spine_path_constraint_data data, float spacing) {
- if (data == nullptr) return;
- PathConstraintData *_data = (PathConstraintData *) data;
- _data->setSpacing(spacing);
- }
- float spine_path_constraint_data_get_mix_rotate(spine_path_constraint_data data) {
- if (data == nullptr) return 0;
- PathConstraintData *_data = (PathConstraintData *) data;
- return _data->getMixRotate();
- }
- void spine_path_constraint_data_set_mix_rotate(spine_path_constraint_data data, float mixRotate) {
- if (data == nullptr) return;
- PathConstraintData *_data = (PathConstraintData *) data;
- _data->setMixRotate(mixRotate);
- }
- float spine_path_constraint_data_get_mix_x(spine_path_constraint_data data) {
- if (data == nullptr) return 0;
- PathConstraintData *_data = (PathConstraintData *) data;
- return _data->getMixX();
- }
- void spine_path_constraint_data_set_mix_x(spine_path_constraint_data data, float mixX) {
- if (data == nullptr) return;
- PathConstraintData *_data = (PathConstraintData *) data;
- _data->setMixX(mixX);
- }
- float spine_path_constraint_data_get_mix_y(spine_path_constraint_data data) {
- if (data == nullptr) return 0;
- PathConstraintData *_data = (PathConstraintData *) data;
- return _data->getMixY();
- }
- void spine_path_constraint_data_set_mix_y(spine_path_constraint_data data, float mixY) {
- if (data == nullptr) return;
- PathConstraintData *_data = (PathConstraintData *) data;
- _data->setMixY(mixY);
- }
- // PathConstraint
- void spine_path_constraint_update(spine_path_constraint constraint) {
- if (constraint == nullptr) return;
- PathConstraint *_constraint = (PathConstraint *) constraint;
- _constraint->update(spine::Physics_Update);
- }
- int32_t spine_path_constraint_get_order(spine_path_constraint constraint) {
- if (constraint == nullptr) return 0;
- PathConstraint *_constraint = (PathConstraint *) constraint;
- return _constraint->getOrder();
- }
- spine_path_constraint_data spine_path_constraint_get_data(spine_path_constraint constraint) {
- if (constraint == nullptr) return nullptr;
- PathConstraint *_constraint = (PathConstraint *) constraint;
- return (spine_path_constraint_data) &_constraint->getData();
- }
- int32_t spine_path_constraint_get_num_bones(spine_path_constraint constraint) {
- if (constraint == nullptr) return 0;
- PathConstraint *_constraint = (PathConstraint *) constraint;
- return (int32_t) _constraint->getBones().size();
- }
- spine_bone *spine_path_constraint_get_bones(spine_path_constraint constraint) {
- if (constraint == nullptr) return nullptr;
- PathConstraint *_constraint = (PathConstraint *) constraint;
- return (spine_bone *) _constraint->getBones().buffer();
- }
- spine_slot spine_path_constraint_get_target(spine_path_constraint constraint) {
- if (constraint == nullptr) return nullptr;
- PathConstraint *_constraint = (PathConstraint *) constraint;
- return (spine_slot) _constraint->getTarget();
- }
- void spine_path_constraint_set_target(spine_path_constraint constraint, spine_slot target) {
- if (constraint == nullptr) return;
- PathConstraint *_constraint = (PathConstraint *) constraint;
- _constraint->setTarget((Slot *) target);
- }
- float spine_path_constraint_get_position(spine_path_constraint constraint) {
- if (constraint == nullptr) return 0;
- PathConstraint *_constraint = (PathConstraint *) constraint;
- return _constraint->getPosition();
- }
- void spine_path_constraint_set_position(spine_path_constraint constraint, float position) {
- if (constraint == nullptr) return;
- PathConstraint *_constraint = (PathConstraint *) constraint;
- _constraint->setPosition(position);
- }
- float spine_path_constraint_get_spacing(spine_path_constraint constraint) {
- if (constraint == nullptr) return 0;
- PathConstraint *_constraint = (PathConstraint *) constraint;
- return _constraint->getSpacing();
- }
- void spine_path_constraint_set_spacing(spine_path_constraint constraint, float spacing) {
- if (constraint == nullptr) return;
- PathConstraint *_constraint = (PathConstraint *) constraint;
- _constraint->setSpacing(spacing);
- }
- float spine_path_constraint_get_mix_rotate(spine_path_constraint constraint) {
- if (constraint == nullptr) return 0;
- PathConstraint *_constraint = (PathConstraint *) constraint;
- return _constraint->getMixRotate();
- }
- void spine_path_constraint_set_mix_rotate(spine_path_constraint constraint, float mixRotate) {
- if (constraint == nullptr) return;
- PathConstraint *_constraint = (PathConstraint *) constraint;
- _constraint->setMixRotate(mixRotate);
- }
- float spine_path_constraint_get_mix_x(spine_path_constraint constraint) {
- if (constraint == nullptr) return 0;
- PathConstraint *_constraint = (PathConstraint *) constraint;
- return _constraint->getMixX();
- }
- void spine_path_constraint_set_mix_x(spine_path_constraint constraint, float mixX) {
- if (constraint == nullptr) return;
- PathConstraint *_constraint = (PathConstraint *) constraint;
- _constraint->setMixX(mixX);
- }
- float spine_path_constraint_get_mix_y(spine_path_constraint constraint) {
- if (constraint == nullptr) return 0;
- PathConstraint *_constraint = (PathConstraint *) constraint;
- return _constraint->getMixY();
- }
- void spine_path_constraint_set_mix_y(spine_path_constraint constraint, float mixY) {
- if (constraint == nullptr) return;
- PathConstraint *_constraint = (PathConstraint *) constraint;
- _constraint->setMixY(mixY);
- }
- spine_bool spine_path_constraint_get_is_active(spine_path_constraint constraint) {
- if (constraint == nullptr) return 0;
- PathConstraint *_constraint = (PathConstraint *) constraint;
- return _constraint->isActive() ? -1 : 0;
- }
- void spine_path_constraint_set_is_active(spine_path_constraint constraint, spine_bool isActive) {
- if (constraint == nullptr) return;
- PathConstraint *_constraint = (PathConstraint *) constraint;
- _constraint->setActive(isActive);
- }
- // PhysicsConstraintData
- void spine_physics_constraint_data_set_bone(spine_physics_constraint_data data, spine_bone_data bone) {
- if (data == nullptr) return;
- PhysicsConstraintData *_data = (PhysicsConstraintData *) data;
- _data->setBone((BoneData *) bone);
- }
- spine_bone_data spine_physics_constraint_data_get_bone(spine_physics_constraint_data data) {
- if (data == nullptr) return nullptr;
- PhysicsConstraintData *_data = (PhysicsConstraintData *) data;
- return (spine_bone_data) _data->getBone();
- }
- void spine_physics_constraint_data_set_x(spine_physics_constraint_data data, float x) {
- if (data == nullptr) return;
- PhysicsConstraintData *_data = (PhysicsConstraintData *) data;
- _data->setX(x);
- }
- float spine_physics_constraint_data_get_x(spine_physics_constraint_data data) {
- if (data == nullptr) return 0.0f;
- PhysicsConstraintData *_data = (PhysicsConstraintData *) data;
- return _data->getX();
- }
- void spine_physics_constraint_data_set_y(spine_physics_constraint_data data, float y) {
- if (data == nullptr) return;
- PhysicsConstraintData *_data = (PhysicsConstraintData *) data;
- _data->setY(y);
- }
- float spine_physics_constraint_data_get_y(spine_physics_constraint_data data) {
- if (data == nullptr) return 0.0f;
- PhysicsConstraintData *_data = (PhysicsConstraintData *) data;
- return _data->getY();
- }
- void spine_physics_constraint_data_set_rotate(spine_physics_constraint_data data, float rotate) {
- if (data == nullptr) return;
- PhysicsConstraintData *_data = (PhysicsConstraintData *) data;
- _data->setRotate(rotate);
- }
- float spine_physics_constraint_data_get_rotate(spine_physics_constraint_data data) {
- if (data == nullptr) return 0.0f;
- PhysicsConstraintData *_data = (PhysicsConstraintData *) data;
- return _data->getRotate();
- }
- void spine_physics_constraint_data_set_scale_x(spine_physics_constraint_data data, float scaleX) {
- if (data == nullptr) return;
- PhysicsConstraintData *_data = (PhysicsConstraintData *) data;
- _data->setScaleX(scaleX);
- }
- float spine_physics_constraint_data_get_scale_x(spine_physics_constraint_data data) {
- if (data == nullptr) return 0.0f;
- PhysicsConstraintData *_data = (PhysicsConstraintData *) data;
- return _data->getScaleX();
- }
- void spine_physics_constraint_data_set_shear_x(spine_physics_constraint_data data, float shearX) {
- if (data == nullptr) return;
- PhysicsConstraintData *_data = (PhysicsConstraintData *) data;
- _data->setShearX(shearX);
- }
- float spine_physics_constraint_data_get_shear_x(spine_physics_constraint_data data) {
- if (data == nullptr) return 0.0f;
- PhysicsConstraintData *_data = (PhysicsConstraintData *) data;
- return _data->getShearX();
- }
- void spine_physics_constraint_data_set_limit(spine_physics_constraint_data data, float limit) {
- if (data == nullptr) return;
- PhysicsConstraintData *_data = (PhysicsConstraintData *) data;
- _data->setLimit(limit);
- }
- float spine_physics_constraint_data_get_limit(spine_physics_constraint_data data) {
- if (data == nullptr) return 0.0f;
- PhysicsConstraintData *_data = (PhysicsConstraintData *) data;
- return _data->getLimit();
- }
- void spine_physics_constraint_data_set_step(spine_physics_constraint_data data, float step) {
- if (data == nullptr) return;
- PhysicsConstraintData *_data = (PhysicsConstraintData *) data;
- _data->setStep(step);
- }
- float spine_physics_constraint_data_get_step(spine_physics_constraint_data data) {
- if (data == nullptr) return 0.0f;
- PhysicsConstraintData *_data = (PhysicsConstraintData *) data;
- return _data->getStep();
- }
- void spine_physics_constraint_data_set_inertia(spine_physics_constraint_data data, float inertia) {
- if (data == nullptr) return;
- PhysicsConstraintData *_data = (PhysicsConstraintData *) data;
- _data->setInertia(inertia);
- }
- float spine_physics_constraint_data_get_inertia(spine_physics_constraint_data data) {
- if (data == nullptr) return 0.0f;
- PhysicsConstraintData *_data = (PhysicsConstraintData *) data;
- return _data->getInertia();
- }
- void spine_physics_constraint_data_set_strength(spine_physics_constraint_data data, float strength) {
- if (data == nullptr) return;
- PhysicsConstraintData *_data = (PhysicsConstraintData *) data;
- _data->setStrength(strength);
- }
- float spine_physics_constraint_data_get_strength(spine_physics_constraint_data data) {
- if (data == nullptr) return 0.0f;
- PhysicsConstraintData *_data = (PhysicsConstraintData *) data;
- return _data->getStrength();
- }
- void spine_physics_constraint_data_set_damping(spine_physics_constraint_data data, float damping) {
- if (data == nullptr) return;
- PhysicsConstraintData *_data = (PhysicsConstraintData *) data;
- _data->setDamping(damping);
- }
- float spine_physics_constraint_data_get_damping(spine_physics_constraint_data data) {
- if (data == nullptr) return 0.0f;
- PhysicsConstraintData *_data = (PhysicsConstraintData *) data;
- return _data->getDamping();
- }
- void spine_physics_constraint_data_set_mass_inverse(spine_physics_constraint_data data, float massInverse) {
- if (data == nullptr) return;
- PhysicsConstraintData *_data = (PhysicsConstraintData *) data;
- _data->setMassInverse(massInverse);
- }
- float spine_physics_constraint_data_get_mass_inverse(spine_physics_constraint_data data) {
- if (data == nullptr) return 0.0f;
- PhysicsConstraintData *_data = (PhysicsConstraintData *) data;
- return _data->getMassInverse();
- }
- void spine_physics_constraint_data_set_wind(spine_physics_constraint_data data, float wind) {
- if (data == nullptr) return;
- PhysicsConstraintData *_data = (PhysicsConstraintData *) data;
- _data->setWind(wind);
- }
- float spine_physics_constraint_data_get_wind(spine_physics_constraint_data data) {
- if (data == nullptr) return 0.0f;
- PhysicsConstraintData *_data = (PhysicsConstraintData *) data;
- return _data->getWind();
- }
- void spine_physics_constraint_data_set_gravity(spine_physics_constraint_data data, float gravity) {
- if (data == nullptr) return;
- PhysicsConstraintData *_data = (PhysicsConstraintData *) data;
- _data->setGravity(gravity);
- }
- float spine_physics_constraint_data_get_gravity(spine_physics_constraint_data data) {
- if (data == nullptr) return 0.0f;
- PhysicsConstraintData *_data = (PhysicsConstraintData *) data;
- return _data->getGravity();
- }
- void spine_physics_constraint_data_set_mix(spine_physics_constraint_data data, float mix) {
- if (data == nullptr) return;
- PhysicsConstraintData *_data = (PhysicsConstraintData *) data;
- _data->setMix(mix);
- }
- float spine_physics_constraint_data_get_mix(spine_physics_constraint_data data) {
- if (data == nullptr) return 0.0f;
- PhysicsConstraintData *_data = (PhysicsConstraintData *) data;
- return _data->getMix();
- }
- void spine_physics_constraint_data_set_inertia_global(spine_physics_constraint_data data, int32_t inertiaGlobal) {
- if (data == nullptr) return;
- PhysicsConstraintData *_data = (PhysicsConstraintData *) data;
- _data->setInertiaGlobal(inertiaGlobal);
- }
- spine_bool spine_physics_constraint_data_is_inertia_global(spine_physics_constraint_data data) {
- if (data == nullptr) return false;
- PhysicsConstraintData *_data = (PhysicsConstraintData *) data;
- return _data->isInertiaGlobal();
- }
- void spine_physics_constraint_data_set_strength_global(spine_physics_constraint_data data, spine_bool strengthGlobal) {
- if (data == nullptr) return;
- PhysicsConstraintData *_data = (PhysicsConstraintData *) data;
- _data->setStrengthGlobal(strengthGlobal);
- }
- spine_bool spine_physics_constraint_data_is_strength_global(spine_physics_constraint_data data) {
- if (data == nullptr) return false;
- PhysicsConstraintData *_data = (PhysicsConstraintData *) data;
- return _data->isStrengthGlobal();
- }
- void spine_physics_constraint_data_set_damping_global(spine_physics_constraint_data data, spine_bool dampingGlobal) {
- if (data == nullptr) return;
- PhysicsConstraintData *_data = (PhysicsConstraintData *) data;
- _data->setDampingGlobal(dampingGlobal);
- }
- spine_bool spine_physics_constraint_data_is_damping_global(spine_physics_constraint_data data) {
- if (data == nullptr) return false;
- PhysicsConstraintData *_data = (PhysicsConstraintData *) data;
- return _data->isDampingGlobal();
- }
- void spine_physics_constraint_data_set_mass_global(spine_physics_constraint_data data, spine_bool massGlobal) {
- if (data == nullptr) return;
- PhysicsConstraintData *_data = (PhysicsConstraintData *) data;
- _data->setMassGlobal(massGlobal);
- }
- spine_bool spine_physics_constraint_data_is_mass_global(spine_physics_constraint_data data) {
- if (data == nullptr) return false;
- PhysicsConstraintData *_data = (PhysicsConstraintData *) data;
- return _data->isMassGlobal();
- }
- void spine_physics_constraint_data_set_wind_global(spine_physics_constraint_data data, spine_bool windGlobal) {
- if (data == nullptr) return;
- PhysicsConstraintData *_data = (PhysicsConstraintData *) data;
- _data->setWindGlobal(windGlobal);
- }
- spine_bool spine_physics_constraint_data_is_wind_global(spine_physics_constraint_data data) {
- if (data == nullptr) return false;
- PhysicsConstraintData *_data = (PhysicsConstraintData *) data;
- return _data->isWindGlobal();
- }
- void spine_physics_constraint_data_set_gravity_global(spine_physics_constraint_data data, spine_bool gravityGlobal) {
- if (data == nullptr) return;
- PhysicsConstraintData *_data = (PhysicsConstraintData *) data;
- _data->setGravityGlobal(gravityGlobal);
- }
- spine_bool spine_physics_constraint_data_is_gravity_global(spine_physics_constraint_data data) {
- if (data == nullptr) return false;
- PhysicsConstraintData *_data = (PhysicsConstraintData *) data;
- return _data->isGravityGlobal();
- }
- void spine_physics_constraint_data_set_mix_global(spine_physics_constraint_data data, spine_bool mixGlobal) {
- if (data == nullptr) return;
- PhysicsConstraintData *_data = (PhysicsConstraintData *) data;
- _data->setMixGlobal(mixGlobal);
- }
- spine_bool spine_physics_constraint_data_is_mix_global(spine_physics_constraint_data data) {
- if (data == nullptr) return false;
- PhysicsConstraintData *_data = (PhysicsConstraintData *) data;
- return _data->isMixGlobal();
- }
- // PhysicsConstraint
- void spine_physics_constraint_set_bone(spine_physics_constraint constraint, spine_bone bone) {
- if (constraint == nullptr) return;
- PhysicsConstraint *_constraint = (PhysicsConstraint *) constraint;
- _constraint->setBone((Bone *) bone);
- }
- spine_bone spine_physics_constraint_get_bone(spine_physics_constraint constraint) {
- if (constraint == nullptr) return nullptr;
- PhysicsConstraint *_constraint = (PhysicsConstraint *) constraint;
- return (spine_bone) _constraint->getBone();
- }
- void spine_physics_constraint_set_inertia(spine_physics_constraint constraint, float value) {
- if (constraint == nullptr) return;
- PhysicsConstraint *_constraint = (PhysicsConstraint *) constraint;
- _constraint->setInertia(value);
- }
- float spine_physics_constraint_get_inertia(spine_physics_constraint constraint) {
- if (constraint == nullptr) return 0.0f;
- PhysicsConstraint *_constraint = (PhysicsConstraint *) constraint;
- return _constraint->getInertia();
- }
- void spine_physics_constraint_set_strength(spine_physics_constraint constraint, float value) {
- if (constraint == nullptr) return;
- PhysicsConstraint *_constraint = (PhysicsConstraint *) constraint;
- _constraint->setStrength(value);
- }
- float spine_physics_constraint_get_strength(spine_physics_constraint constraint) {
- if (constraint == nullptr) return 0.0f;
- PhysicsConstraint *_constraint = (PhysicsConstraint *) constraint;
- return _constraint->getStrength();
- }
- void spine_physics_constraint_set_damping(spine_physics_constraint constraint, float value) {
- if (constraint == nullptr) return;
- PhysicsConstraint *_constraint = (PhysicsConstraint *) constraint;
- _constraint->setDamping(value);
- }
- float spine_physics_constraint_get_damping(spine_physics_constraint constraint) {
- if (constraint == nullptr) return 0.0f;
- PhysicsConstraint *_constraint = (PhysicsConstraint *) constraint;
- return _constraint->getDamping();
- }
- void spine_physics_constraint_set_mass_inverse(spine_physics_constraint constraint, float value) {
- if (constraint == nullptr) return;
- PhysicsConstraint *_constraint = (PhysicsConstraint *) constraint;
- _constraint->setMassInverse(value);
- }
- float spine_physics_constraint_get_mass_inverse(spine_physics_constraint constraint) {
- if (constraint == nullptr) return 0.0f;
- PhysicsConstraint *_constraint = (PhysicsConstraint *) constraint;
- return _constraint->getMassInverse();
- }
- void spine_physics_constraint_set_wind(spine_physics_constraint constraint, float value) {
- if (constraint == nullptr) return;
- PhysicsConstraint *_constraint = (PhysicsConstraint *) constraint;
- _constraint->setWind(value);
- }
- float spine_physics_constraint_get_wind(spine_physics_constraint constraint) {
- if (constraint == nullptr) return 0.0f;
- PhysicsConstraint *_constraint = (PhysicsConstraint *) constraint;
- return _constraint->getWind();
- }
- void spine_physics_constraint_set_gravity(spine_physics_constraint constraint, float value) {
- if (constraint == nullptr) return;
- PhysicsConstraint *_constraint = (PhysicsConstraint *) constraint;
- _constraint->setGravity(value);
- }
- float spine_physics_constraint_get_gravity(spine_physics_constraint constraint) {
- if (constraint == nullptr) return 0.0f;
- PhysicsConstraint *_constraint = (PhysicsConstraint *) constraint;
- return _constraint->getGravity();
- }
- void spine_physics_constraint_set_mix(spine_physics_constraint constraint, float value) {
- if (constraint == nullptr) return;
- PhysicsConstraint *_constraint = (PhysicsConstraint *) constraint;
- _constraint->setMix(value);
- }
- float spine_physics_constraint_get_mix(spine_physics_constraint constraint) {
- if (constraint == nullptr) return 0.0f;
- PhysicsConstraint *_constraint = (PhysicsConstraint *) constraint;
- return _constraint->getMix();
- }
- void spine_physics_constraint_set_reset(spine_physics_constraint constraint, spine_bool value) {
- if (constraint == nullptr) return;
- PhysicsConstraint *_constraint = (PhysicsConstraint *) constraint;
- _constraint->setReset(value);
- }
- spine_bool spine_physics_constraint_get_reset(spine_physics_constraint constraint) {
- if (constraint == nullptr) return false;
- PhysicsConstraint *_constraint = (PhysicsConstraint *) constraint;
- return _constraint->getReset();
- }
- void spine_physics_constraint_set_ux(spine_physics_constraint constraint, float value) {
- if (constraint == nullptr) return;
- PhysicsConstraint *_constraint = (PhysicsConstraint *) constraint;
- _constraint->setUx(value);
- }
- float spine_physics_constraint_get_ux(spine_physics_constraint constraint) {
- if (constraint == nullptr) return 0.0f;
- PhysicsConstraint *_constraint = (PhysicsConstraint *) constraint;
- return _constraint->getUx();
- }
- void spine_physics_constraint_set_uy(spine_physics_constraint constraint, float value) {
- if (constraint == nullptr) return;
- PhysicsConstraint *_constraint = (PhysicsConstraint *) constraint;
- _constraint->setUy(value);
- }
- float spine_physics_constraint_get_uy(spine_physics_constraint constraint) {
- if (constraint == nullptr) return 0.0f;
- PhysicsConstraint *_constraint = (PhysicsConstraint *) constraint;
- return _constraint->getUy();
- }
- void spine_physics_constraint_set_cx(spine_physics_constraint constraint, float value) {
- if (constraint == nullptr) return;
- PhysicsConstraint *_constraint = (PhysicsConstraint *) constraint;
- _constraint->setCx(value);
- }
- float spine_physics_constraint_get_cx(spine_physics_constraint constraint) {
- if (constraint == nullptr) return 0.0f;
- PhysicsConstraint *_constraint = (PhysicsConstraint *) constraint;
- return _constraint->getCx();
- }
- void spine_physics_constraint_set_cy(spine_physics_constraint constraint, float value) {
- if (constraint == nullptr) return;
- PhysicsConstraint *_constraint = (PhysicsConstraint *) constraint;
- _constraint->setCy(value);
- }
- float spine_physics_constraint_get_cy(spine_physics_constraint constraint) {
- if (constraint == nullptr) return 0.0f;
- PhysicsConstraint *_constraint = (PhysicsConstraint *) constraint;
- return _constraint->getCy();
- }
- void spine_physics_constraint_set_tx(spine_physics_constraint constraint, float value) {
- if (constraint == nullptr) return;
- PhysicsConstraint *_constraint = (PhysicsConstraint *) constraint;
- _constraint->setTx(value);
- }
- float spine_physics_constraint_get_tx(spine_physics_constraint constraint) {
- if (constraint == nullptr) return 0.0f;
- PhysicsConstraint *_constraint = (PhysicsConstraint *) constraint;
- return _constraint->getTx();
- }
- void spine_physics_constraint_set_ty(spine_physics_constraint constraint, float value) {
- if (constraint == nullptr) return;
- PhysicsConstraint *_constraint = (PhysicsConstraint *) constraint;
- _constraint->setTy(value);
- }
- float spine_physics_constraint_get_ty(spine_physics_constraint constraint) {
- if (constraint == nullptr) return 0.0f;
- PhysicsConstraint *_constraint = (PhysicsConstraint *) constraint;
- return _constraint->getTy();
- }
- void spine_physics_constraint_set_x_offset(spine_physics_constraint constraint, float value) {
- if (constraint == nullptr) return;
- PhysicsConstraint *_constraint = (PhysicsConstraint *) constraint;
- _constraint->setXOffset(value);
- }
- float spine_physics_constraint_get_x_offset(spine_physics_constraint constraint) {
- if (constraint == nullptr) return 0.0f;
- PhysicsConstraint *_constraint = (PhysicsConstraint *) constraint;
- return _constraint->getXOffset();
- }
- void spine_physics_constraint_set_x_velocity(spine_physics_constraint constraint, float value) {
- if (constraint == nullptr) return;
- PhysicsConstraint *_constraint = (PhysicsConstraint *) constraint;
- _constraint->setXVelocity(value);
- }
- float spine_physics_constraint_get_x_velocity(spine_physics_constraint constraint) {
- if (constraint == nullptr) return 0.0f;
- PhysicsConstraint *_constraint = (PhysicsConstraint *) constraint;
- return _constraint->getXVelocity();
- }
- void spine_physics_constraint_set_y_offset(spine_physics_constraint constraint, float value) {
- if (constraint == nullptr) return;
- PhysicsConstraint *_constraint = (PhysicsConstraint *) constraint;
- _constraint->setYOffset(value);
- }
- float spine_physics_constraint_get_y_offset(spine_physics_constraint constraint) {
- if (constraint == nullptr) return 0.0f;
- PhysicsConstraint *_constraint = (PhysicsConstraint *) constraint;
- return _constraint->getYOffset();
- }
- void spine_physics_constraint_set_y_velocity(spine_physics_constraint constraint, float value) {
- if (constraint == nullptr) return;
- PhysicsConstraint *_constraint = (PhysicsConstraint *) constraint;
- _constraint->setYVelocity(value);
- }
- float spine_physics_constraint_get_y_velocity(spine_physics_constraint constraint) {
- if (constraint == nullptr) return 0.0f;
- PhysicsConstraint *_constraint = (PhysicsConstraint *) constraint;
- return _constraint->getYVelocity();
- }
- void spine_physics_constraint_set_rotate_offset(spine_physics_constraint constraint, float value) {
- if (constraint == nullptr) return;
- PhysicsConstraint *_constraint = (PhysicsConstraint *) constraint;
- _constraint->setRotateOffset(value);
- }
- float spine_physics_constraint_get_rotate_offset(spine_physics_constraint constraint) {
- if (constraint == nullptr) return 0.0f;
- PhysicsConstraint *_constraint = (PhysicsConstraint *) constraint;
- return _constraint->getRotateOffset();
- }
- void spine_physics_constraint_set_rotate_velocity(spine_physics_constraint constraint, float value) {
- if (constraint == nullptr) return;
- PhysicsConstraint *_constraint = (PhysicsConstraint *) constraint;
- _constraint->setRotateVelocity(value);
- }
- float spine_physics_constraint_get_rotate_velocity(spine_physics_constraint constraint) {
- if (constraint == nullptr) return 0.0f;
- PhysicsConstraint *_constraint = (PhysicsConstraint *) constraint;
- return _constraint->getRotateVelocity();
- }
- void spine_physics_constraint_set_scale_offset(spine_physics_constraint constraint, float value) {
- if (constraint == nullptr) return;
- PhysicsConstraint *_constraint = (PhysicsConstraint *) constraint;
- _constraint->setScaleOffset(value);
- }
- float spine_physics_constraint_get_scale_offset(spine_physics_constraint constraint) {
- if (constraint == nullptr) return 0.0f;
- PhysicsConstraint *_constraint = (PhysicsConstraint *) constraint;
- return _constraint->getScaleOffset();
- }
- void spine_physics_constraint_set_scale_velocity(spine_physics_constraint constraint, float value) {
- if (constraint == nullptr) return;
- PhysicsConstraint *_constraint = (PhysicsConstraint *) constraint;
- _constraint->setScaleVelocity(value);
- }
- float spine_physics_constraint_get_scale_velocity(spine_physics_constraint constraint) {
- if (constraint == nullptr) return 0.0f;
- PhysicsConstraint *_constraint = (PhysicsConstraint *) constraint;
- return _constraint->getScaleVelocity();
- }
- void spine_physics_constraint_set_active(spine_physics_constraint constraint, spine_bool value) {
- if (constraint == nullptr) return;
- PhysicsConstraint *_constraint = (PhysicsConstraint *) constraint;
- _constraint->setActive(value);
- }
- spine_bool spine_physics_constraint_is_active(spine_physics_constraint constraint) {
- if (constraint == nullptr) return false;
- PhysicsConstraint *_constraint = (PhysicsConstraint *) constraint;
- return _constraint->isActive();
- }
- void spine_physics_constraint_set_remaining(spine_physics_constraint constraint, float value) {
- if (constraint == nullptr) return;
- PhysicsConstraint *_constraint = (PhysicsConstraint *) constraint;
- _constraint->setRemaining(value);
- }
- float spine_physics_constraint_get_remaining(spine_physics_constraint constraint) {
- if (constraint == nullptr) return 0.0f;
- PhysicsConstraint *_constraint = (PhysicsConstraint *) constraint;
- return _constraint->getRemaining();
- }
- void spine_physics_constraint_set_last_time(spine_physics_constraint constraint, float value) {
- if (constraint == nullptr) return;
- PhysicsConstraint *_constraint = (PhysicsConstraint *) constraint;
- _constraint->setLastTime(value);
- }
- float spine_physics_constraint_get_last_time(spine_physics_constraint constraint) {
- if (constraint == nullptr) return 0.0f;
- PhysicsConstraint *_constraint = (PhysicsConstraint *) constraint;
- return _constraint->getLastTime();
- }
- void spine_physics_constraint_reset_fully(spine_physics_constraint constraint) {
- if (constraint == nullptr) return;
- PhysicsConstraint *_constraint = (PhysicsConstraint *) constraint;
- _constraint->reset();
- }
- void spine_physics_constraint_update(spine_physics_constraint data, spine_physics physics) {
- if (data == nullptr) return;
- PhysicsConstraint *_constraint = (PhysicsConstraint *) data;
- _constraint->update((spine::Physics) physics);
- }
- void spine_physics_constraint_translate(spine_physics_constraint data, float x, float y) {
- if (data == nullptr) return;
- PhysicsConstraint *_constraint = (PhysicsConstraint *) data;
- _constraint->translate(x, y);
- }
- void spine_physics_constraint_rotate(spine_physics_constraint data, float x, float y, float degrees) {
- if (data == nullptr) return;
- PhysicsConstraint *_constraint = (PhysicsConstraint *) data;
- _constraint->rotate(x, y, degrees);
- }
- // Sequence
- void spine_sequence_apply(spine_sequence sequence, spine_slot slot, spine_attachment attachment) {
- if (sequence == nullptr) return;
- Sequence *_sequence = (Sequence *) sequence;
- _sequence->apply((Slot *) slot, (Attachment *) attachment);
- }
- const utf8 *spine_sequence_get_path(spine_sequence sequence, const utf8 *basePath, int32_t index) {
- if (sequence == nullptr) return nullptr;
- Sequence *_sequence = (Sequence *) sequence;
- return (utf8 *) strdup(_sequence->getPath(basePath, index).buffer());
- }
- int32_t spine_sequence_get_id(spine_sequence sequence) {
- if (sequence == nullptr) return 0;
- Sequence *_sequence = (Sequence *) sequence;
- return _sequence->getId();
- }
- void spine_sequence_set_id(spine_sequence sequence, int32_t id) {
- if (sequence == nullptr) return;
- Sequence *_sequence = (Sequence *) sequence;
- _sequence->setId(id);
- }
- int32_t spine_sequence_get_start(spine_sequence sequence) {
- if (sequence == nullptr) return 0;
- Sequence *_sequence = (Sequence *) sequence;
- return _sequence->getStart();
- }
- void spine_sequence_set_start(spine_sequence sequence, int32_t start) {
- if (sequence == nullptr) return;
- Sequence *_sequence = (Sequence *) sequence;
- _sequence->setStart(start);
- }
- int32_t spine_sequence_get_digits(spine_sequence sequence) {
- if (sequence == nullptr) return 0;
- Sequence *_sequence = (Sequence *) sequence;
- return _sequence->getDigits();
- }
- void spine_sequence_set_digits(spine_sequence sequence, int32_t digits) {
- if (sequence == nullptr) return;
- Sequence *_sequence = (Sequence *) sequence;
- _sequence->setDigits(digits);
- }
- int32_t spine_sequence_get_setup_index(spine_sequence sequence) {
- if (sequence == nullptr) return 0;
- Sequence *_sequence = (Sequence *) sequence;
- return _sequence->getSetupIndex();
- }
- void spine_sequence_set_setup_index(spine_sequence sequence, int32_t setupIndex) {
- if (sequence == nullptr) return;
- Sequence *_sequence = (Sequence *) sequence;
- _sequence->setSetupIndex(setupIndex);
- }
- int32_t spine_sequence_get_num_regions(spine_sequence sequence) {
- if (sequence == nullptr) return 0;
- Sequence *_sequence = (Sequence *) sequence;
- return (int32_t) _sequence->getRegions().size();
- }
- spine_texture_region *spine_sequence_get_regions(spine_sequence sequence) {
- if (sequence == nullptr) return nullptr;
- Sequence *_sequence = (Sequence *) sequence;
- return (spine_texture_region *) _sequence->getRegions().buffer();
- }
- // TextureRegion
- void *spine_texture_region_get_texture(spine_texture_region textureRegion) {
- if (textureRegion == nullptr) return nullptr;
- TextureRegion *_region = (TextureRegion *) textureRegion;
- return _region->rendererObject;
- }
- void spine_texture_region_set_texture(spine_texture_region textureRegion, void *texture) {
- if (textureRegion == nullptr) return;
- TextureRegion *_region = (TextureRegion *) textureRegion;
- _region->rendererObject = texture;
- }
- float spine_texture_region_get_u(spine_texture_region textureRegion) {
- if (textureRegion == nullptr) return 0;
- TextureRegion *_region = (TextureRegion *) textureRegion;
- return _region->u;
- }
- void spine_texture_region_set_u(spine_texture_region textureRegion, float u) {
- if (textureRegion == nullptr) return;
- TextureRegion *_region = (TextureRegion *) textureRegion;
- _region->u = u;
- }
- float spine_texture_region_get_v(spine_texture_region textureRegion) {
- if (textureRegion == nullptr) return 0;
- TextureRegion *_region = (TextureRegion *) textureRegion;
- return _region->v;
- }
- void spine_texture_region_set_v(spine_texture_region textureRegion, float v) {
- if (textureRegion == nullptr) return;
- TextureRegion *_region = (TextureRegion *) textureRegion;
- _region->v = v;
- }
- float spine_texture_region_get_u2(spine_texture_region textureRegion) {
- if (textureRegion == nullptr) return 0;
- TextureRegion *_region = (TextureRegion *) textureRegion;
- return _region->u2;
- }
- void spine_texture_region_set_u2(spine_texture_region textureRegion, float u2) {
- if (textureRegion == nullptr) return;
- TextureRegion *_region = (TextureRegion *) textureRegion;
- _region->u2 = u2;
- }
- float spine_texture_region_get_v2(spine_texture_region textureRegion) {
- if (textureRegion == nullptr) return 0;
- TextureRegion *_region = (TextureRegion *) textureRegion;
- return _region->v2;
- }
- void spine_texture_region_set_v2(spine_texture_region textureRegion, float v2) {
- if (textureRegion == nullptr) return;
- TextureRegion *_region = (TextureRegion *) textureRegion;
- _region->v2 = v2;
- }
- int32_t spine_texture_region_get_degrees(spine_texture_region textureRegion) {
- if (textureRegion == nullptr) return 0;
- TextureRegion *_region = (TextureRegion *) textureRegion;
- return _region->degrees;
- }
- void spine_texture_region_set_degrees(spine_texture_region textureRegion, int32_t degrees) {
- if (textureRegion == nullptr) return;
- TextureRegion *_region = (TextureRegion *) textureRegion;
- _region->degrees = degrees;
- }
- float spine_texture_region_get_offset_x(spine_texture_region textureRegion) {
- if (textureRegion == nullptr) return 0;
- TextureRegion *_region = (TextureRegion *) textureRegion;
- return _region->offsetX;
- }
- void spine_texture_region_set_offset_x(spine_texture_region textureRegion, float offsetX) {
- if (textureRegion == nullptr) return;
- TextureRegion *_region = (TextureRegion *) textureRegion;
- _region->offsetX = offsetX;
- }
- float spine_texture_region_get_offset_y(spine_texture_region textureRegion) {
- if (textureRegion == nullptr) return 0;
- TextureRegion *_region = (TextureRegion *) textureRegion;
- return _region->offsetY;
- }
- void spine_texture_region_set_offset_y(spine_texture_region textureRegion, float offsetY) {
- if (textureRegion == nullptr) return;
- TextureRegion *_region = (TextureRegion *) textureRegion;
- _region->offsetY = offsetY;
- }
- int32_t spine_texture_region_get_width(spine_texture_region textureRegion) {
- if (textureRegion == nullptr) return 0;
- TextureRegion *_region = (TextureRegion *) textureRegion;
- return _region->width;
- }
- void spine_texture_region_set_width(spine_texture_region textureRegion, int32_t width) {
- if (textureRegion == nullptr) return;
- TextureRegion *_region = (TextureRegion *) textureRegion;
- _region->width = width;
- }
- int32_t spine_texture_region_get_height(spine_texture_region textureRegion) {
- if (textureRegion == nullptr) return 0;
- TextureRegion *_region = (TextureRegion *) textureRegion;
- return _region->height;
- }
- void spine_texture_region_set_height(spine_texture_region textureRegion, int32_t height) {
- if (textureRegion == nullptr) return;
- TextureRegion *_region = (TextureRegion *) textureRegion;
- _region->height = height;
- }
- int32_t spine_texture_region_get_original_width(spine_texture_region textureRegion) {
- if (textureRegion == nullptr) return 0;
- TextureRegion *_region = (TextureRegion *) textureRegion;
- return _region->originalWidth;
- }
- void spine_texture_region_set_original_width(spine_texture_region textureRegion, int32_t originalWidth) {
- if (textureRegion == nullptr) return;
- TextureRegion *_region = (TextureRegion *) textureRegion;
- _region->originalWidth = originalWidth;
- }
- int32_t spine_texture_region_get_original_height(spine_texture_region textureRegion) {
- if (textureRegion == nullptr) return 0;
- TextureRegion *_region = (TextureRegion *) textureRegion;
- return _region->originalHeight;
- }
- void spine_texture_region_set_original_height(spine_texture_region textureRegion, int32_t originalHeight) {
- if (textureRegion == nullptr) return;
- TextureRegion *_region = (TextureRegion *) textureRegion;
- _region->originalHeight = originalHeight;
- }
|