mirror of
https://github.com/thes3m/XNI
synced 2024-12-26 13:26:06 +01:00
Changes:
- added render to texture features (RenderTarget2D) - optimized SpriteFont for faster access and allocations - fixed iOS6 bug witch prevented proper device orientation - fixed some problems when handling touch events git-svn-id: http://xni.googlecode.com/svn/XNI@112 ac433895-eea3-a490-d80a-17149a75e588
This commit is contained in:
parent
0e8b503f06
commit
a2ab2a84e5
@ -179,6 +179,10 @@
|
|||||||
[loadedAssets removeAllObjects];
|
[loadedAssets removeAllObjects];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
-(NSString*)description{
|
||||||
|
return [NSString stringWithFormat:@"%@ withAssets:%@",[super description],loadedAssets];
|
||||||
|
}
|
||||||
|
|
||||||
- (void) dealloc
|
- (void) dealloc
|
||||||
{
|
{
|
||||||
[loadedAssets release];
|
[loadedAssets release];
|
||||||
|
@ -84,7 +84,7 @@ static NSArray *drawOrderSort;
|
|||||||
[Guide initializeWithGame:self];
|
[Guide initializeWithGame:self];
|
||||||
|
|
||||||
// Get the game host.
|
// Get the game host.
|
||||||
gameHost = (GameHost*)[UIApplication sharedApplication];
|
gameHost = (GameHost*)[UIApplication sharedApplication];
|
||||||
}
|
}
|
||||||
|
|
||||||
return self;
|
return self;
|
||||||
@ -286,7 +286,6 @@ static NSArray *drawOrderSort;
|
|||||||
|
|
||||||
- (void) endRun {}
|
- (void) endRun {}
|
||||||
|
|
||||||
|
|
||||||
// Internal methods
|
// Internal methods
|
||||||
|
|
||||||
- (void) presentModalViewController:(UIViewController*)viewController {
|
- (void) presentModalViewController:(UIViewController*)viewController {
|
||||||
@ -407,6 +406,7 @@ static NSArray *drawOrderSort;
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
- (void) dealloc
|
- (void) dealloc
|
||||||
{
|
{
|
||||||
[disposed raiseWithSender:self];
|
[disposed raiseWithSender:self];
|
||||||
|
@ -78,7 +78,8 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)loadView {
|
- (void)loadView {
|
||||||
|
[super loadView];
|
||||||
GameView *gameView = [[GameView alloc] initWithFrame:[UIScreen mainScreen].applicationFrame];
|
GameView *gameView = [[GameView alloc] initWithFrame:[UIScreen mainScreen].applicationFrame];
|
||||||
self.view = gameView;
|
self.view = gameView;
|
||||||
|
|
||||||
@ -116,18 +117,22 @@
|
|||||||
|
|
||||||
- (void) touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
|
- (void) touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
|
||||||
[[TouchPanel getInstance] touchesBegan:touches withEvent:event];
|
[[TouchPanel getInstance] touchesBegan:touches withEvent:event];
|
||||||
|
[super touchesBegan:touches withEvent:event];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event {
|
- (void) touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event {
|
||||||
[[TouchPanel getInstance] touchesMoved:touches withEvent:event];
|
[[TouchPanel getInstance] touchesMoved:touches withEvent:event];
|
||||||
|
[super touchesMoved:touches withEvent:event];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event {
|
- (void) touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event {
|
||||||
[[TouchPanel getInstance] touchesEnded:touches withEvent:event];
|
[[TouchPanel getInstance] touchesEnded:touches withEvent:event];
|
||||||
|
[super touchesEnded:touches withEvent:event];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event {
|
- (void) touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event {
|
||||||
[[TouchPanel getInstance] touchesCancelled:touches withEvent:event];
|
[[TouchPanel getInstance] touchesCancelled:touches withEvent:event];
|
||||||
|
[super touchesCancelled:touches withEvent:event];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)dealloc {
|
- (void)dealloc {
|
||||||
|
@ -123,6 +123,7 @@
|
|||||||
|
|
||||||
// Add the game view to the window.
|
// Add the game view to the window.
|
||||||
[window addSubview: gameViewController.view];
|
[window addSubview: gameViewController.view];
|
||||||
|
window.rootViewController = gameViewController;
|
||||||
|
|
||||||
// Report view to TouchPanel.
|
// Report view to TouchPanel.
|
||||||
[[TouchPanel getInstance] setView:gameViewController.gameView];
|
[[TouchPanel getInstance] setView:gameViewController.gameView];
|
||||||
|
@ -123,8 +123,7 @@ static Guide *instance = nil;
|
|||||||
isVisible = NO;
|
isVisible = NO;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) dealloc
|
- (void) dealloc {
|
||||||
{
|
|
||||||
[messageBoxResults release];
|
[messageBoxResults release];
|
||||||
[super dealloc];
|
[super dealloc];
|
||||||
}
|
}
|
||||||
|
@ -12,6 +12,8 @@
|
|||||||
|
|
||||||
@interface GraphicsDevice (Internal)
|
@interface GraphicsDevice (Internal)
|
||||||
|
|
||||||
|
@property (nonatomic) BOOL rrt;
|
||||||
|
|
||||||
- (uint) createTexture;
|
- (uint) createTexture;
|
||||||
- (void) releaseTexture:(uint)textureId;
|
- (void) releaseTexture:(uint)textureId;
|
||||||
|
|
||||||
|
@ -83,6 +83,10 @@
|
|||||||
- (void) setVertexBuffer:(VertexBuffer*)vertexBuffer vertexOffset:(int)vertexOffset;
|
- (void) setVertexBuffer:(VertexBuffer*)vertexBuffer vertexOffset:(int)vertexOffset;
|
||||||
- (void) setVertexBuffers:(VertexBufferBinding*)vertexBuffer, ... NS_REQUIRES_NIL_TERMINATION;
|
- (void) setVertexBuffers:(VertexBufferBinding*)vertexBuffer, ... NS_REQUIRES_NIL_TERMINATION;
|
||||||
|
|
||||||
|
//Render Targets
|
||||||
|
- (void) setRenderTarget:(RenderTarget2D*)renderTarget;
|
||||||
|
//- (RenderTarget2D*) getRenderTarget;
|
||||||
|
|
||||||
// Drawing
|
// Drawing
|
||||||
|
|
||||||
// From buffers
|
// From buffers
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
#import "GraphicsDevice.h"
|
#import "GraphicsDevice.h"
|
||||||
#import "GraphicsDevice+Internal.h"
|
#import "GraphicsDevice+Internal.h"
|
||||||
#import <OpenGLES/ES1/gl.h>
|
#import <OpenGLES/ES1/gl.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"
|
||||||
|
|
||||||
@ -18,8 +18,11 @@
|
|||||||
#import "SamplerStateCollection+Internal.h"
|
#import "SamplerStateCollection+Internal.h"
|
||||||
#import "IndexBuffer+Internal.h"
|
#import "IndexBuffer+Internal.h"
|
||||||
#import "VertexBuffer+Internal.h"
|
#import "VertexBuffer+Internal.h"
|
||||||
|
#import "RenderTarget2D+Internal.h"
|
||||||
|
|
||||||
@interface GraphicsDevice()
|
@interface GraphicsDevice(){
|
||||||
|
BOOL rrt;
|
||||||
|
}
|
||||||
|
|
||||||
+ (void) getFormat:(GLenum*)format AndType:(GLenum*)type ForSurfaceFormat:(SurfaceFormat)surfaceFormat;
|
+ (void) getFormat:(GLenum*)format AndType:(GLenum*)type ForSurfaceFormat:(SurfaceFormat)surfaceFormat;
|
||||||
- (void) setData:(void*)data size:(int)sizeInBytes toBufferId:(uint)buffer resourceType:(ResourceType)resourceType bufferUsage:(BufferUsage)bufferUsage;
|
- (void) setData:(void*)data size:(int)sizeInBytes toBufferId:(uint)buffer resourceType:(ResourceType)resourceType bufferUsage:(BufferUsage)bufferUsage;
|
||||||
@ -542,8 +545,70 @@
|
|||||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, magFilter);
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, magFilter);
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) dealloc
|
- (void) setRenderTarget:(RenderTarget2D*)renderTarget{
|
||||||
{
|
if (renderTarget == nil) {
|
||||||
|
if (rrt) {
|
||||||
|
//We had render target before now we have to flip it vertically
|
||||||
|
rrt = NO;
|
||||||
|
}
|
||||||
|
glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_RENDERBUFFER, colorRenderbuffer);
|
||||||
|
}else{
|
||||||
|
GLuint rtFramebuffer = [renderTarget colorFramebuffer];
|
||||||
|
GLuint rtRenderbuffer = [renderTarget colorRenderbuffer];
|
||||||
|
|
||||||
|
GLenum format, type;
|
||||||
|
[GraphicsDevice getFormat:&format AndType:&type ForSurfaceFormat:renderTarget.format];
|
||||||
|
|
||||||
|
// RENDER TO TEXTURE BUFFER
|
||||||
|
// This is the buffer we will be rendering to and using as a texture
|
||||||
|
// on out screen plane
|
||||||
|
glBindFramebufferOES(GL_FRAMEBUFFER_OES, rtFramebuffer);
|
||||||
|
|
||||||
|
// glBindRenderbufferOES(GL_RENDERBUFFER_OES, rtRenderbuffer);
|
||||||
|
//
|
||||||
|
// glBindRenderbufferOES(GL_RENDERBUFFER_OES, depthRenderbuffer);
|
||||||
|
// glRenderbufferStorageOES(GL_RENDERBUFFER_OES, GL_DEPTH_COMPONENT16_OES, renderTarget.width, renderTarget.height);
|
||||||
|
// glFramebufferRenderbufferOES(GL_FRAMEBUFFER_OES, GL_DEPTH_ATTACHMENT_OES, GL_RENDERBUFFER_OES, depthRenderbuffer);
|
||||||
|
|
||||||
|
// create the texture object
|
||||||
|
glBindTexture(GL_TEXTURE_2D, renderTarget.textureId);
|
||||||
|
|
||||||
|
// set the texture parameter filtering (feel free to use other TexParams)
|
||||||
|
// you have to do this, forgetting to do this will make it not work.
|
||||||
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER,GL_LINEAR);
|
||||||
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER,GL_LINEAR);
|
||||||
|
|
||||||
|
|
||||||
|
// fill the texture data (the max texture size needs to be power of 2)
|
||||||
|
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, renderTarget.width, renderTarget.height, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);
|
||||||
|
|
||||||
|
// attach the frameBuffer to the texture object
|
||||||
|
glFramebufferTexture2DOES(GL_FRAMEBUFFER_OES, GL_COLOR_ATTACHMENT0_OES, GL_TEXTURE_2D, renderTarget.textureId, 0);
|
||||||
|
|
||||||
|
//glOrthof(0, renderTarget.width, renderTarget.height, 0, -1, 1);
|
||||||
|
|
||||||
|
// CHECK FRAME BUFFER STATUS HERE
|
||||||
|
|
||||||
|
|
||||||
|
// GLenum status = glCheckFramebufferStatusOES(GL_FRAMEBUFFER);
|
||||||
|
// if(status == GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT){
|
||||||
|
// NSLog(@"GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT");
|
||||||
|
// }else if(status == GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT){
|
||||||
|
// NSLog(@"GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT");
|
||||||
|
// }else if(status == GL_FRAMEBUFFER_UNSUPPORTED){
|
||||||
|
// NSLog(@"GL_FRAMEBUFFER_UNSUPPORTED");
|
||||||
|
// }else if(status == GL_FRAMEBUFFER_COMPLETE){
|
||||||
|
// NSLog(@"GL_FRAMEBUFFER_COMPLETE");
|
||||||
|
// }
|
||||||
|
rrt = YES;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
- (RenderTarget2D*) getRenderTarget{
|
||||||
|
return nil;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void) dealloc{
|
||||||
[blendState release];
|
[blendState release];
|
||||||
[depthStencilState release];
|
[depthStencilState release];
|
||||||
[rasterizerState release];
|
[rasterizerState release];
|
||||||
|
@ -0,0 +1,17 @@
|
|||||||
|
//
|
||||||
|
// RenderTarget2D+Internal.h
|
||||||
|
// XNI
|
||||||
|
//
|
||||||
|
// Created by Samo Pajk on 9/6/12.
|
||||||
|
// Copyright (c) 2012 Retronator. All rights reserved.
|
||||||
|
//
|
||||||
|
|
||||||
|
#import <Foundation/Foundation.h>
|
||||||
|
|
||||||
|
@interface RenderTarget2D (Internal)
|
||||||
|
|
||||||
|
- (GLuint) colorFramebuffer;
|
||||||
|
|
||||||
|
- (GLuint) colorRenderbuffer;
|
||||||
|
|
||||||
|
@end
|
25
Classes/Retronator/Xni/Framework/Graphics/RenderTarget2D.h
Normal file
25
Classes/Retronator/Xni/Framework/Graphics/RenderTarget2D.h
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
//
|
||||||
|
// RenderTarget2D.h
|
||||||
|
// XNI
|
||||||
|
//
|
||||||
|
// Created by Samo Pajk on 9/3/12.
|
||||||
|
// Copyright (c) 2012 Samo Pajk. All rights reserved.
|
||||||
|
//
|
||||||
|
|
||||||
|
#import "Texture2D.h"
|
||||||
|
|
||||||
|
@interface RenderTarget2D : Texture2D
|
||||||
|
|
||||||
|
@property (nonatomic, readonly) BOOL isContentLost;
|
||||||
|
@property (nonatomic, readonly) RenderTargetUsage renderTargetUsage;
|
||||||
|
|
||||||
|
- (id)initWithGraphicsDevice:(GraphicsDevice *)theGraphicsDevice
|
||||||
|
width:(int)theWidth
|
||||||
|
height:(int)theHeight
|
||||||
|
mipmap:(BOOL)theMipmap
|
||||||
|
surfaceFormat:(SurfaceFormat)theSurfaceFormat
|
||||||
|
depthFormat:(DepthFormat)theDepthFormat
|
||||||
|
multiSampleCount:(int) theMultisampleCount
|
||||||
|
usage:(RenderTargetUsage)theUsage;
|
||||||
|
|
||||||
|
@end
|
67
Classes/Retronator/Xni/Framework/Graphics/RenderTarget2D.m
Normal file
67
Classes/Retronator/Xni/Framework/Graphics/RenderTarget2D.m
Normal file
@ -0,0 +1,67 @@
|
|||||||
|
//
|
||||||
|
// RenderTarget2D.m
|
||||||
|
// XNI
|
||||||
|
//
|
||||||
|
// Created by Samo Pajk on 9/3/12.
|
||||||
|
// Copyright (c) 2012 Samo Pajk. All rights reserved.
|
||||||
|
//
|
||||||
|
|
||||||
|
#import "RenderTarget2D.h"
|
||||||
|
#import "Retronator.Xni.Framework.h"
|
||||||
|
#import "Retronator.Xni.Framework.Graphics.h"
|
||||||
|
|
||||||
|
#import <QuartzCore/QuartzCore.h>
|
||||||
|
#import <OpenGLES/ES1/gl.h>
|
||||||
|
#import <OpenGLES/ES2/gl.h>
|
||||||
|
#import <OpenGLES/ES2/glext.h>
|
||||||
|
|
||||||
|
@interface RenderTarget2D (){
|
||||||
|
GLuint framebuffer;
|
||||||
|
GLuint renderBuffer;
|
||||||
|
}
|
||||||
|
|
||||||
|
@end
|
||||||
|
|
||||||
|
@implementation RenderTarget2D
|
||||||
|
|
||||||
|
- (id)initWithGraphicsDevice:(GraphicsDevice *)theGraphicsDevice
|
||||||
|
width:(int)theWidth
|
||||||
|
height:(int)theHeight
|
||||||
|
mipmap:(BOOL)theMipmap
|
||||||
|
surfaceFormat:(SurfaceFormat)theSurfaceFormat
|
||||||
|
depthFormat:(DepthFormat)theDepthFormat
|
||||||
|
multiSampleCount:(int) theMultisampleCount
|
||||||
|
usage:(RenderTargetUsage)theUsage{
|
||||||
|
|
||||||
|
self = [super initWithGraphicsDevice:theGraphicsDevice width:theWidth height:theHeight mipMaps:theMipmap format:theSurfaceFormat];
|
||||||
|
if (self) {
|
||||||
|
//Texture is already created by super object.
|
||||||
|
//Here we only create a framebuffer.
|
||||||
|
glGenFramebuffersOES(1, &framebuffer);
|
||||||
|
|
||||||
|
glGenRenderbuffersOES(1, &renderBuffer);
|
||||||
|
|
||||||
|
}
|
||||||
|
return self;
|
||||||
|
}
|
||||||
|
|
||||||
|
@synthesize renderTargetUsage, isContentLost;
|
||||||
|
|
||||||
|
-(GLuint) colorFramebuffer{
|
||||||
|
return framebuffer;
|
||||||
|
}
|
||||||
|
|
||||||
|
-(GLuint) colorRenderbuffer{
|
||||||
|
return renderBuffer;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)dealloc{
|
||||||
|
glDeleteFramebuffers(1, &framebuffer);
|
||||||
|
[super dealloc];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void) saveAsPng:(NSData*)textureData width:(int)width height:(int)height{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@end
|
@ -1,6 +1,6 @@
|
|||||||
#import "GraphicsEnums.h"
|
#import "GraphicsEnums.h"
|
||||||
|
|
||||||
@class GraphicsResource, Texture, Texture2D, Effect, EffectTechnique, EffectPass, BasicEffect, DirectionalLight;
|
@class GraphicsResource, Texture, Texture2D, RenderTarget2D, Effect, EffectTechnique, EffectPass, BasicEffect, DirectionalLight;
|
||||||
|
|
||||||
#import "VertexStructs.h"
|
#import "VertexStructs.h"
|
||||||
@class VertexElement, VertexPositionColor, VertexPositionTexture, VertexPositionColorTexture, VertexPositionNormalTexture, VertexDeclaration;
|
@class VertexElement, VertexPositionColor, VertexPositionTexture, VertexPositionColorTexture, VertexPositionNormalTexture, VertexDeclaration;
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
#import "GraphicsResource.h"
|
#import "GraphicsResource.h"
|
||||||
#import "Texture.h"
|
#import "Texture.h"
|
||||||
#import "Texture2D.h"
|
#import "Texture2D.h"
|
||||||
|
#import "RenderTarget2D.h"
|
||||||
#import "Effect.h"
|
#import "Effect.h"
|
||||||
#import "EffectTechnique.h"
|
#import "EffectTechnique.h"
|
||||||
#import "EffectPass.h"
|
#import "EffectPass.h"
|
||||||
|
@ -52,6 +52,8 @@ typedef struct {
|
|||||||
static NSArray *textureSort;
|
static NSArray *textureSort;
|
||||||
static NSArray *frontToBackSort;
|
static NSArray *frontToBackSort;
|
||||||
static NSArray *backToFrontSort;
|
static NSArray *backToFrontSort;
|
||||||
|
static Vector2 *currentOrigin;
|
||||||
|
static Vector2 *characterOrigin;
|
||||||
|
|
||||||
static inline void SpriteSetSource(XniSprite *sprite, Rectangle *source, Texture2D *texture, SpriteEffects effects) {
|
static inline void SpriteSetSource(XniSprite *sprite, Rectangle *source, Texture2D *texture, SpriteEffects effects) {
|
||||||
if (source) {
|
if (source) {
|
||||||
@ -187,6 +189,9 @@ static VertexPositionColorTextureStruct vertices[4];
|
|||||||
backToFrontSort = [[NSArray arrayWithObject:depthDescendingSortDescriptor] retain];
|
backToFrontSort = [[NSArray arrayWithObject:depthDescendingSortDescriptor] retain];
|
||||||
|
|
||||||
spritePool = [[XniAdaptiveArray alloc] initWithItemSize:sizeof(XniSprite*) initialCapacity:64];
|
spritePool = [[XniAdaptiveArray alloc] initWithItemSize:sizeof(XniSprite*) initialCapacity:64];
|
||||||
|
|
||||||
|
currentOrigin = [[Vector2 alloc] init];
|
||||||
|
characterOrigin = [[Vector2 alloc] init];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) setProjection {
|
- (void) setProjection {
|
||||||
@ -346,8 +351,10 @@ static VertexPositionColorTextureStruct vertices[4];
|
|||||||
- (void) drawStringWithSpriteFont:(SpriteFont*)spriteFont text:(NSString*)text to:(Vector2*)position tintWithColor:(Color*)color
|
- (void) drawStringWithSpriteFont:(SpriteFont*)spriteFont text:(NSString*)text to:(Vector2*)position tintWithColor:(Color*)color
|
||||||
rotation:(float)rotation origin:(Vector2*)origin scale:(Vector2*)scale effects:(SpriteEffects)effects layerDepth:(float)layerDepth {
|
rotation:(float)rotation origin:(Vector2*)origin scale:(Vector2*)scale effects:(SpriteEffects)effects layerDepth:(float)layerDepth {
|
||||||
|
|
||||||
Vector2 *currentOrigin = [Vector2 vectorWithX:origin.x y:origin.y-spriteFont.lineSpacing];
|
currentOrigin.x = origin.x;
|
||||||
Vector2 *characterOrigin = [Vector2 zero];
|
currentOrigin.y = origin.y-spriteFont.lineSpacing;
|
||||||
|
characterOrigin.x = 0;
|
||||||
|
characterOrigin.y = 0;
|
||||||
|
|
||||||
for (int i = 0; i < [text length]; i++) {
|
for (int i = 0; i < [text length]; i++) {
|
||||||
unichar character = [text characterAtIndex:i];
|
unichar character = [text characterAtIndex:i];
|
||||||
@ -509,8 +516,7 @@ void draw(XniSprite *sprite, NSMutableArray *sprites, SpriteSortMode sortMode, S
|
|||||||
[vertexArray clear];
|
[vertexArray clear];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) dealloc
|
- (void) dealloc{
|
||||||
{
|
|
||||||
[self.graphicsDevice.deviceReset unsubscribeDelegate:[Delegate delegateWithTarget:self Method:@selector(setProjection)]];
|
[self.graphicsDevice.deviceReset unsubscribeDelegate:[Delegate delegateWithTarget:self Method:@selector(setProjection)]];
|
||||||
[basicEffect release];
|
[basicEffect release];
|
||||||
[sprites release];
|
[sprites release];
|
||||||
|
@ -19,7 +19,8 @@
|
|||||||
|
|
||||||
@private
|
@private
|
||||||
Texture2D *texture;
|
Texture2D *texture;
|
||||||
NSDictionary *characterMap;
|
Rectangle *characterMap[128];
|
||||||
|
NSDictionary *characterMapD;
|
||||||
}
|
}
|
||||||
|
|
||||||
@property (nonatomic, readonly) NSSet *characters;
|
@property (nonatomic, readonly) NSSet *characters;
|
||||||
|
@ -18,9 +18,15 @@
|
|||||||
self = [super init];
|
self = [super init];
|
||||||
if (self != nil) {
|
if (self != nil) {
|
||||||
texture = [theTexture retain];
|
texture = [theTexture retain];
|
||||||
characterMap = [theCharacterMap retain];
|
characterMapD = [theCharacterMap retain];
|
||||||
|
|
||||||
characters = [[NSSet alloc] initWithArray:[characterMap allKeys]];
|
//Array for fast access
|
||||||
|
for (int i = 0; i < 128; i++) {
|
||||||
|
Rectangle *rect = [theCharacterMap objectForKey:[NSNumber numberWithUnsignedShort:i]];
|
||||||
|
characterMap[i] = [rect retain];
|
||||||
|
}
|
||||||
|
|
||||||
|
characters = [[NSSet alloc] initWithArray:[theCharacterMap allKeys]];
|
||||||
|
|
||||||
lineSpacing = theLineSpacing;
|
lineSpacing = theLineSpacing;
|
||||||
}
|
}
|
||||||
@ -62,10 +68,16 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
- (Rectangle *) sourceRectangleForCharacter:(unichar)character {
|
- (Rectangle *) sourceRectangleForCharacter:(unichar)character {
|
||||||
Rectangle *result = [characterMap objectForKey:[NSNumber numberWithChar:character]];
|
Rectangle *result = nil;
|
||||||
|
|
||||||
|
if (character < 128) {
|
||||||
|
result = characterMap[character];
|
||||||
|
}else{
|
||||||
|
result = [characterMapD objectForKey:[NSNumber numberWithUnsignedChar:character]];
|
||||||
|
}
|
||||||
|
|
||||||
if (!result && defaultCharacter) {
|
if (!result && defaultCharacter) {
|
||||||
result = [characterMap objectForKey:defaultCharacter];
|
result = [characterMapD objectForKey:[NSNumber numberWithUnsignedChar:character]];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!result) {
|
if (!result) {
|
||||||
@ -75,12 +87,14 @@
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) dealloc
|
- (void) dealloc{
|
||||||
{
|
|
||||||
[characters release];
|
[characters release];
|
||||||
[defaultCharacter release];
|
[defaultCharacter release];
|
||||||
[texture release];
|
[texture release];
|
||||||
[characterMap release];
|
//[characterMap release];
|
||||||
|
for (int i = 0; i < 256; i++) {
|
||||||
|
[characterMap[i] release];
|
||||||
|
}
|
||||||
[super dealloc];
|
[super dealloc];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -114,7 +114,6 @@ static TouchPanel *instance;
|
|||||||
return [instance readGesture];
|
return [instance readGesture];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
+ (TouchPanel*) getInstance {
|
+ (TouchPanel*) getInstance {
|
||||||
return instance;
|
return instance;
|
||||||
}
|
}
|
||||||
|
@ -7,6 +7,10 @@
|
|||||||
objects = {
|
objects = {
|
||||||
|
|
||||||
/* Begin PBXBuildFile section */
|
/* Begin PBXBuildFile section */
|
||||||
|
25ACE63C15F735B700EB9C26 /* RenderTarget2D.h in Headers */ = {isa = PBXBuildFile; fileRef = 25AE5D5115F5440B00B73D10 /* RenderTarget2D.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||||
|
25AE5D5315F5440B00B73D10 /* RenderTarget2D.h in Headers */ = {isa = PBXBuildFile; fileRef = 25AE5D5115F5440B00B73D10 /* RenderTarget2D.h */; };
|
||||||
|
25AE5D5415F5440B00B73D10 /* RenderTarget2D.m in Sources */ = {isa = PBXBuildFile; fileRef = 25AE5D5215F5440B00B73D10 /* RenderTarget2D.m */; };
|
||||||
|
25B3F9E615F9CC0E00C7DF1E /* RenderTarget2D.m in Sources */ = {isa = PBXBuildFile; fileRef = 25AE5D5215F5440B00B73D10 /* RenderTarget2D.m */; };
|
||||||
AACBBE4A0F95108600F1A2B1 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = AACBBE490F95108600F1A2B1 /* Foundation.framework */; };
|
AACBBE4A0F95108600F1A2B1 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = AACBBE490F95108600F1A2B1 /* Foundation.framework */; };
|
||||||
B50769151264EE9500E4474F /* GameComponent.m in Sources */ = {isa = PBXBuildFile; fileRef = B50769131264EE9500E4474F /* GameComponent.m */; };
|
B50769151264EE9500E4474F /* GameComponent.m in Sources */ = {isa = PBXBuildFile; fileRef = B50769131264EE9500E4474F /* GameComponent.m */; };
|
||||||
B507691D1264EF0B00E4474F /* DrawableGameComponent.m in Sources */ = {isa = PBXBuildFile; fileRef = B507691B1264EF0B00E4474F /* DrawableGameComponent.m */; };
|
B507691D1264EF0B00E4474F /* DrawableGameComponent.m in Sources */ = {isa = PBXBuildFile; fileRef = B507691B1264EF0B00E4474F /* DrawableGameComponent.m */; };
|
||||||
@ -762,6 +766,9 @@
|
|||||||
/* End PBXBuildFile section */
|
/* End PBXBuildFile section */
|
||||||
|
|
||||||
/* Begin PBXFileReference section */
|
/* Begin PBXFileReference section */
|
||||||
|
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>"; };
|
||||||
AACBBE490F95108600F1A2B1 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; };
|
AACBBE490F95108600F1A2B1 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; };
|
||||||
B50769121264EE9500E4474F /* GameComponent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GameComponent.h; sourceTree = "<group>"; };
|
B50769121264EE9500E4474F /* GameComponent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GameComponent.h; sourceTree = "<group>"; };
|
||||||
B50769131264EE9500E4474F /* GameComponent.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GameComponent.m; sourceTree = "<group>"; };
|
B50769131264EE9500E4474F /* GameComponent.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GameComponent.m; sourceTree = "<group>"; };
|
||||||
@ -1501,6 +1508,9 @@
|
|||||||
B50806FE122E4ECF00C330E2 /* Texture.m */,
|
B50806FE122E4ECF00C330E2 /* Texture.m */,
|
||||||
B5080701122E4EE900C330E2 /* Texture2D.h */,
|
B5080701122E4EE900C330E2 /* Texture2D.h */,
|
||||||
B5080702122E4EE900C330E2 /* Texture2D.m */,
|
B5080702122E4EE900C330E2 /* Texture2D.m */,
|
||||||
|
25AE5D5115F5440B00B73D10 /* RenderTarget2D.h */,
|
||||||
|
25AE5D5215F5440B00B73D10 /* RenderTarget2D.m */,
|
||||||
|
25A980CC15F92763005F1A78 /* RenderTarget2D+Internal.h */,
|
||||||
B5E78B7812429BBD00DDD99A /* Effect.h */,
|
B5E78B7812429BBD00DDD99A /* Effect.h */,
|
||||||
B5E78B7912429BBD00DDD99A /* Effect.m */,
|
B5E78B7912429BBD00DDD99A /* Effect.m */,
|
||||||
B5EA65D5124952C9001245A4 /* EffectTechnique.h */,
|
B5EA65D5124952C9001245A4 /* EffectTechnique.h */,
|
||||||
@ -1800,6 +1810,7 @@
|
|||||||
files = (
|
files = (
|
||||||
B570A1A113E1DC3B0085E85E /* Retronator.Devices.Sensors.classes.h in Headers */,
|
B570A1A113E1DC3B0085E85E /* Retronator.Devices.Sensors.classes.h in Headers */,
|
||||||
B570A1A213E1DC3B0085E85E /* Retronator.Devices.Sensors.h in Headers */,
|
B570A1A213E1DC3B0085E85E /* Retronator.Devices.Sensors.h in Headers */,
|
||||||
|
25ACE63C15F735B700EB9C26 /* RenderTarget2D.h in Headers */,
|
||||||
B570A1A313E1DC3B0085E85E /* SensorsEnums.h in Headers */,
|
B570A1A313E1DC3B0085E85E /* SensorsEnums.h in Headers */,
|
||||||
B570A1A413E1DC3B0085E85E /* Accelerometer.h in Headers */,
|
B570A1A413E1DC3B0085E85E /* Accelerometer.h in Headers */,
|
||||||
B570A1A513E1DC3B0085E85E /* AccelerometerReadingEventArgs.h in Headers */,
|
B570A1A513E1DC3B0085E85E /* AccelerometerReadingEventArgs.h in Headers */,
|
||||||
@ -2235,6 +2246,7 @@
|
|||||||
B54E75551356241B007AD718 /* Collection.h in Headers */,
|
B54E75551356241B007AD718 /* Collection.h in Headers */,
|
||||||
B54E75561356241B007AD718 /* ReadOnlyCollection.h in Headers */,
|
B54E75561356241B007AD718 /* ReadOnlyCollection.h in Headers */,
|
||||||
B54E75571356241B007AD718 /* IAsyncResult.h in Headers */,
|
B54E75571356241B007AD718 /* IAsyncResult.h in Headers */,
|
||||||
|
25AE5D5315F5440B00B73D10 /* RenderTarget2D.h in Headers */,
|
||||||
);
|
);
|
||||||
runOnlyForDeploymentPostprocessing = 0;
|
runOnlyForDeploymentPostprocessing = 0;
|
||||||
};
|
};
|
||||||
@ -2347,6 +2359,7 @@
|
|||||||
B570A28A13E1DC3B0085E85E /* Color.m in Sources */,
|
B570A28A13E1DC3B0085E85E /* Color.m in Sources */,
|
||||||
B570A28B13E1DC3B0085E85E /* GraphicsDeviceManager.m in Sources */,
|
B570A28B13E1DC3B0085E85E /* GraphicsDeviceManager.m in Sources */,
|
||||||
B570A28C13E1DC3B0085E85E /* Texture.m in Sources */,
|
B570A28C13E1DC3B0085E85E /* Texture.m in Sources */,
|
||||||
|
25B3F9E615F9CC0E00C7DF1E /* RenderTarget2D.m in Sources */,
|
||||||
B570A28D13E1DC3B0085E85E /* Texture2D.m in Sources */,
|
B570A28D13E1DC3B0085E85E /* Texture2D.m in Sources */,
|
||||||
B570A28E13E1DC3B0085E85E /* GraphicsResource.m in Sources */,
|
B570A28E13E1DC3B0085E85E /* GraphicsResource.m in Sources */,
|
||||||
B570A28F13E1DC3B0085E85E /* ContentManager.m in Sources */,
|
B570A28F13E1DC3B0085E85E /* ContentManager.m in Sources */,
|
||||||
@ -2654,6 +2667,7 @@
|
|||||||
B572BC41130EB6D900B6DB47 /* AchievementCollection.m in Sources */,
|
B572BC41130EB6D900B6DB47 /* AchievementCollection.m in Sources */,
|
||||||
B572BC45130EB70100B6DB47 /* Achievement.m in Sources */,
|
B572BC45130EB70100B6DB47 /* Achievement.m in Sources */,
|
||||||
B5F503B013156241007AB367 /* XniShowMessageBoxResult.m in Sources */,
|
B5F503B013156241007AB367 /* XniShowMessageBoxResult.m in Sources */,
|
||||||
|
25AE5D5415F5440B00B73D10 /* RenderTarget2D.m in Sources */,
|
||||||
);
|
);
|
||||||
runOnlyForDeploymentPostprocessing = 0;
|
runOnlyForDeploymentPostprocessing = 0;
|
||||||
};
|
};
|
||||||
|
59
XNI.xcodeproj/xcshareddata/xcschemes/XNI Release.xcscheme
Normal file
59
XNI.xcodeproj/xcshareddata/xcschemes/XNI Release.xcscheme
Normal file
@ -0,0 +1,59 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<Scheme
|
||||||
|
LastUpgradeVersion = "0440"
|
||||||
|
version = "1.3">
|
||||||
|
<BuildAction
|
||||||
|
parallelizeBuildables = "YES"
|
||||||
|
buildImplicitDependencies = "YES">
|
||||||
|
<BuildActionEntries>
|
||||||
|
<BuildActionEntry
|
||||||
|
buildForTesting = "YES"
|
||||||
|
buildForRunning = "YES"
|
||||||
|
buildForProfiling = "YES"
|
||||||
|
buildForArchiving = "YES"
|
||||||
|
buildForAnalyzing = "YES">
|
||||||
|
<BuildableReference
|
||||||
|
BuildableIdentifier = "primary"
|
||||||
|
BlueprintIdentifier = "B570A19F13E1DC3B0085E85E"
|
||||||
|
BuildableName = "libXNI.a"
|
||||||
|
BlueprintName = "XNI Release"
|
||||||
|
ReferencedContainer = "container:XNI.xcodeproj">
|
||||||
|
</BuildableReference>
|
||||||
|
</BuildActionEntry>
|
||||||
|
</BuildActionEntries>
|
||||||
|
</BuildAction>
|
||||||
|
<TestAction
|
||||||
|
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||||
|
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||||
|
shouldUseLaunchSchemeArgsEnv = "YES"
|
||||||
|
buildConfiguration = "Debug">
|
||||||
|
<Testables>
|
||||||
|
</Testables>
|
||||||
|
</TestAction>
|
||||||
|
<LaunchAction
|
||||||
|
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||||
|
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||||
|
launchStyle = "0"
|
||||||
|
useCustomWorkingDirectory = "NO"
|
||||||
|
buildConfiguration = "Debug"
|
||||||
|
ignoresPersistentStateOnLaunch = "NO"
|
||||||
|
debugDocumentVersioning = "YES"
|
||||||
|
allowLocationSimulation = "YES">
|
||||||
|
<AdditionalOptions>
|
||||||
|
</AdditionalOptions>
|
||||||
|
</LaunchAction>
|
||||||
|
<ProfileAction
|
||||||
|
shouldUseLaunchSchemeArgsEnv = "YES"
|
||||||
|
savedToolIdentifier = ""
|
||||||
|
useCustomWorkingDirectory = "NO"
|
||||||
|
buildConfiguration = "Release"
|
||||||
|
debugDocumentVersioning = "YES">
|
||||||
|
</ProfileAction>
|
||||||
|
<AnalyzeAction
|
||||||
|
buildConfiguration = "Debug">
|
||||||
|
</AnalyzeAction>
|
||||||
|
<ArchiveAction
|
||||||
|
buildConfiguration = "Release"
|
||||||
|
revealArchiveInOrganizer = "YES">
|
||||||
|
</ArchiveAction>
|
||||||
|
</Scheme>
|
59
XNI.xcodeproj/xcshareddata/xcschemes/XNI.xcscheme
Normal file
59
XNI.xcodeproj/xcshareddata/xcschemes/XNI.xcscheme
Normal file
@ -0,0 +1,59 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<Scheme
|
||||||
|
LastUpgradeVersion = "0440"
|
||||||
|
version = "1.3">
|
||||||
|
<BuildAction
|
||||||
|
parallelizeBuildables = "YES"
|
||||||
|
buildImplicitDependencies = "YES">
|
||||||
|
<BuildActionEntries>
|
||||||
|
<BuildActionEntry
|
||||||
|
buildForTesting = "YES"
|
||||||
|
buildForRunning = "YES"
|
||||||
|
buildForProfiling = "YES"
|
||||||
|
buildForArchiving = "YES"
|
||||||
|
buildForAnalyzing = "YES">
|
||||||
|
<BuildableReference
|
||||||
|
BuildableIdentifier = "primary"
|
||||||
|
BlueprintIdentifier = "D2AAC07D0554694100DB518D"
|
||||||
|
BuildableName = "libXNI.a"
|
||||||
|
BlueprintName = "XNI"
|
||||||
|
ReferencedContainer = "container:XNI.xcodeproj">
|
||||||
|
</BuildableReference>
|
||||||
|
</BuildActionEntry>
|
||||||
|
</BuildActionEntries>
|
||||||
|
</BuildAction>
|
||||||
|
<TestAction
|
||||||
|
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||||
|
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||||
|
shouldUseLaunchSchemeArgsEnv = "YES"
|
||||||
|
buildConfiguration = "Debug">
|
||||||
|
<Testables>
|
||||||
|
</Testables>
|
||||||
|
</TestAction>
|
||||||
|
<LaunchAction
|
||||||
|
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||||
|
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||||
|
launchStyle = "0"
|
||||||
|
useCustomWorkingDirectory = "NO"
|
||||||
|
buildConfiguration = "Debug"
|
||||||
|
ignoresPersistentStateOnLaunch = "NO"
|
||||||
|
debugDocumentVersioning = "YES"
|
||||||
|
allowLocationSimulation = "YES">
|
||||||
|
<AdditionalOptions>
|
||||||
|
</AdditionalOptions>
|
||||||
|
</LaunchAction>
|
||||||
|
<ProfileAction
|
||||||
|
shouldUseLaunchSchemeArgsEnv = "YES"
|
||||||
|
savedToolIdentifier = ""
|
||||||
|
useCustomWorkingDirectory = "NO"
|
||||||
|
buildConfiguration = "Release"
|
||||||
|
debugDocumentVersioning = "YES">
|
||||||
|
</ProfileAction>
|
||||||
|
<AnalyzeAction
|
||||||
|
buildConfiguration = "Debug">
|
||||||
|
</AnalyzeAction>
|
||||||
|
<ArchiveAction
|
||||||
|
buildConfiguration = "Release"
|
||||||
|
revealArchiveInOrganizer = "YES">
|
||||||
|
</ArchiveAction>
|
||||||
|
</Scheme>
|
Loading…
x
Reference in New Issue
Block a user