1
0
mirror of https://github.com/thes3m/XNI synced 2024-12-26 13:26:06 +01:00
XNI/Classes/Retronator/Xni/Framework/GameComponentCollection.m
Matej Jan fbfd1e7ab6 Adding game host and game classes.
git-svn-id: http://xni.googlecode.com/svn/XNI@8 ac433895-eea3-a490-d80a-17149a75e588
2010-07-27 13:42:07 +00:00

56 lines
1.4 KiB
Objective-C

//
// GameComponentCollection.m
// XNI
//
// Created by Matej Jan on 27.7.10.
// Copyright 2010 Retronator. All rights reserved.
//
#import "GameComponentCollection.h"
#import "Retronator.Xni.Framework.h"
@implementation GameComponentCollection
- (id) init {
if (self = [super init]) {
components = [[NSMutableArray alloc] init];
componentAdded = [[Event alloc] init];
componentRemoved = [[Event alloc] init];
}
return self;
}
@synthesize componentAdded;
@synthesize componentRemoved;
- (void) addComponent:(id<IGameComponent>)component {
[components addObject:component];
[componentAdded raiseWithSender:self
eventArgs:[GameComponentCollectionEventArgs
eventArgsWithGameComponent:component]];
}
- (void) removeComponent:(id<IGameComponent>)component {
[components removeObject:component];
[componentRemoved raiseWithSender:self
eventArgs:[GameComponentCollectionEventArgs
eventArgsWithGameComponent:component]];
}
- (NSUInteger) countByEnumeratingWithState:(NSFastEnumerationState *)state
objects:(id *)stackbuf
count:(NSUInteger)len {
return [components countByEnumeratingWithState:state objects:stackbuf count:len];
}
- (void) dealloc
{
[components release];
[componentAdded release];
[componentRemoved release];
[super dealloc];
}
@end