わかりました、ある種の成功。ベストプラクティスで私を打ち負かさないでください。私はただこれをやりたかっただけです。
そこで、汚い仕事をするためのクラスを作成しました。これを ShivaInterface と呼びましょう。
ShivaInterface.h
ShivaInterface.mm /*** note the .mm ***/
ヘッダーは次のとおりでした。
#import <Foundation/Foundation.h>
@interface ShivaInterface : NSObject{
}
+(const void*)getMyParams:(NSNumber*)x andY:(NSNumber*)y;
@end
そして次のように実装されます:
#import "ShivaInterface.h"
#import "S3DXPlugin.h" //is this the correct thing to include? it worked for me
@implementation ShivaInterface
+(const void*)getMyParams:(NSNumber*)x andY:(NSNumber*)y{
static S3DX::AIVariable args[2];
args[0].SetNumberValue([x floatValue]);
args[1].SetNumberValue([y floatValue]);
return args;
}
@end
次に、私の純粋な Obj-c メソッドで:
const void *params = [ShivaInterface getMyParams:[NSNumber numberWithFloat:100.0f] andY:[NSNumber numberWithFloat:100.0f]];
S3DClient_SendEventToCurrentUser("MainAi","onDoRotate",2,params);
それはうまくいきますが、それが美しくないことはわかっています。C/C++ を深く理解していないため、おそらく役に立たないでしょう。
(完全なスレッドはこちら: http://www.stonetrip.com/developer/forum/viewtopic.php?p=29073#p29073 )