1
0
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
This commit is contained in:
Samo Pajk 2012-10-15 15:01:36 +00:00
parent 63ea4cf7e3
commit 0b5b46e937
7 changed files with 47 additions and 4 deletions

View File

@ -9,9 +9,16 @@
#import "SamplerStateCollection.h"
#import "SamplerStateCollection+Internal.h"
#import "XniSamplerEventArgs.h"
#import "XniSamplerEventArgs+Internal.h"
#import "Retronator.Xni.Framework.Graphics.h"
@interface SamplerStateCollection (){
XniSamplerEventArgs *eventArgs;
}
@end
@implementation SamplerStateCollection
- (id) init
@ -21,6 +28,7 @@
for (int i = 0; i < GL_MAX_TEXTURE_UNITS; i++) {
samplerStates[i] = nil;
}
eventArgs = [[XniSamplerEventArgs alloc] initWithSamplerIndex:0];
samplerStateChanged = [[Event alloc] init];
}
return self;
@ -37,12 +45,14 @@
- (void)setItem:(SamplerState*)item atIndex:(NSUInteger)index {
if (samplerStates[index] != item) {
samplerStates[index] = item;
[samplerStateChanged raiseWithSender:self eventArgs:[XniSamplerEventArgs eventArgsWithSamplerIndex:index]];
eventArgs.samplerIndex = index;
[samplerStateChanged raiseWithSender:self eventArgs:eventArgs];
}
}
- (void) dealloc
{
[eventArgs release];
[samplerStateChanged release];
[super dealloc];
}

View File

@ -77,7 +77,7 @@
}
if (!result && defaultCharacter) {
result = [characterMapD objectForKey:[NSNumber numberWithUnsignedChar:character]];
result = [characterMapD objectForKey:defaultCharacter];
}
if (!result) {

View File

@ -9,6 +9,8 @@
#import "Texture2D.h"
#import <UIKit/UIKit.h>
#import <OpenGLES/ES1/glext.h>
#import "Retronator.Xni.Framework.h"
#import "Retronator.Xni.Framework.Graphics.h"
#import "Retronator.Xni.Framework.Content.Pipeline.Graphics.h"

View File

@ -9,9 +9,16 @@
#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
@ -21,6 +28,7 @@
for (int i = 0; i < GL_MAX_TEXTURE_UNITS; i++) {
textures[i] = nil;
}
eventArgs = [[XniSamplerEventArgs alloc] initWithSamplerIndex:0];
textureChanged = [[Event alloc] init];
}
return self;
@ -37,12 +45,14 @@
- (void)setItem:(Texture*)item atIndex:(NSUInteger)index {
if (textures[index] != item) {
textures[index] = item;
[textureChanged raiseWithSender:self eventArgs:[XniSamplerEventArgs eventArgsWithSamplerIndex:index]];
eventArgs.samplerIndex = index;
[textureChanged raiseWithSender:self eventArgs:eventArgs];
}
}
- (void) dealloc
{
[eventArgs release];
[textureChanged release];
[super dealloc];
}

View File

@ -0,0 +1,13 @@
//
// XniSamplerEventArgs+Internal.h
// XNI
//
// Created by Samo Pajk on 10/15/12.
// Copyright (c) 2012 Retronator. All rights reserved.
//
@interface XniSamplerEventArgs (Internal)
@property (nonatomic, readwrite) int samplerIndex;
@end

View File

@ -7,7 +7,13 @@
//
#import "XniSamplerEventArgs.h"
#import "XniSamplerEventArgs+Internal.h"
@interface XniSamplerEventArgs ()
@property (nonatomic, readwrite) int samplerIndex;
@end
@implementation XniSamplerEventArgs

View File

@ -766,6 +766,7 @@
/* End PBXBuildFile section */
/* Begin PBXFileReference section */
254CE83E162C0F2900A27E7C /* XniSamplerEventArgs+Internal.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "XniSamplerEventArgs+Internal.h"; sourceTree = "<group>"; };
25A980CC15F92763005F1A78 /* RenderTarget2D+Internal.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "RenderTarget2D+Internal.h"; sourceTree = "<group>"; };
25AE5D5115F5440B00B73D10 /* RenderTarget2D.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RenderTarget2D.h; sourceTree = "<group>"; };
25AE5D5215F5440B00B73D10 /* RenderTarget2D.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RenderTarget2D.m; sourceTree = "<group>"; };
@ -1585,6 +1586,7 @@
B5E78B6C12429B1A00DDD99A /* SamplerState.h */,
B5E78B6D12429B1A00DDD99A /* SamplerState.m */,
B5F415DC127781D80012BAF1 /* XniSamplerEventArgs.h */,
254CE83E162C0F2900A27E7C /* XniSamplerEventArgs+Internal.h */,
B5F415DD127781D80012BAF1 /* XniSamplerEventArgs.m */,
B5BBC1DE1248D5640066F5ED /* SamplerStateCollection.h */,
B5F415CD127781340012BAF1 /* SamplerStateCollection+Internal.h */,