123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352 |
- #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
|