mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-25 19:28:57 +01:00
Add 'release'
This commit is contained in:
parent
51fa65bf2f
commit
fbd35ac6a8
@ -2,10 +2,10 @@
|
||||
|
||||
#import "ebiten_window.h"
|
||||
|
||||
#include <OpenGL/gl.h>
|
||||
|
||||
#import "ebiten_content_view.h"
|
||||
|
||||
@class NSOpenGLContext;
|
||||
|
||||
void ebiten_WindowClosed(void* nativeWindow);
|
||||
|
||||
@implementation EbitenWindow {
|
||||
@ -16,6 +16,7 @@ void ebiten_WindowClosed(void* nativeWindow);
|
||||
- (id)initWithSize:(NSSize)size
|
||||
glContext:(NSOpenGLContext*)glContext {
|
||||
self->glContext_ = glContext;
|
||||
[self->glContext_ retain];
|
||||
|
||||
NSUInteger style = (NSTitledWindowMask | NSClosableWindowMask |
|
||||
NSMiniaturizableWindowMask);
|
||||
@ -35,14 +36,16 @@ void ebiten_WindowClosed(void* nativeWindow);
|
||||
styleMask:style
|
||||
backing:NSBackingStoreBuffered
|
||||
defer:YES];
|
||||
assert(self != nil);
|
||||
[self setReleasedWhenClosed:YES];
|
||||
[self setDelegate:self];
|
||||
[self setDocumentEdited:YES];
|
||||
if (self != nil) {
|
||||
[self setReleasedWhenClosed:YES];
|
||||
[self setDelegate:self];
|
||||
[self setDocumentEdited:YES];
|
||||
|
||||
NSRect rect = NSMakeRect(0, 0, size.width, size.height);
|
||||
NSView* contentView = [[EbitenContentView alloc] initWithFrame:rect];
|
||||
[self setContentView:contentView];
|
||||
NSRect rect = NSMakeRect(0, 0, size.width, size.height);
|
||||
NSView* contentView = [[EbitenContentView alloc] initWithFrame:rect];
|
||||
[self setContentView:contentView];
|
||||
[contentView release];
|
||||
}
|
||||
|
||||
return self;
|
||||
}
|
||||
|
@ -54,11 +54,15 @@ void* CreateWindow(size_t width, size_t height, const char* title, void* glConte
|
||||
EbitenWindow* window = [[EbitenWindow alloc]
|
||||
initWithSize:size
|
||||
glContext:glContext];
|
||||
[window setTitle: [[NSString alloc]
|
||||
initWithUTF8String:title]];
|
||||
NSString* nsTitle = [[NSString alloc]
|
||||
initWithUTF8String:title];
|
||||
[window setTitle: nsTitle];
|
||||
[nsTitle release];
|
||||
|
||||
[window makeKeyAndOrderFront:nil];
|
||||
|
||||
[(NSOpenGLContext*)glContext setView:[window contentView]];
|
||||
[glContext setView:[window contentView]];
|
||||
[glContext release];
|
||||
|
||||
return window;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user