私は単純なゲームを書いていますが、構造を使用する方がはるかに簡単だと思いました。ただし、構造体を必要とするメソッドを宣言することはできません。
Objective-C メソッドの引数として構造体を使用し、返された構造体のオブジェクトを取得するにはどうすればよいですか?
//my structure in the .h file
struct Entity
{
int entityX;
int entityY;
int entityLength;
int entityWidth;
int entityType;
bool isDead;
};
//And the methods i'm trying to use
-(BOOL)detectCollisionBetweenEntity:Entity ent1 andEntity:Entity ent2;
-(struct Entity)createEntityWithX:int newEntityX andY:int newEntityY, withType:int newEntityType withWidth:int newEntityWidth andLength:int newEntityLength;