cocos2d for iPhone 1.0.0
2D engine for iOS and OS X
/Users/rquesada/progs/cocos2d-iphone/cocos2d/Platforms/iOS/EAGLView.h
00001 /*
00002 
00003 ===== IMPORTANT =====
00004 
00005 This is sample code demonstrating API, technology or techniques in development.
00006 Although this sample code has been reviewed for technical accuracy, it is not
00007 final. Apple is supplying this information to help you plan for the adoption of
00008 the technologies and programming interfaces described herein. This information
00009 is subject to change, and software implemented based on this sample code should
00010 be tested with final operating system software and final documentation. Newer
00011 versions of this sample code may be provided with future seeds of the API or
00012 technology. For information about updates to this and other developer
00013 documentation, view the New & Updated sidebars in subsequent documentation
00014 seeds.
00015 
00016 =====================
00017 
00018 File: EAGLView.h
00019 Abstract: Convenience class that wraps the CAEAGLLayer from CoreAnimation into a
00020 UIView subclass.
00021 
00022 Version: 1.3
00023 
00024 Disclaimer: IMPORTANT:  This Apple software is supplied to you by Apple Inc.
00025 ("Apple") in consideration of your agreement to the following terms, and your
00026 use, installation, modification or redistribution of this Apple software
00027 constitutes acceptance of these terms.  If you do not agree with these terms,
00028 please do not use, install, modify or redistribute this Apple software.
00029 
00030 In consideration of your agreement to abide by the following terms, and subject
00031 to these terms, Apple grants you a personal, non-exclusive license, under
00032 Apple's copyrights in this original Apple software (the "Apple Software"), to
00033 use, reproduce, modify and redistribute the Apple Software, with or without
00034 modifications, in source and/or binary forms; provided that if you redistribute
00035 the Apple Software in its entirety and without modifications, you must retain
00036 this notice and the following text and disclaimers in all such redistributions
00037 of the Apple Software.
00038 Neither the name, trademarks, service marks or logos of Apple Inc. may be used
00039 to endorse or promote products derived from the Apple Software without specific
00040 prior written permission from Apple.  Except as expressly stated in this notice,
00041 no other rights or licenses, express or implied, are granted by Apple herein,
00042 including but not limited to any patent rights that may be infringed by your
00043 derivative works or by other works in which the Apple Software may be
00044 incorporated.
00045 
00046 The Apple Software is provided by Apple on an "AS IS" basis.  APPLE MAKES NO
00047 WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION THE IMPLIED
00048 WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR
00049 PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND OPERATION ALONE OR IN
00050 COMBINATION WITH YOUR PRODUCTS.
00051 
00052 IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL OR
00053 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
00054 GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
00055 ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION, MODIFICATION AND/OR
00056 DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED AND WHETHER UNDER THEORY OF
00057 CONTRACT, TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF
00058 APPLE HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00059 
00060 Copyright (C) 2008 Apple Inc. All Rights Reserved.
00061 
00062 */
00063 
00064 // Only compile this code on iOS. These files should NOT be included on your Mac project.
00065 // But in case they are included, it won't be compiled.
00066 #import <Availability.h>
00067 #ifdef __IPHONE_OS_VERSION_MAX_ALLOWED
00068 
00069 #import <UIKit/UIKit.h>
00070 #import <OpenGLES/EAGL.h>
00071 #import <OpenGLES/EAGLDrawable.h>
00072 #import <OpenGLES/ES1/gl.h>
00073 #import <OpenGLES/ES1/glext.h>
00074 
00075 #import "ESRenderer.h"
00076 
00077 //CLASSES:
00078 
00079 @class EAGLView;
00080 @class EAGLSharegroup;
00081 
00082 //PROTOCOLS:
00083 
00084 @protocol EAGLTouchDelegate <NSObject>
00085 - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event;
00086 - (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event;
00087 - (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event;
00088 - (void)touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event;
00089 @end
00090 
00091 //CLASS INTERFACE:
00092 
00098 @interface EAGLView : UIView
00099 {
00100     id<ESRenderer>                      renderer_;      
00101         EAGLContext                             *context_; // weak ref
00102 
00103         NSString                                *pixelformat_;
00104         GLuint                                  depthFormat_;
00105         BOOL                                    preserveBackbuffer_;
00106 
00107         CGSize                                  size_;
00108         BOOL                                    discardFramebufferSupported_;
00109         id<EAGLTouchDelegate>   touchDelegate_;
00110 
00111         //fsaa addition
00112         BOOL                                    multisampling_;
00113         unsigned int                    requestedSamples_;
00114 }
00115 
00117 + (id) viewWithFrame:(CGRect)frame;
00119 + (id) viewWithFrame:(CGRect)frame pixelFormat:(NSString*)format;
00121 + (id) viewWithFrame:(CGRect)frame pixelFormat:(NSString*)format depthFormat:(GLuint)depth;
00123 + (id) viewWithFrame:(CGRect)frame pixelFormat:(NSString*)format depthFormat:(GLuint)depth preserveBackbuffer:(BOOL)retained sharegroup:(EAGLSharegroup*)sharegroup multiSampling:(BOOL)multisampling numberOfSamples:(unsigned int)samples;
00124 
00126 - (id) initWithFrame:(CGRect)frame; //These also set the current context
00128 - (id) initWithFrame:(CGRect)frame pixelFormat:(NSString*)format;
00130 - (id) initWithFrame:(CGRect)frame pixelFormat:(NSString*)format depthFormat:(GLuint)depth preserveBackbuffer:(BOOL)retained sharegroup:(EAGLSharegroup*)sharegroup multiSampling:(BOOL)sampling numberOfSamples:(unsigned int)nSamples;
00131 
00133 @property(nonatomic,readonly) NSString* pixelFormat;
00135 @property(nonatomic,readonly) GLuint depthFormat;
00136 
00138 @property(nonatomic,readonly) CGSize surfaceSize;
00139 
00141 @property(nonatomic,readonly) EAGLContext *context;
00142 
00143 @property(nonatomic,readwrite) BOOL multiSampling;
00144 
00146 @property(nonatomic,readwrite,assign) id<EAGLTouchDelegate> touchDelegate;
00147 
00149 -(void) swapBuffers;
00150 
00151 - (CGPoint) convertPointFromViewToSurface:(CGPoint)point;
00152 - (CGRect) convertRectFromViewToSurface:(CGRect)rect;
00153 @end
00154 
00155 #endif // __IPHONE_OS_VERSION_MAX_ALLOWED
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Properties Defines

cocos2d for iPhone API Reference - Generated using Doxygen 1.7.4