-> locationInWindow f -> convertPoint:fromView:
dup NSPoint-x swap NSPoint-y
r> -> frame NSRect-h swap - 2array ;
+
+USE: opengl.gl
+USE: alien.syntax
+
+: NSOpenGLCPSwapInterval 222 ;
+
+LIBRARY: OpenGL
+
+TYPEDEF: int CGLError
+TYPEDEF: void* CGLContextObj
+TYPEDEF: int CGLContextParameter
+
+FUNCTION: CGLError CGLSetParameter ( CGLContextObj ctx, CGLContextParameter pname, GLint* params ) ;
+
! Copyright (C) 2006, 2008 Slava Pestov
! See http://factorcode.org/license.txt for BSD license.
-USING: alien arrays assocs cocoa kernel math cocoa.messages
+USING: alien alien.c-types arrays assocs cocoa kernel math cocoa.messages
cocoa.subclassing cocoa.classes cocoa.views cocoa.application
-cocoa.pasteboard cocoa.types cocoa.windows sequences ui
-ui.gadgets ui.gadgets.worlds ui.gestures core-foundation
-threads combinators ;
+cocoa.pasteboard cocoa.types cocoa.windows sequences ui ui.gadgets
+ui.gadgets.worlds ui.gestures core-foundation threads combinators ;
IN: ui.cocoa.views
: send-mouse-moved ( view event -- )
]
} ;
+: sync-refresh-to-screen ( GLView -- )
+ -> openGLContext -> CGLContextObj NSOpenGLCPSwapInterval 1 <int>
+ CGLSetParameter drop ;
+
: <FactorView> ( world -- view )
- FactorView over rect-dim <GLView> [ register-window ] keep ;
+ FactorView over rect-dim <GLView>
+ [ sync-refresh-to-screen ] keep
+ [ register-window ] keep ;
CLASS: {
{ +superclass+ "NSObject" }