mirror of https://github.com/axmolengine/axmol.git
HelloWorld runs ok on iphone
This commit is contained in:
parent
a391c8ef99
commit
1f08213563
|
@ -41,7 +41,10 @@
|
||||||
EAGLView *__glView = [EAGLView viewWithFrame: [window bounds]
|
EAGLView *__glView = [EAGLView viewWithFrame: [window bounds]
|
||||||
pixelFormat: kEAGLColorFormatRGBA8
|
pixelFormat: kEAGLColorFormatRGBA8
|
||||||
depthFormat: 0
|
depthFormat: 0
|
||||||
preserveBackbuffer: NO];
|
preserveBackbuffer: NO
|
||||||
|
sharegroup:nil
|
||||||
|
multiSampling:NO
|
||||||
|
numberOfSamples:0];
|
||||||
[window addSubview: __glView];
|
[window addSubview: __glView];
|
||||||
[window makeKeyAndVisible];
|
[window makeKeyAndVisible];
|
||||||
|
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
821f97de148b8a4f5c67bbdb7751d22f3f9217c4
|
c65a3bbae8edd3b2e2ba8e8fac292bf18286a822
|
|
@ -21,14 +21,16 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
THE SOFTWARE.
|
THE SOFTWARE.
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
#include "platform/CCNS.h"
|
|
||||||
#import <Availability.h>
|
#import <Availability.h>
|
||||||
#import <Foundation/Foundation.h>
|
#import <Foundation/Foundation.h>
|
||||||
|
#import <UIKit/UIKit.h>
|
||||||
|
#include "platform/CCNS.h"
|
||||||
|
|
||||||
static cocos2d::CGRect static_CCRectFromString(const char* pszContent)
|
static cocos2d::CGRect static_CCRectFromString(const char* pszContent)
|
||||||
{
|
{
|
||||||
CGRect rect = CGRectFromString([NSString stringWithUTF8String: pszContent]);
|
CGRect rect = CGRectFromString([NSString stringWithUTF8String: pszContent]);
|
||||||
cocos2d::CGRect ret(rect.x, rect.y, rect.width, rect.height);
|
cocos2d::CGRect ret(rect.origin.x, rect.origin.y, rect.size.width, rect.size.height);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
|
@ -89,8 +89,8 @@ Copyright (C) 2008 Apple Inc. All Rights Reserved.
|
||||||
CGSize size_;
|
CGSize size_;
|
||||||
BOOL discardFramebufferSupported_;
|
BOOL discardFramebufferSupported_;
|
||||||
|
|
||||||
//fsaa addition
|
//fsaa addition
|
||||||
BOOL multisampling_;
|
BOOL multisampling_;
|
||||||
unsigned int requestedSamples_;
|
unsigned int requestedSamples_;
|
||||||
@private
|
@private
|
||||||
CFMutableDictionaryRef touchesIntergerDict;
|
CFMutableDictionaryRef touchesIntergerDict;
|
||||||
|
@ -102,9 +102,9 @@ Copyright (C) 2008 Apple Inc. All Rights Reserved.
|
||||||
/** creates an initializes an EAGLView with a frame, a color buffer format, and 0-bit depth buffer */
|
/** creates an initializes an EAGLView with a frame, a color buffer format, and 0-bit depth buffer */
|
||||||
+ (id) viewWithFrame:(CGRect)frame pixelFormat:(NSString*)format;
|
+ (id) viewWithFrame:(CGRect)frame pixelFormat:(NSString*)format;
|
||||||
/** creates an initializes an EAGLView with a frame, a color buffer format, and a depth buffer format */
|
/** creates an initializes an EAGLView with a frame, a color buffer format, and a depth buffer format */
|
||||||
+ (id) viewWithFrame:(CGRect)frame pixelFormat:(NSString*)format depthFormat:(GLuint)depth preserveBackbuffer:(BOOL)retained;
|
+ (id) viewWithFrame:(CGRect)frame pixelFormat:(NSString*)format depthFormat:(GLuint)depth;
|
||||||
/** creates an initializes an EAGLView with a frame, a color buffer format, a depth buffer format, a sharegroup, and multisamping */
|
/** creates an initializes an EAGLView with a frame, a color buffer format, a depth buffer format, a sharegroup, and multisamping */
|
||||||
+ (id) viewWithFrame:(CGRect)frame pixelFormat:(NSString*)format depthFormat:(GLuint)depth preserveBackbuffer:(BOOL)retained sharegroup:(EAGLSharegroup*)sharegroup multiSampling:(BOOL)multisampling numberOfSamples:(unsigned int)samples;
|
+ (id) viewWithFrame:(CGRect)frame pixelFormat:(NSString*)format depthFormat:(GLuint)depth preserveBackbuffer:(BOOL)retained sharegroup:(EAGLSharegroup*)sharegroup multiSampling:(BOOL)multisampling numberOfSamples:(unsigned int)samples;
|
||||||
|
|
||||||
// get the view object
|
// get the view object
|
||||||
+(id) sharedEGLView;
|
+(id) sharedEGLView;
|
||||||
|
@ -113,8 +113,8 @@ Copyright (C) 2008 Apple Inc. All Rights Reserved.
|
||||||
- (id) initWithFrame:(CGRect)frame; //These also set the current context
|
- (id) initWithFrame:(CGRect)frame; //These also set the current context
|
||||||
/** Initializes an EAGLView with a frame, a color buffer format, and 0-bit depth buffer */
|
/** Initializes an EAGLView with a frame, a color buffer format, and 0-bit depth buffer */
|
||||||
- (id) initWithFrame:(CGRect)frame pixelFormat:(NSString*)format;
|
- (id) initWithFrame:(CGRect)frame pixelFormat:(NSString*)format;
|
||||||
/** Initializes an EAGLView with a frame, a color buffer format, a depth buffer format, a sharegroup and multisampling support */
|
/** Initializes an EAGLView with a frame, a color buffer format, a depth buffer format, a sharegroup and multisampling support */
|
||||||
- (id) initWithFrame:(CGRect)frame pixelFormat:(NSString*)format depthFormat:(GLuint)depth preserveBackbuffer:(BOOL)retained sharegroup:(EAGLSharegroup*)sharegroup multiSampling:(BOOL)sampling numberOfSamples:(unsigned int)nSamples;
|
- (id) initWithFrame:(CGRect)frame pixelFormat:(NSString*)format depthFormat:(GLuint)depth preserveBackbuffer:(BOOL)retained sharegroup:(EAGLSharegroup*)sharegroup multiSampling:(BOOL)sampling numberOfSamples:(unsigned int)nSamples;
|
||||||
|
|
||||||
/** pixel format: it could be RGBA8 (32-bit) or RGB565 (16-bit) */
|
/** pixel format: it could be RGBA8 (32-bit) or RGB565 (16-bit) */
|
||||||
@property(nonatomic,readonly) NSString* pixelFormat;
|
@property(nonatomic,readonly) NSString* pixelFormat;
|
||||||
|
|
|
@ -317,8 +317,10 @@ static cocos2d::CCTouch *s_pTouches[MAX_TOUCHES];
|
||||||
|
|
||||||
#endif // __IPHONE_4_0
|
#endif // __IPHONE_4_0
|
||||||
|
|
||||||
// if(![context_ presentRenderbuffer:GL_RENDERBUFFER_OES])
|
if(![context_ presentRenderbuffer:GL_RENDERBUFFER_OES])
|
||||||
|
{
|
||||||
// CCLOG(@"cocos2d: Failed to swap renderbuffer in %s\n", __FUNCTION__);
|
// CCLOG(@"cocos2d: Failed to swap renderbuffer in %s\n", __FUNCTION__);
|
||||||
|
}
|
||||||
|
|
||||||
#if COCOS2D_DEBUG
|
#if COCOS2D_DEBUG
|
||||||
CHECK_GL_ERROR();
|
CHECK_GL_ERROR();
|
||||||
|
|
|
@ -1,10 +1,6 @@
|
||||||
@interface ES1Renderer (private)
|
|
||||||
|
|
||||||
- (GLenum) convertPixelFormat:(int) pixelFormat;
|
|
||||||
|
|
||||||
@end
|
|
||||||
|
|
||||||
|
|
||||||
|
#import "ES1Renderer.h"
|
||||||
|
#import "support/opengl_support/OpenGL_Internal.h"
|
||||||
@implementation ES1Renderer
|
@implementation ES1Renderer
|
||||||
|
|
||||||
@synthesize context=context_;
|
@synthesize context=context_;
|
||||||
|
|
|
@ -1,47 +1,80 @@
|
||||||
/****************************************************************************
|
/*
|
||||||
Copyright (c) 2010 cocos2d-x.org
|
|
||||||
|
===== IMPORTANT =====
|
||||||
|
|
||||||
|
This is sample code demonstrating API, technology or techniques in development.
|
||||||
|
Although this sample code has been reviewed for technical accuracy, it is not
|
||||||
|
final. Apple is supplying this information to help you plan for the adoption of
|
||||||
|
the technologies and programming interfaces described herein. This information
|
||||||
|
is subject to change, and software implemented based on this sample code should
|
||||||
|
be tested with final operating system software and final documentation. Newer
|
||||||
|
versions of this sample code may be provided with future seeds of the API or
|
||||||
|
technology. For information about updates to this and other developer
|
||||||
|
documentation, view the New & Updated sidebars in subsequent documentation
|
||||||
|
seeds.
|
||||||
|
|
||||||
|
=====================
|
||||||
|
|
||||||
|
File: OpenGL_Internal.h
|
||||||
|
Abstract: This file is included for support purposes and isn't necessary for
|
||||||
|
understanding this sample.
|
||||||
|
|
||||||
|
Version: 1.0
|
||||||
|
|
||||||
|
Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple Inc.
|
||||||
|
("Apple") in consideration of your agreement to the following terms, and your
|
||||||
|
use, installation, modification or redistribution of this Apple software
|
||||||
|
constitutes acceptance of these terms. If you do not agree with these terms,
|
||||||
|
please do not use, install, modify or redistribute this Apple software.
|
||||||
|
|
||||||
|
In consideration of your agreement to abide by the following terms, and subject
|
||||||
|
to these terms, Apple grants you a personal, non-exclusive license, under
|
||||||
|
Apple's copyrights in this original Apple software (the "Apple Software"), to
|
||||||
|
use, reproduce, modify and redistribute the Apple Software, with or without
|
||||||
|
modifications, in source and/or binary forms; provided that if you redistribute
|
||||||
|
the Apple Software in its entirety and without modifications, you must retain
|
||||||
|
this notice and the following text and disclaimers in all such redistributions
|
||||||
|
of the Apple Software.
|
||||||
|
Neither the name, trademarks, service marks or logos of Apple Inc. may be used
|
||||||
|
to endorse or promote products derived from the Apple Software without specific
|
||||||
|
prior written permission from Apple. Except as expressly stated in this notice,
|
||||||
|
no other rights or licenses, express or implied, are granted by Apple herein,
|
||||||
|
including but not limited to any patent rights that may be infringed by your
|
||||||
|
derivative works or by other works in which the Apple Software may be
|
||||||
|
incorporated.
|
||||||
|
|
||||||
|
The Apple Software is provided by Apple on an "AS IS" basis. APPLE MAKES NO
|
||||||
|
WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION THE IMPLIED
|
||||||
|
WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||||
|
PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND OPERATION ALONE OR IN
|
||||||
|
COMBINATION WITH YOUR PRODUCTS.
|
||||||
|
|
||||||
|
IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL OR
|
||||||
|
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
|
||||||
|
GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||||
|
ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION, MODIFICATION AND/OR
|
||||||
|
DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED AND WHETHER UNDER THEORY OF
|
||||||
|
CONTRACT, TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF
|
||||||
|
APPLE HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
|
Copyright (C) 2008 Apple Inc. All Rights Reserved.
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
http://www.cocos2d-x.org
|
/* Generic error reporting */
|
||||||
|
#define REPORT_ERROR(__FORMAT__, ...) printf("%s: %s\n", __FUNCTION__, [[NSString stringWithFormat:__FORMAT__, __VA_ARGS__] UTF8String])
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
/* EAGL and GL functions calling wrappers that log on error */
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
#define CALL_EAGL_FUNCTION(__FUNC__, ...) ({ EAGLError __error = __FUNC__( __VA_ARGS__ ); if(__error != kEAGLErrorSuccess) printf("%s() called from %s returned error %i\n", #__FUNC__, __FUNCTION__, __error); (__error ? NO : YES); })
|
||||||
in the Software without restriction, including without limitation the rights
|
//#define CHECK_GL_ERROR() ({ GLenum __error = glGetError(); if(__error) printf("OpenGL error 0x%04X in %s\n", __error, __FUNCTION__); (__error ? NO : YES); })
|
||||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
#define CHECK_GL_ERROR() ({ GLenum __error = glGetError(); if(__error) printf("OpenGL error 0x%04X in %s\n", __error, __FUNCTION__); })
|
||||||
copies of the Software, and to permit persons to whom the Software is
|
|
||||||
furnished to do so, subject to the following conditions:
|
|
||||||
|
|
||||||
The above copyright notice and this permission notice shall be included in
|
/* Optional delegate methods support */
|
||||||
all copies or substantial portions of the Software.
|
#ifndef __DELEGATE_IVAR__
|
||||||
|
#define __DELEGATE_IVAR__ _delegate
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
#endif
|
||||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
#ifndef __DELEGATE_METHODS_IVAR__
|
||||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
#define __DELEGATE_METHODS_IVAR__ _delegateMethods
|
||||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
#endif
|
||||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
#define TEST_DELEGATE_METHOD_BIT(__BIT__) (self->__DELEGATE_METHODS_IVAR__ & (1 << __BIT__))
|
||||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
||||||
THE SOFTWARE.
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
#ifndef __SUPPORT_OPGL_SUPPORT_OPGL_INTERNAL_H__
|
|
||||||
#define __SUPPORT_OPGL_SUPPORT_OPGL_INTERNAL_H__
|
|
||||||
#include <cstdio>
|
|
||||||
|
|
||||||
/* Generic error reporting */
|
|
||||||
#define REPORT_ERROR(__FORMAT__, ...) std::printf("%s: %s\n", __FUNCTION__, __VA_ARGS__)
|
|
||||||
|
|
||||||
/* EAGL and GL functions calling wrappers that log on error */
|
|
||||||
#define CALL_EAGL_FUNCTION(__FUNC__, ...) ({ EAGLError __error = __FUNC__( __VA_ARGS__ ); if(__error != kEAGLErrorSuccess) std::printf("%s() called from %s returned error %i\n", #__FUNC__, __FUNCTION__, __error); (__error ? false : true); })
|
|
||||||
//#define CHECK_GL_ERROR() ({ GLenum __error = glGetError(); if(__error) printf("OpenGL error 0x%04X in %s\n", __error, __FUNCTION__); (__error ? NO : YES); })
|
|
||||||
#define CHECK_GL_ERROR() ({ GLenum __error = glGetError(); if(__error) std::printf("OpenGL error 0x%04X in %s\n", __error, __FUNCTION__); })
|
|
||||||
|
|
||||||
/* Optional delegate methods support */
|
|
||||||
#ifndef __DELEGATE_IVAR__
|
|
||||||
#define __DELEGATE_IVAR__ _delegate
|
|
||||||
#endif
|
|
||||||
#ifndef __DELEGATE_METHODS_IVAR__
|
|
||||||
#define __DELEGATE_METHODS_IVAR__ _delegateMethods
|
|
||||||
#endif
|
|
||||||
#define TEST_DELEGATE_METHOD_BIT(__BIT__) (self->__DELEGATE_METHODS_IVAR__ & (1 << __BIT__))
|
|
||||||
#define SET_DELEGATE_METHOD_BIT(__BIT__, __NAME__) { if([self->__DELEGATE_IVAR__ respondsToSelector:@selector(__NAME__)]) self->__DELEGATE_METHODS_IVAR__ |= (1 << __BIT__); else self->__DELEGATE_METHODS_IVAR__ &= ~(1 << __BIT__); }
|
#define SET_DELEGATE_METHOD_BIT(__BIT__, __NAME__) { if([self->__DELEGATE_IVAR__ respondsToSelector:@selector(__NAME__)]) self->__DELEGATE_METHODS_IVAR__ |= (1 << __BIT__); else self->__DELEGATE_METHODS_IVAR__ &= ~(1 << __BIT__); }
|
||||||
|
|
||||||
#endif // __SUPPORT_OPGL_SUPPORT_OPGL_INTERNAL_H__
|
|
||||||
|
|
Loading…
Reference in New Issue