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