mirror of
https://github.com/thes3m/XNI
synced 2024-12-26 13:26:06 +01:00
Fixed bug where Event would crash if delegate was removed during event raise.
Added Contains method to GameComponentCollection. Added Support for drawing triangle fans. Added gitignore.
This commit is contained in:
parent
8819987253
commit
c32f654678
BIN
Classes/.DS_Store
vendored
BIN
Classes/.DS_Store
vendored
Binary file not shown.
@ -25,5 +25,6 @@
|
||||
|
||||
- (void) addComponent:(id<IGameComponent>)component;
|
||||
- (void) removeComponent:(id<IGameComponent>)component;
|
||||
- (BOOL) contains:(id<IGameComponent>)component;
|
||||
|
||||
@end
|
||||
|
@ -33,6 +33,9 @@
|
||||
}
|
||||
|
||||
- (void) addComponent:(id<IGameComponent>)component {
|
||||
if ([components containsObject:component]) {
|
||||
NSLog(@"WARNING: Game component added twice:%@", component);
|
||||
}
|
||||
[components addObject:component];
|
||||
[componentAdded raiseWithSender:self
|
||||
eventArgs:[GameComponentCollectionEventArgs
|
||||
@ -46,6 +49,10 @@
|
||||
eventArgsWithGameComponent:component]];
|
||||
}
|
||||
|
||||
- (BOOL) contains:(id<IGameComponent>)component{
|
||||
return [components containsObject:component];
|
||||
}
|
||||
|
||||
- (NSUInteger) countByEnumeratingWithState:(NSFastEnumerationState *)state
|
||||
objects:(id *)stackbuf
|
||||
count:(NSUInteger)len {
|
||||
|
@ -58,7 +58,7 @@ static Guide *instance = nil;
|
||||
return [instance beginShowMessageBoxWithTitle:title text:text buttons:buttons focusButton:focusButton icon:icon callback:callback state:state];
|
||||
}
|
||||
|
||||
+ (NSNumber *) endShowMessageBox:(id <IAsyncResult>)result {
|
||||
+ (NSNumber*) endShowMessageBox:(id <IAsyncResult>)result {
|
||||
return [instance endShowMessageBox:result];
|
||||
}
|
||||
|
||||
|
@ -193,6 +193,8 @@
|
||||
|
||||
+ (int) getNumberOfVerticesForPrimitiveType:(PrimitiveType)primitiveType primitiveCount:(int)primitiveCount {
|
||||
switch (primitiveType) {
|
||||
case GL_TRIANGLE_FAN:
|
||||
return primitiveCount;
|
||||
case PrimitiveTypeLineStrip:
|
||||
return primitiveCount + 1;
|
||||
case PrimitiveTypeLineList:
|
||||
@ -586,6 +588,7 @@
|
||||
|
||||
// CHECK FRAME BUFFER STATUS HERE
|
||||
GLenum status = glCheckFramebufferStatusOES(GL_FRAMEBUFFER);
|
||||
|
||||
if(status != GL_FRAMEBUFFER_COMPLETE){
|
||||
NSLog(@"Error binding renderTarget");
|
||||
}
|
||||
|
@ -10,11 +10,18 @@
|
||||
|
||||
#import "System.h"
|
||||
|
||||
@interface Event (){
|
||||
NSMutableArray *tempEvents;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@implementation Event
|
||||
|
||||
- (id) init {
|
||||
if (self = [super init]) {
|
||||
delegates = [[NSMutableArray alloc] init];
|
||||
tempEvents = [[NSMutableArray alloc] init];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
@ -33,13 +40,16 @@
|
||||
}
|
||||
|
||||
- (void) raiseWithSender:(id)sender eventArgs:(EventArgs*)e {
|
||||
for (Delegate *delegate in delegates) {
|
||||
[tempEvents addObjectsFromArray:delegates];
|
||||
for (Delegate *delegate in tempEvents) {
|
||||
[delegate invokeWithArgument:sender argument:e];
|
||||
}
|
||||
[tempEvents removeAllObjects];
|
||||
}
|
||||
|
||||
- (void) dealloc {
|
||||
[delegates release];
|
||||
[tempEvents release];
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user