summary refs log tree commit diff stats
path: root/libs/cocos2d/Platforms/iOS/EAGLView.h
diff options
context:
space:
mode:
authorStarla Insigna <starla4444@gmail.com>2011-07-30 11:19:14 -0400
committerStarla Insigna <starla4444@gmail.com>2011-07-30 11:19:14 -0400
commit9cd57b731ab1c666d4a1cb725538fdc137763d12 (patch)
tree5bac45ae5157a1cb10c6e45500cbf72789917980 /libs/cocos2d/Platforms/iOS/EAGLView.h
downloadcartcollect-9cd57b731ab1c666d4a1cb725538fdc137763d12.tar.gz
cartcollect-9cd57b731ab1c666d4a1cb725538fdc137763d12.tar.bz2
cartcollect-9cd57b731ab1c666d4a1cb725538fdc137763d12.zip
Initial commit (version 0.2.1)
Diffstat (limited to 'libs/cocos2d/Platforms/iOS/EAGLView.h')
-rwxr-xr-xlibs/cocos2d/Platforms/iOS/EAGLView.h155
1 files changed, 155 insertions, 0 deletions
diff --git a/libs/cocos2d/Platforms/iOS/EAGLView.h b/libs/cocos2d/Platforms/iOS/EAGLView.h new file mode 100755 index 0000000..3b6c2f3 --- /dev/null +++ b/libs/cocos2d/Platforms/iOS/EAGLView.h
@@ -0,0 +1,155 @@
1/*
2
3===== IMPORTANT =====
4
5This is sample code demonstrating API, technology or techniques in development.
6Although this sample code has been reviewed for technical accuracy, it is not
7final. Apple is supplying this information to help you plan for the adoption of
8the technologies and programming interfaces described herein. This information
9is subject to change, and software implemented based on this sample code should
10be tested with final operating system software and final documentation. Newer
11versions of this sample code may be provided with future seeds of the API or
12technology. For information about updates to this and other developer
13documentation, view the New & Updated sidebars in subsequent documentation
14seeds.
15
16=====================
17
18File: EAGLView.h
19Abstract: Convenience class that wraps the CAEAGLLayer from CoreAnimation into a
20UIView subclass.
21
22Version: 1.3
23
24Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple Inc.
25("Apple") in consideration of your agreement to the following terms, and your
26use, installation, modification or redistribution of this Apple software
27constitutes acceptance of these terms. If you do not agree with these terms,
28please do not use, install, modify or redistribute this Apple software.
29
30In consideration of your agreement to abide by the following terms, and subject
31to these terms, Apple grants you a personal, non-exclusive license, under
32Apple's copyrights in this original Apple software (the "Apple Software"), to
33use, reproduce, modify and redistribute the Apple Software, with or without
34modifications, in source and/or binary forms; provided that if you redistribute
35the Apple Software in its entirety and without modifications, you must retain
36this notice and the following text and disclaimers in all such redistributions
37of the Apple Software.
38Neither the name, trademarks, service marks or logos of Apple Inc. may be used
39to endorse or promote products derived from the Apple Software without specific
40prior written permission from Apple. Except as expressly stated in this notice,
41no other rights or licenses, express or implied, are granted by Apple herein,
42including but not limited to any patent rights that may be infringed by your
43derivative works or by other works in which the Apple Software may be
44incorporated.
45
46The Apple Software is provided by Apple on an "AS IS" basis. APPLE MAKES NO
47WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION THE IMPLIED
48WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR
49PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND OPERATION ALONE OR IN
50COMBINATION WITH YOUR PRODUCTS.
51
52IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL OR
53CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
54GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
55ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION, MODIFICATION AND/OR
56DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED AND WHETHER UNDER THEORY OF
57CONTRACT, TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF
58APPLE HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
59
60Copyright (C) 2008 Apple Inc. All Rights Reserved.
61
62*/
63
64// Only compile this code on iOS. These files should NOT be included on your Mac project.
65// But in case they are included, it won't be compiled.
66#import <Availability.h>
67#ifdef __IPHONE_OS_VERSION_MAX_ALLOWED
68
69#import <UIKit/UIKit.h>
70#import <OpenGLES/EAGL.h>
71#import <OpenGLES/EAGLDrawable.h>
72#import <OpenGLES/ES1/gl.h>
73#import <OpenGLES/ES1/glext.h>
74
75#import "ESRenderer.h"
76
77//CLASSES:
78
79@class EAGLView;
80@class EAGLSharegroup;
81
82//PROTOCOLS:
83
84@protocol EAGLTouchDelegate <NSObject>
85- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event;
86- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event;
87- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event;
88- (void)touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event;
89@end
90
91//CLASS INTERFACE:
92
93/** EAGLView Class.
94 * This class wraps the CAEAGLLayer from CoreAnimation into a convenient UIView subclass.
95 * The view content is basically an EAGL surface you render your OpenGL scene into.
96 * Note that setting the view non-opaque will only work if the EAGL surface has an alpha channel.
97 */
98@interface EAGLView : UIView
99{
100 id<ESRenderer> renderer_;
101 EAGLContext *context_; // weak ref
102
103 NSString *pixelformat_;
104 GLuint depthFormat_;
105 BOOL preserveBackbuffer_;
106
107 CGSize size_;
108 BOOL discardFramebufferSupported_;
109 id<EAGLTouchDelegate> touchDelegate_;
110
111 //fsaa addition
112 BOOL multisampling_;
113 unsigned int requestedSamples_;
114}
115
116/** creates an initializes an EAGLView with a frame and 0-bit depth buffer, and a RGB565 color buffer. */
117+ (id) viewWithFrame:(CGRect)frame;
118/** creates an initializes an EAGLView with a frame, a color buffer format, and 0-bit depth buffer. */
119+ (id) viewWithFrame:(CGRect)frame pixelFormat:(NSString*)format;
120/** creates an initializes an EAGLView with a frame, a color buffer format, and a depth buffer. */
121+ (id) viewWithFrame:(CGRect)frame pixelFormat:(NSString*)format depthFormat:(GLuint)depth;
122/** creates an initializes an EAGLView with a frame, a color buffer format, a depth buffer format, a sharegroup, and multisamping */
123+ (id) viewWithFrame:(CGRect)frame pixelFormat:(NSString*)format depthFormat:(GLuint)depth preserveBackbuffer:(BOOL)retained sharegroup:(EAGLSharegroup*)sharegroup multiSampling:(BOOL)multisampling numberOfSamples:(unsigned int)samples;
124
125/** Initializes an EAGLView with a frame and 0-bit depth buffer, and a RGB565 color buffer */
126- (id) initWithFrame:(CGRect)frame; //These also set the current context
127/** Initializes an EAGLView with a frame, a color buffer format, and 0-bit depth buffer */
128- (id) initWithFrame:(CGRect)frame pixelFormat:(NSString*)format;
129/** Initializes an EAGLView with a frame, a color buffer format, a depth buffer format, a sharegroup and multisampling support */
130- (id) initWithFrame:(CGRect)frame pixelFormat:(NSString*)format depthFormat:(GLuint)depth preserveBackbuffer:(BOOL)retained sharegroup:(EAGLSharegroup*)sharegroup multiSampling:(BOOL)sampling numberOfSamples:(unsigned int)nSamples;
131
132/** pixel format: it could be RGBA8 (32-bit) or RGB565 (16-bit) */
133@property(nonatomic,readonly) NSString* pixelFormat;
134/** depth format of the render buffer: 0, 16 or 24 bits*/
135@property(nonatomic,readonly) GLuint depthFormat;
136
137/** returns surface size in pixels */
138@property(nonatomic,readonly) CGSize surfaceSize;
139
140/** OpenGL context */
141@property(nonatomic,readonly) EAGLContext *context;
142
143@property(nonatomic,readwrite) BOOL multiSampling;
144
145/** touch delegate */
146@property(nonatomic,readwrite,assign) id<EAGLTouchDelegate> touchDelegate;
147
148/** EAGLView uses double-buffer. This method swaps the buffers */
149-(void) swapBuffers;
150
151- (CGPoint) convertPointFromViewToSurface:(CGPoint)point;
152- (CGRect) convertRectFromViewToSurface:(CGRect)rect;
153@end
154
155#endif // __IPHONE_OS_VERSION_MAX_ALLOWED