6
Copyright (C) 2004-2011 Giles C Williams and contributors
8
This program is free software; you can redistribute it and/or
9
modify it under the terms of the GNU General Public License
10
as published by the Free Software Foundation; either version 2
11
of the License, or (at your option) any later version.
13
This program is distributed in the hope that it will be useful,
14
but WITHOUT ANY WARRANTY; without even the implied warranty of
15
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
GNU General Public License for more details.
18
You should have received a copy of the GNU General Public License
19
along with this program; if not, write to the Free Software
20
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
28
#define OpenGLViewSuperClass NSOpenGLView
30
#define MAX_CLEAR_DEPTH 100000000.0
34
#define MOUSE_DOUBLE_CLICK_INTERVAL 0.40
36
@class Entity, GameController;
56
gvMouseLeftButton = 301,
79
gvStringInputAlpha = 1,
85
@interface MyOpenGLView : OpenGLViewSuperClass
88
GameController *gameController;
91
BOOL supressKeys; // DJS
93
BOOL opt, ctrl, command, shift;
94
BOOL allowingStringInput;
95
BOOL isAlphabetKeyDown;
100
int keycodetrans[255];
102
BOOL m_glContextInitialized;
104
NSTimeInterval timeIntervalAtLastClick;
107
NSMutableString *typedString;
109
NSPoint virtualJoystickPosition;
113
GLfloat x_offset, y_offset;
116
NSData *_pixelFormatAttributes;
120
- (void) setStringInput: (enum StringInput) value;
121
- (void) allowStringInput: (BOOL) value;
122
- (enum StringInput) allowingStringInput;
123
- (NSString *) typedString;
124
- (void) resetTypedString;
125
- (void) setTypedString:(NSString*) value;
128
- (GLfloat) display_z;
129
- (GLfloat) x_offset;
130
- (GLfloat) y_offset;
132
- (GameController *) gameController;
133
- (void) setGameController:(GameController *) controller;
135
- (void) initialiseGLWithSize:(NSSize) v_size;
137
- (NSData *)pixelFormatAttributes;
139
- (void) drawRect:(NSRect)rect;
140
- (void) updateScreen;
142
- (BOOL) snapShot:(NSString *)filename;
144
- (void)mouseDown:(NSEvent *)theEvent;
145
- (void)mouseUp:(NSEvent *)theEvent;
147
- (void) setVirtualJoystick:(double) vmx :(double) vmy;
148
- (NSPoint) virtualJoystickPosition;
152
- (void) clearKey: (int)theKey;
153
- (BOOL) isAlphabetKeyDown;
154
- (void) supressKeysUntilKeyUp; // DJS
155
- (BOOL) isDown: (int) key;
158
- (BOOL) isCommandDown;
159
- (BOOL) isShiftDown;
162
// Command-key combinations need special handling.
163
- (BOOL) isCommandQDown;
164
- (BOOL) isCommandFDown;
165
- (void) clearCommandF;
167
// Check current state of shift key rather than relying on last event.
168
+ (BOOL)pollShiftKey;
171
// General image-dumping methods.
172
- (void) dumpRGBAToFileNamed:(NSString *)name
173
bytes:(uint8_t *)bytes
174
width:(OOUInteger)width
175
height:(OOUInteger)height
176
rowBytes:(OOUInteger)rowBytes;
178
- (void) dumpRGBToFileNamed:(NSString *)name
179
bytes:(uint8_t *)bytes
180
width:(OOUInteger)width
181
height:(OOUInteger)height
182
rowBytes:(OOUInteger)rowBytes;
184
- (void) dumpGrayToFileNamed:(NSString *)name
185
bytes:(uint8_t *)bytes
186
width:(OOUInteger)width
187
height:(OOUInteger)height
188
rowBytes:(OOUInteger)rowBytes;
190
- (void) dumpGrayAlphaToFileNamed:(NSString *)name
191
bytes:(uint8_t *)bytes
192
width:(OOUInteger)width
193
height:(OOUInteger)height
194
rowBytes:(OOUInteger)rowBytes;
196
// Split alpha into separate file.
197
- (void) dumpRGBAToRGBFileNamed:(NSString *)rgbName
198
andGrayFileNamed:(NSString *)grayName
199
bytes:(uint8_t *)bytes
200
width:(OOUInteger)width
201
height:(OOUInteger)height
202
rowBytes:(OOUInteger)rowBytes;