mirror of
https://github.com/thes3m/XNI
synced 2024-12-26 13:26:06 +01:00
- optimization for allocations - fixed sprite font default character that was not taken into consideration git-svn-id: http://xni.googlecode.com/svn/XNI@122 ac433895-eea3-a490-d80a-17149a75e588
61 lines
1.1 KiB
Objective-C
61 lines
1.1 KiB
Objective-C
//
|
|
// TextureCollection.m
|
|
// XNI
|
|
//
|
|
// Created by Matej Jan on 21.9.10.
|
|
// Copyright 2010 Retronator. All rights reserved.
|
|
//
|
|
|
|
#import "TextureCollection.h"
|
|
#import "TextureCollection+Internal.h"
|
|
#import "XniSamplerEventArgs.h"
|
|
#import "XniSamplerEventArgs+Internal.h"
|
|
|
|
#import "Retronator.Xni.Framework.Graphics.h"
|
|
|
|
@interface TextureCollection (){
|
|
XniSamplerEventArgs *eventArgs;
|
|
}
|
|
|
|
@end
|
|
|
|
@implementation TextureCollection
|
|
|
|
- (id) init
|
|
{
|
|
self = [super init];
|
|
if (self != nil) {
|
|
for (int i = 0; i < GL_MAX_TEXTURE_UNITS; i++) {
|
|
textures[i] = nil;
|
|
}
|
|
eventArgs = [[XniSamplerEventArgs alloc] initWithSamplerIndex:0];
|
|
textureChanged = [[Event alloc] init];
|
|
}
|
|
return self;
|
|
}
|
|
|
|
- (Event *) textureChanged {
|
|
return textureChanged;
|
|
}
|
|
|
|
- (Texture*)itemAtIndex:(NSUInteger)index {
|
|
return textures[index];
|
|
}
|
|
|
|
- (void)setItem:(Texture*)item atIndex:(NSUInteger)index {
|
|
if (textures[index] != item) {
|
|
textures[index] = item;
|
|
eventArgs.samplerIndex = index;
|
|
[textureChanged raiseWithSender:self eventArgs:eventArgs];
|
|
}
|
|
}
|
|
|
|
- (void) dealloc
|
|
{
|
|
[eventArgs release];
|
|
[textureChanged release];
|
|
[super dealloc];
|
|
}
|
|
|
|
@end
|