moon_magic
2006.07.07, 10:56 PM
i've got a nehe display list going in my game. no problems drawing the font, moving it around, etc. except that when i switch to fullscreen mode, all the alignment that i was doing with glRasterPos2f is messed up. is there a good way to center text using a display list? how do i implement a fullscreen mode that keeps my text where i want it? also, i'm using a non-standard font; how do i include that with my game when i finish it? i'm using cocoa, and i used interface builder to set the size of my window to 640 by 480. when i switch to fullscreen, i use this:
else
{
unsigned int windowStyle;
NSRect contentRect;
StartingWindow = [NSApp keyWindow];
windowStyle = NSBorderlessWindowMask;
contentRect = [[NSScreen mainScreen] frame];
FullScreenWindow = [[NSWindow alloc] initWithContentRect:contentRect
styleMask: windowStyle backing:NSBackingStoreBuffered defer: NO];
if(FullScreenWindow != nil)
{
NSLog(@"Window was created");
[FullScreenWindow setTitle: @"Versnoof"];
[FullScreenWindow setReleasedWhenClosed: YES];
[FullScreenWindow setContentView: self];
[FullScreenWindow makeKeyAndOrderFront:self ];
[FullScreenWindow setLevel: NSScreenSaverWindowLevel - 1];
[FullScreenWindow makeFirstResponder:self];
[NSCursor hide];
FullScreenOn = true;
}
also, here's my reshape method:
- (void) reshape
{
float aspect;
NSSize bound = [self frame].size;
aspect = bound.width / bound.height;
glViewport(0, 0, bound.width, bound.height);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluPerspective(45.0f, (GLfloat)aspect, 0.1f,100.0f);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
}
i guess i just don't know enough about what's going on when i switch to fullscreen. i understand that it creates a new window, sets some arguments and whatnot, but i don't really know what's going on with the nib stuff, or if i should have coded it myself or what.
to sum up, i'm looking for a good way to align text and i want to make sure that what i draw on the screen stays the same when i switch to fullscreen mode.
else
{
unsigned int windowStyle;
NSRect contentRect;
StartingWindow = [NSApp keyWindow];
windowStyle = NSBorderlessWindowMask;
contentRect = [[NSScreen mainScreen] frame];
FullScreenWindow = [[NSWindow alloc] initWithContentRect:contentRect
styleMask: windowStyle backing:NSBackingStoreBuffered defer: NO];
if(FullScreenWindow != nil)
{
NSLog(@"Window was created");
[FullScreenWindow setTitle: @"Versnoof"];
[FullScreenWindow setReleasedWhenClosed: YES];
[FullScreenWindow setContentView: self];
[FullScreenWindow makeKeyAndOrderFront:self ];
[FullScreenWindow setLevel: NSScreenSaverWindowLevel - 1];
[FullScreenWindow makeFirstResponder:self];
[NSCursor hide];
FullScreenOn = true;
}
also, here's my reshape method:
- (void) reshape
{
float aspect;
NSSize bound = [self frame].size;
aspect = bound.width / bound.height;
glViewport(0, 0, bound.width, bound.height);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluPerspective(45.0f, (GLfloat)aspect, 0.1f,100.0f);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
}
i guess i just don't know enough about what's going on when i switch to fullscreen. i understand that it creates a new window, sets some arguments and whatnot, but i don't really know what's going on with the nib stuff, or if i should have coded it myself or what.
to sum up, i'm looking for a good way to align text and i want to make sure that what i draw on the screen stays the same when i switch to fullscreen mode.