diff options
Diffstat (limited to 'platform/osx/os_osx.mm')
-rw-r--r-- | platform/osx/os_osx.mm | 103 |
1 files changed, 55 insertions, 48 deletions
diff --git a/platform/osx/os_osx.mm b/platform/osx/os_osx.mm index a66f6abba5..5750e19c87 100644 --- a/platform/osx/os_osx.mm +++ b/platform/osx/os_osx.mm @@ -148,36 +148,36 @@ static int button_mask=0; - (void)applicationDidHide:(NSNotification *)notification { - /* _Godotwindow* window; - - for (window = _Godot.windowListHead; window; window = window->next) - _GodotInputWindowVisibility(window, GL_FALSE); + /* + _Godotwindow* window; + for (window = _Godot.windowListHead; window; window = window->next) + _GodotInputWindowVisibility(window, GL_FALSE); */ } - (void)applicationDidUnhide:(NSNotification *)notification { /* - _Godotwindow* window; + _Godotwindow* window; - for (window = _Godot.windowListHead; window; window = window->next) - { + for (window = _Godot.windowListHead; window; window = window->next) + { if ([window_object isVisible]) _GodotInputWindowVisibility(window, GL_TRUE); - } - */ + } + */ } - (void)applicationDidChangeScreenParameters:(NSNotification *) notification { - //_GodotInputMonitorChange(); + //_GodotInputMonitorChange(); } @end @interface GodotWindowDelegate : NSObject { - // _Godotwindow* window; + //_Godotwindow* window; } @end @@ -187,7 +187,7 @@ static int button_mask=0; - (BOOL)windowShouldClose:(id)sender { - //_GodotInputWindowCloseRequest(window); + //_GodotInputWindowCloseRequest(window); if (OS_OSX::singleton->get_main_loop()) OS_OSX::singleton->get_main_loop()->notification(MainLoop::NOTIFICATION_WM_QUIT_REQUEST); return NO; @@ -207,38 +207,42 @@ static int button_mask=0; OS_OSX::singleton->window_size.height=fbRect.size.height*OS_OSX::singleton->display_scale; - // _GodotInputFramebufferSize(window, fbRect.size.width, fbRect.size.height); - // _GodotInputWindowSize(window, contentRect.size.width, contentRect.size.height); - //_GodotInputWindowDamage(window); + /* + _GodotInputFramebufferSize(window, fbRect.size.width, fbRect.size.height); + _GodotInputWindowSize(window, contentRect.size.width, contentRect.size.height); + _GodotInputWindowDamage(window); - //if (window->cursorMode == Godot_CURSOR_DISABLED) - // centerCursor(window); + if (window->cursorMode == Godot_CURSOR_DISABLED) + centerCursor(window); + */ } - (void)windowDidMove:(NSNotification *)notification { - // [window->nsgl.context update]; + /* + [window->nsgl.context update]; - // int x, y; - // _GodotPlatformGetWindowPos(window, &x, &y); - // _GodotInputWindowPos(window, x, y); + int x, y; + _GodotPlatformGetWindowPos(window, &x, &y); + _GodotInputWindowPos(window, x, y); - //if (window->cursorMode == Godot_CURSOR_DISABLED) - // centerCursor(window); + if (window->cursorMode == Godot_CURSOR_DISABLED) + centerCursor(window); + */ } - (void)windowDidBecomeKey:(NSNotification *)notification { - // _GodotInputWindowFocus(window, GL_TRUE); - // _GodotPlatformSetCursorMode(window, window->cursorMode); + //_GodotInputWindowFocus(window, GL_TRUE); + //_GodotPlatformSetCursorMode(window, window->cursorMode); if (OS_OSX::singleton->get_main_loop()) OS_OSX::singleton->get_main_loop()->notification(MainLoop::NOTIFICATION_WM_FOCUS_IN); } - (void)windowDidResignKey:(NSNotification *)notification { - // _GodotInputWindowFocus(window, GL_FALSE); - // _GodotPlatformSetCursorMode(window, Godot_CURSOR_NORMAL); + //_GodotInputWindowFocus(window, GL_FALSE); + //_GodotPlatformSetCursorMode(window, Godot_CURSOR_NORMAL); if (OS_OSX::singleton->get_main_loop()) OS_OSX::singleton->get_main_loop()->notification(MainLoop::NOTIFICATION_WM_FOCUS_OUT); } @@ -273,16 +277,18 @@ static int button_mask=0; + (void)initialize { - if (self == [GodotContentView class]) - { - /* if (_glfw.ns.cursor == nil) + if (self == [GodotContentView class]) { - NSImage* data = [[NSImage alloc] initWithSize:NSMakeSize(1, 1)]; - _glfw.ns.cursor = [[NSCursor alloc] initWithImage:data - hotSpot:NSZeroPoint]; - [data release]; - }*/ - } + /* + if (_glfw.ns.cursor == nil) + { + NSImage* data = [[NSImage alloc] initWithSize:NSMakeSize(1, 1)]; + _glfw.ns.cursor = [[NSCursor alloc] initWithImage:data + hotSpot:NSZeroPoint]; + [data release]; + } + */ + } } - (id)init @@ -993,7 +999,7 @@ void OS_OSX::initialize(const VideoMode& p_desired,int p_video_driver,int p_audi [window_object setCollectionBehavior:NSWindowCollectionBehaviorFullScreenPrimary]; } -// [window_object setTitle:[NSString stringWithUTF8String:"GodotEnginies"]]; + //[window_object setTitle:[NSString stringWithUTF8String:"GodotEnginies"]]; [window_object setContentView:window_view]; [window_object setDelegate:window_delegate]; [window_object setAcceptsMouseMovedEvents:YES]; @@ -1019,7 +1025,7 @@ void OS_OSX::initialize(const VideoMode& p_desired,int p_video_driver,int p_audi ADD_ATTR(NSOpenGLPFADoubleBuffer); ADD_ATTR(NSOpenGLPFAClosestPolicy); -// we now need OpenGL 3 or better, maybe even change this to 3_3Core ? + //we now need OpenGL 3 or better, maybe even change this to 3_3Core ? ADD_ATTR2(NSOpenGLPFAOpenGLProfile, NSOpenGLProfileVersion3_2Core); ADD_ATTR2(NSOpenGLPFAColorSize, colorBits); @@ -1083,15 +1089,16 @@ void OS_OSX::initialize(const VideoMode& p_desired,int p_video_driver,int p_audi RasterizerGLES3::register_config(); RasterizerGLES3::make_current(); -// rasterizer = instance_RasterizerGLES2(); -// visual_server = memnew( VisualServerRaster(rasterizer) ); + //rasterizer = instance_RasterizerGLES2(); + //visual_server = memnew( VisualServerRaster(rasterizer) ); visual_server = memnew( VisualServerRaster ); // FIXME: Reimplement threaded rendering? Or remove? -// if (get_render_thread_mode()!=RENDER_THREAD_UNSAFE) { -// -// visual_server =memnew(VisualServerWrapMT(visual_server,get_render_thread_mode()==RENDER_SEPARATE_THREAD)); -// } + /* + if (get_render_thread_mode()!=RENDER_THREAD_UNSAFE) { + visual_server =memnew(VisualServerWrapMT(visual_server,get_render_thread_mode()==RENDER_SEPARATE_THREAD)); + } + */ visual_server->init(); visual_server->cursor_set_visible(false, 0); @@ -1175,7 +1182,7 @@ void OS_OSX::finalize() { visual_server->finish(); memdelete(visual_server); -// memdelete(rasterizer); + //memdelete(rasterizer); physics_server->finish(); memdelete(physics_server); @@ -1730,10 +1737,10 @@ void OS_OSX::run() { set_window_fullscreen(true); } -// uint64_t last_ticks=get_ticks_usec(); + //uint64_t last_ticks=get_ticks_usec(); -// int frames=0; -// uint64_t frame=0; + //int frames=0; + //uint64_t frame=0; while (!force_quit) { |