I'm writing a simple game, and thought it would be much easier to use structures. However, I can't declare methods that need the structs.
How could I use a struct as an argument to an Objective-C method and get an object of the struct returned?
//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;
Copyright Notice:Content Author:「DuskFall」,Reproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/10462880/using-struct-with-objective-c-methods