22 |
*/ |
*/ |
23 |
|
|
24 |
#include <Foundation/NSException.h> |
#include <Foundation/NSException.h> |
25 |
//#include <SDL/SDL.h> |
|
26 |
|
#include <GL/gl.h> |
27 |
|
#include <GL/glu.h> |
28 |
|
|
29 |
#include "Interface/UiInterface.h" |
#include "Interface/UiInterface.h" |
30 |
|
|
33 |
*/ |
*/ |
34 |
@implementation UiInterface |
@implementation UiInterface |
35 |
|
|
|
/* private functions */ |
|
|
// - (void) glInit |
|
|
// { |
|
|
|
|
|
// } |
|
|
|
|
|
// - (void) sdlInit |
|
|
// { |
|
|
// if ( SDL_Init(SDL_INIT_VIDEO) < 0 ) { |
|
|
// fprintf(stderr, "Unable to initialize SDL: %s\n", SDL_GetError()); |
|
|
// exit(1); |
|
|
// } |
|
|
|
|
|
// if ( SDL_SetVideoMode(640, 480, 0, SDL_OPENGL) == NULL ) { |
|
|
// fprintf(stderr, "Unable to create OpenGL screen: %s\n", SDL_GetError()); |
|
|
// SDL_Quit(); |
|
|
// exit(2); |
|
|
// } |
|
|
|
|
|
// [self glInit]; |
|
|
|
|
|
// } |
|
|
|
|
|
/** |
|
|
* UiInterface initialisation |
|
|
*/ |
|
36 |
- (id) init |
- (id) init |
37 |
{ |
{ |
38 |
self = [super init]; |
self = [super init]; |
43 |
} |
} |
44 |
|
|
45 |
return self; |
return self; |
46 |
} |
} |
47 |
|
|
48 |
/** |
/** |
49 |
* add a frame to the interface |
* call the frame to be displayed on the screen, it sets _currentFrame |
50 |
|
* to frame |
51 |
* @param (UiFrame *) frame a non-nil frame |
* @param (UiFrame *) frame a non-nil frame |
52 |
*/ |
*/ |
53 |
- (void) addFrame: (UiFrame *) frame |
- (void) display |
54 |
{ |
{ |
55 |
NSParameterAssert(frame); |
NSParameterAssert(_currentFrame); |
56 |
|
|
57 |
|
glMatrixMode (GL_PROJECTION); |
58 |
|
gluOrtho2D (0.0, 1024.0, 0.0, 768.0); |
59 |
|
|
60 |
|
glMatrixMode (GL_MODELVIEW); |
61 |
|
glLoadIdentity (); |
62 |
|
|
63 |
[_frames addObject: frame]; |
[_currentFrame display]; |
64 |
} |
} |
65 |
|
|
66 |
/** |
/** |
67 |
* call the frame to be displayed on the screen, it sets _currentFrame |
* add a frame to the interface |
|
* to frame |
|
68 |
* @param (UiFrame *) frame a non-nil frame |
* @param (UiFrame *) frame a non-nil frame |
69 |
*/ |
*/ |
70 |
- (void) showFrame: (UiFrame *) frame |
- (void) addFrame: (UiFrame *) frame |
71 |
{ |
{ |
72 |
NSParameterAssert(frame); |
NSParameterAssert(frame); |
73 |
|
|
74 |
[self setCurrentFrame: frame]; |
[_frames addObject: frame]; |
75 |
// [frame display]; |
if (!_currentFrame) |
76 |
|
[self setCurrentFrame: frame]; |
77 |
} |
} |
78 |
|
|
79 |
/** |
/** |