#import "GameObjc.h" #include "Game.h" #include "DanceGame.h" #include "FootStep.h" #include "InertialTrajProcess.h" //#include "OriginTraj.h" @interface GameObjc() { @private Game *game; int gametype; } @end @implementation GameObjc - (instancetype)initWithGametype:(int)gametype{ self = [super init]; if (self){ gametype = gametype; game = new Game(gametype); } return self; } - (void)gameProcess:(int)timeStamp rightPos:(int *)rightPos rightAtt:(int *)rightAtt rightZupt:(int)rightZupt right_press:(int)right_press leftPos:(int *)leftPos leftAtt:(int *)leftAtt leftZupt:(int)leftZupt left_press:(int)left_press jump:(int)jump down:(int)down rssi:(int)rssi girl_shoes:(int)girl_shoes{ game->GameProcess(timeStamp, rightPos, rightAtt, rightZupt,right_press,leftPos, leftAtt, leftZupt, left_press,jump, down, rssi,girl_shoes); } - (void)runGameProcess:(int *)rightPos rightAtt:(int *)rightAtt rightZupt:(int)rightZupt leftPos:(int *)leftPos leftAtt:(int *)leftAtt leftZupt:(int)leftZupt jump:(int)jump down:(int)down girl_shoes:(int)girl_shoes{ game->RunGameProcess(rightPos, rightAtt, rightZupt, leftPos, leftAtt, leftZupt, jump, down,girl_shoes); } - (void)getGameResult:(int *)matrix{ game->getGameResult(matrix); } - (int)getStepFreq:(int)leftOrRight{ return game->getStepFreq(leftOrRight); } - (int)getStepStatus:(int)leftOrRight{ return game->getStepStatus(leftOrRight); } - (int)getStepCount:(int)leftOrRight{ return game->getStepCount(leftOrRight); } - (float)getGamePos:(int)left_or_right index:(int)index{ return game->getGamePos(left_or_right, index); } - (void)start{ game->start(nil); } - (void)end{ game->end(); } - (void)isBingo{ game->isBingo(); } -(int)getInteractionCMD{ return game->getInteractionCMD(); } /// 向外提供,手动释放 - (void)handRelease{ delete game; } - (void)dealloc{ delete game; } @end @interface RunGameObjc () { @private RunGame * runGame; } @end @implementation RunGameObjc - (instancetype)init{ self = [super init]; if (self) { runGame = new RunGame(); } return self; } - (int)getResultLeftRight:(int *)pos devNum:(short)devNum{ return runGame->getResultLeftRight(pos, devNum); } - (int)getResultJump:(short)jump{ return runGame->getResultJump(jump); } - (int)getResultDown:(short)down{ return runGame->getResultDown(down); } - (void)setResultConLeft:(short)zupt{ runGame->setResultConLeft(zupt); } - (void)setResultConRight:(short)zupt{ runGame->setResultConRight(zupt); } - (int)getResultLeft:(int *)pos girl_shoes:(int)girl_shoes{ return runGame->getResultLeft(pos,girl_shoes); } - (int)getResultRight:(int *)pos girl_shoes:(int)girl_shoes{ return runGame->getResultRight(pos,girl_shoes); } - (void)process:(int *)rightPos rightAtt:(int *)rightAtt rightZupt:(int)rightZupt leftPos:(int *)leftPos leftAtt:(int *)leftAtt leftZupt:(int)leftZupt jump:(int)jump down:(int)down girl_shoes:(int)girl_shoes{ runGame->Process(rightPos, rightAtt, rightZupt, leftPos, leftAtt, leftZupt, jump, down,girl_shoes); } - (void)getResult:(int *)dec{ runGame->getResult(dec); } /// 向外提供,手动释放 - (void)handRelease{ delete runGame; } - (void)dealloc{ delete runGame; } @end @interface DanceGameObjc () { @private DanceGame *danceGame; } @end @implementation DanceGameObjc - (instancetype)init{ self = [super init]; if (self) { danceGame = new DanceGame(); } return self; } //- (int)gamePositionProcess:(int *)pos // stepPos:(int *)stepPos // rssi:(int)rssi // hostOrSlave:(short)hostOrSlave{ // //SInt16 ==> short* // return danceGame->game_position_process(pos, stepPos, rssi, hostOrSlave); //} //- (void)gameBoundary:(int *)globalPos{ // danceGame->game_boundary(globalPos); //} //- (int)getDirectionFloat:(float *)pos // rssi:(int)rssi{ // //float==>32位 // return danceGame->getDirectionFloat(pos,rssi); //} //- (short)danceGameProcess:(int *)pos // zupt:(short)zupt // rssi:(int)rssi // hostOrSlave:(short)hostOrSlave{ // return danceGame->dance_game_process(pos, zupt, rssi, hostOrSlave); //} - (void)process:(int *)rightPos rightAtt:(int *)rightAtt rightZupt:(int)rightZupt right_press:(int)right_press leftPos:(int *)leftPos leftAtt:(int *)leftAtt leftZupt:(int)leftZupt left_press:(int)left_press jump:(int)jump down:(int)down rssi:(int)rssi{ danceGame->Process(rightPos, rightAtt, rightZupt, right_press,leftPos, leftAtt, leftZupt, left_press,jump, down, rssi); } - (void)getResult:(int *)matrix{ danceGame->getResult(matrix); } //- (float)getRssiDistance:(int)rssi{ // return danceGame->getRssiDistance(rssi); //} //- (int)savePosAndRssi:(int *)pos // zupt:(short)zupt // rssi:(int)rssi // hostOrSlave:(short)hostOrSlave{ // return danceGame->savePosAndRssi(pos, zupt, rssi, hostOrSlave); //} /// 向外提供,手动释放 - (void)handRelease{ delete danceGame; } - (void)dealloc{ delete danceGame; } @end @interface FootStepObjc () { @private FootStep *footStep; } @end @implementation FootStepObjc - (instancetype)init{ self = [super init]; if (self) { footStep = new FootStep(); } return self; } //pos开辟3个空间 - (void)stepCal:(int)timeStamp posList:(int *)pos zupt:(int)zupt{ footStep->stepCal(timeStamp, pos, zupt); } - (int)getStepFreq{ return footStep->getStepFreq(); } - (int)getStepStatus{ return footStep->getStepStatus(); } - (int)getStepCount{ return footStep->getStepCount(); } - (void)dealloc{ delete footStep; } /// 向外提供,手动释放 - (void)handRelease{ delete footStep; } @end @interface InertialTrajProcessObjc () { @private InertialTrajProcess * inertialTrajProcess; } @end @implementation InertialTrajProcessObjc - (instancetype)init{ self = [super init]; if (self) { inertialTrajProcess = new InertialTrajProcess(); } return self; } - (void)trajRotate:(int *)pos{ inertialTrajProcess->TrajRotate(pos); } //rotateMatrix只能开辟4个空间 - (void)trajRotate:(int *)pos rotateMatrix:(float *)rotateMatrix{ inertialTrajProcess->TrajRotate(pos,rotateMatrix); } - (void)resetHeading:(short)heading{ inertialTrajProcess->ResetHeading(heading); } /// 向外提供,手动释放 - (void)handRelease{ delete inertialTrajProcess; } - (void)dealloc{ delete inertialTrajProcess; } @end //@interface OriginTrajObj () //{ // @private // OriginTraj * originTraj; //} //@end //@implementation OriginTrajObj //- (instancetype)init{ // self = [super init]; // if (self){ // originTraj = new OriginTraj(); // } // return self; //} // //- (void)process:(int*)right_pos // right_att:(int*)right_att // right_zupt:(int)right_zupt // left_pos:(int*)left_pos // left_att:(int*)left_att // left_zupt:(int) left_zupt{ // originTraj->Process(right_pos, right_att, right_zupt, left_pos, left_att, left_zupt); //} // //- (float)getGamePos:(int)left_or_right // index:(int)index{ // return originTraj->getGamePos(left_or_right, index); //} // ///// 向外提供,手动释放 //- (void)handRelease{ // delete originTraj; //} //- (void)dealloc{ // delete originTraj; //} //@end