Files
itgmania212121/stepmania/src/arch/LoadingWindow/LoadingWindow_Cocoa.mm
T

76 lines
2.0 KiB
Plaintext
Raw Normal View History

2003-07-04 09:27:12 +00:00
/*
* LoadingWindow_Cocoa.mm
2003-07-04 09:27:12 +00:00
* stepmania
*
* Created by Steve Checkoway on Thu Jul 03 2003.
* Copyright (c) 2003 Steve Checkoway. All rights reserved.
*
*/
/* This is really dumb. I don't know why it is needed all of a sudden */
2004-04-05 05:22:32 +00:00
#include <cmath>
#ifndef scalb
#define scalb(x, n) scalbn(x, n)
#endif
#ifndef gamma
2004-03-14 08:34:28 +00:00
# define gamma(x) lgamma(x)
#endif
#ifndef _POSIX_SOURCE
2004-03-14 08:34:28 +00:00
# define _POSIX_SOURCE
# define POSIX_DEFINED
#endif
2003-07-04 09:27:12 +00:00
#import <Cocoa/Cocoa.h>
#ifdef POSIX_DEFINED
2004-03-14 08:34:28 +00:00
# undef _POSIX_SOURCE
# undef POSIX_DEFINED
#endif
2003-07-04 09:27:12 +00:00
static NSWindow *window;
static NSTextView *text;
void MakeNewCocoaWindow() {
2003-09-06 22:22:35 +00:00
NSImage *image = [NSImage imageNamed:@"splash"];
2003-07-04 09:27:12 +00:00
NSSize size = [image size];
float height = size.height;
2003-08-02 03:06:49 +00:00
NSImageView *iView = [[[NSImageView alloc] initWithFrame:NSMakeRect(0, height+1, size.width, height)] autorelease];
2003-07-04 09:27:12 +00:00
NSView *view;
NSRect rect;
rect.origin = NSMakePoint(0, height);
rect.size = size;
rect.size.height += height;
text = [[[NSTextView alloc] initWithFrame:NSMakeRect(0, 0, rect.size.width, height)] autorelease];
[text setEditable:NO];
[text setSelectable:NO];
[text setDrawsBackground:YES];
[text setBackgroundColor:[NSColor lightGrayColor]];
[text setAlignment:NSCenterTextAlignment];
[iView setImage:image];
[iView setImageFrameStyle:NSImageFrameNone];
window = [[NSWindow alloc] initWithContentRect:rect styleMask:NSBorderlessWindowMask backing:NSBackingStoreBuffered defer:YES];
[window setOneShot:YES];
[window setReleasedWhenClosed:YES];
[window center];
[window useOptimizedDrawing:YES];
[window setViewsNeedDisplay:YES];
view = [window contentView];
[view addSubview:text]; /* This retains text */
[view addSubview:iView]; /* This retains iView */
[text setString:@"Initializing Hardware..."];
[window makeKeyAndOrderFront:nil];
}
void DisposeOfCocoaWindow() {
[window close]; /* Released by setReleasedWhenClosed */
}
void SetCocoaWindowText(const char *s) {
[text setString:[NSString stringWithCString:s]];
[text display];
}