mirror of
https://github.com/thes3m/XNI
synced 2024-12-26 13:26:06 +01:00
Changes:
- 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:
parent
63ea4cf7e3
commit
0b5b46e937
@ -9,9 +9,16 @@
|
|||||||
#import "SamplerStateCollection.h"
|
#import "SamplerStateCollection.h"
|
||||||
#import "SamplerStateCollection+Internal.h"
|
#import "SamplerStateCollection+Internal.h"
|
||||||
#import "XniSamplerEventArgs.h"
|
#import "XniSamplerEventArgs.h"
|
||||||
|
#import "XniSamplerEventArgs+Internal.h"
|
||||||
#import "Retronator.Xni.Framework.Graphics.h"
|
#import "Retronator.Xni.Framework.Graphics.h"
|
||||||
|
|
||||||
|
|
||||||
|
@interface SamplerStateCollection (){
|
||||||
|
XniSamplerEventArgs *eventArgs;
|
||||||
|
}
|
||||||
|
|
||||||
|
@end
|
||||||
|
|
||||||
@implementation SamplerStateCollection
|
@implementation SamplerStateCollection
|
||||||
|
|
||||||
- (id) init
|
- (id) init
|
||||||
@ -21,6 +28,7 @@
|
|||||||
for (int i = 0; i < GL_MAX_TEXTURE_UNITS; i++) {
|
for (int i = 0; i < GL_MAX_TEXTURE_UNITS; i++) {
|
||||||
samplerStates[i] = nil;
|
samplerStates[i] = nil;
|
||||||
}
|
}
|
||||||
|
eventArgs = [[XniSamplerEventArgs alloc] initWithSamplerIndex:0];
|
||||||
samplerStateChanged = [[Event alloc] init];
|
samplerStateChanged = [[Event alloc] init];
|
||||||
}
|
}
|
||||||
return self;
|
return self;
|
||||||
@ -37,12 +45,14 @@
|
|||||||
- (void)setItem:(SamplerState*)item atIndex:(NSUInteger)index {
|
- (void)setItem:(SamplerState*)item atIndex:(NSUInteger)index {
|
||||||
if (samplerStates[index] != item) {
|
if (samplerStates[index] != item) {
|
||||||
samplerStates[index] = item;
|
samplerStates[index] = item;
|
||||||
[samplerStateChanged raiseWithSender:self eventArgs:[XniSamplerEventArgs eventArgsWithSamplerIndex:index]];
|
eventArgs.samplerIndex = index;
|
||||||
|
[samplerStateChanged raiseWithSender:self eventArgs:eventArgs];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) dealloc
|
- (void) dealloc
|
||||||
{
|
{
|
||||||
|
[eventArgs release];
|
||||||
[samplerStateChanged release];
|
[samplerStateChanged release];
|
||||||
[super dealloc];
|
[super dealloc];
|
||||||
}
|
}
|
||||||
|
@ -77,7 +77,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!result && defaultCharacter) {
|
if (!result && defaultCharacter) {
|
||||||
result = [characterMapD objectForKey:[NSNumber numberWithUnsignedChar:character]];
|
result = [characterMapD objectForKey:defaultCharacter];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!result) {
|
if (!result) {
|
||||||
|
@ -9,6 +9,8 @@
|
|||||||
#import "Texture2D.h"
|
#import "Texture2D.h"
|
||||||
#import <UIKit/UIKit.h>
|
#import <UIKit/UIKit.h>
|
||||||
|
|
||||||
|
#import <OpenGLES/ES1/glext.h>
|
||||||
|
|
||||||
#import "Retronator.Xni.Framework.h"
|
#import "Retronator.Xni.Framework.h"
|
||||||
#import "Retronator.Xni.Framework.Graphics.h"
|
#import "Retronator.Xni.Framework.Graphics.h"
|
||||||
#import "Retronator.Xni.Framework.Content.Pipeline.Graphics.h"
|
#import "Retronator.Xni.Framework.Content.Pipeline.Graphics.h"
|
||||||
|
@ -9,9 +9,16 @@
|
|||||||
#import "TextureCollection.h"
|
#import "TextureCollection.h"
|
||||||
#import "TextureCollection+Internal.h"
|
#import "TextureCollection+Internal.h"
|
||||||
#import "XniSamplerEventArgs.h"
|
#import "XniSamplerEventArgs.h"
|
||||||
|
#import "XniSamplerEventArgs+Internal.h"
|
||||||
|
|
||||||
#import "Retronator.Xni.Framework.Graphics.h"
|
#import "Retronator.Xni.Framework.Graphics.h"
|
||||||
|
|
||||||
|
@interface TextureCollection (){
|
||||||
|
XniSamplerEventArgs *eventArgs;
|
||||||
|
}
|
||||||
|
|
||||||
|
@end
|
||||||
|
|
||||||
@implementation TextureCollection
|
@implementation TextureCollection
|
||||||
|
|
||||||
- (id) init
|
- (id) init
|
||||||
@ -21,6 +28,7 @@
|
|||||||
for (int i = 0; i < GL_MAX_TEXTURE_UNITS; i++) {
|
for (int i = 0; i < GL_MAX_TEXTURE_UNITS; i++) {
|
||||||
textures[i] = nil;
|
textures[i] = nil;
|
||||||
}
|
}
|
||||||
|
eventArgs = [[XniSamplerEventArgs alloc] initWithSamplerIndex:0];
|
||||||
textureChanged = [[Event alloc] init];
|
textureChanged = [[Event alloc] init];
|
||||||
}
|
}
|
||||||
return self;
|
return self;
|
||||||
@ -37,12 +45,14 @@
|
|||||||
- (void)setItem:(Texture*)item atIndex:(NSUInteger)index {
|
- (void)setItem:(Texture*)item atIndex:(NSUInteger)index {
|
||||||
if (textures[index] != item) {
|
if (textures[index] != item) {
|
||||||
textures[index] = item;
|
textures[index] = item;
|
||||||
[textureChanged raiseWithSender:self eventArgs:[XniSamplerEventArgs eventArgsWithSamplerIndex:index]];
|
eventArgs.samplerIndex = index;
|
||||||
|
[textureChanged raiseWithSender:self eventArgs:eventArgs];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) dealloc
|
- (void) dealloc
|
||||||
{
|
{
|
||||||
|
[eventArgs release];
|
||||||
[textureChanged release];
|
[textureChanged release];
|
||||||
[super dealloc];
|
[super dealloc];
|
||||||
}
|
}
|
||||||
|
@ -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
|
@ -7,7 +7,13 @@
|
|||||||
//
|
//
|
||||||
|
|
||||||
#import "XniSamplerEventArgs.h"
|
#import "XniSamplerEventArgs.h"
|
||||||
|
#import "XniSamplerEventArgs+Internal.h"
|
||||||
|
|
||||||
|
@interface XniSamplerEventArgs ()
|
||||||
|
|
||||||
|
@property (nonatomic, readwrite) int samplerIndex;
|
||||||
|
|
||||||
|
@end
|
||||||
|
|
||||||
@implementation XniSamplerEventArgs
|
@implementation XniSamplerEventArgs
|
||||||
|
|
||||||
|
@ -766,6 +766,7 @@
|
|||||||
/* End PBXBuildFile section */
|
/* End PBXBuildFile section */
|
||||||
|
|
||||||
/* Begin PBXFileReference 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>"; };
|
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>"; };
|
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>"; };
|
25AE5D5215F5440B00B73D10 /* RenderTarget2D.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RenderTarget2D.m; sourceTree = "<group>"; };
|
||||||
@ -1585,6 +1586,7 @@
|
|||||||
B5E78B6C12429B1A00DDD99A /* SamplerState.h */,
|
B5E78B6C12429B1A00DDD99A /* SamplerState.h */,
|
||||||
B5E78B6D12429B1A00DDD99A /* SamplerState.m */,
|
B5E78B6D12429B1A00DDD99A /* SamplerState.m */,
|
||||||
B5F415DC127781D80012BAF1 /* XniSamplerEventArgs.h */,
|
B5F415DC127781D80012BAF1 /* XniSamplerEventArgs.h */,
|
||||||
|
254CE83E162C0F2900A27E7C /* XniSamplerEventArgs+Internal.h */,
|
||||||
B5F415DD127781D80012BAF1 /* XniSamplerEventArgs.m */,
|
B5F415DD127781D80012BAF1 /* XniSamplerEventArgs.m */,
|
||||||
B5BBC1DE1248D5640066F5ED /* SamplerStateCollection.h */,
|
B5BBC1DE1248D5640066F5ED /* SamplerStateCollection.h */,
|
||||||
B5F415CD127781340012BAF1 /* SamplerStateCollection+Internal.h */,
|
B5F415CD127781340012BAF1 /* SamplerStateCollection+Internal.h */,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user