[Pythonmac-SIG] Best way to do full-screen mode?

Douglas Taylor dtaylor at ski.org
Sat Jul 22 04:38:16 CEST 2006


If you specify your screen setup for example
 
pygame.display.set_mode((1024,768), OPENGL|DOUBLEBUF|FULLSCREEN)

you can do all your drawing via OpenGL. And this works fine on a mac.

best,

Doug


Bob Ippolito wrote:

>On Jul 21, 2006, at 3:39 PM, David Warde-Farley wrote:
>
>  
>
>>On 21-Jul-06, at 6:26 PM, Robert Stephenson wrote:
>>
>>    
>>
>>>My app needs a full-screen mode, and am looking for examples or
>>>advice how to do it.  CoreGraphics allows you to capture the
>>>display and then draw on it, but since it's not written in ObjC my
>>>understanding is that it's not easily accessible from PyObjC.  An
>>>alternative would be to bring up a borderless full-screen window.
>>>Can that be done easily?
>>>      
>>>
>>I know that Pygame can do this fairly easily on other platforms.
>>Given that it's all a wrapper on top of SDL it should work on the Mac
>>as well. (Can anyone confirm?)
>>    
>>
>
>Yes, pygame does work full screen, but you need to use SDL to draw in  
>that case.
>
>That subset of CoreGraphics should be easy enough to talk to from  
>ctypes or PyObjC's FFI capability...
>
>import objc
>from Foundation import NSBundle
>bndl = NSBundle.bundleWithPath_(objc.pathForFramework 
>('ApplicationServices.framework'))
># this is cheating, CGDirectDisplayID is a pointer, but we treat it  
>as an int
>FUNCTIONS = [
>     ('CGMainDisplayID', 'i'),
>     ('CGDisplayCapture', 'ii'),
>     ('CGDisplayRelease', 'ii'),
>]
>objc.loadBundleFunctions(bndl, globals(), FUNCTIONS)
>
>Those functions should be all you need to jack into full-screen. With  
>ctypes it would be a bit different...
>
>from ctypes import c_void_p, cdll, c_int
>from ctypes.util import find_library
>
># again cheating, return value and arguments all default to int
># so we don't need to bother setting argtype/restype
>_dylib = cdll.LoadLibrary(find_library('ApplicationServices'))
>CGMainDisplayID = _dylib.CGMainDisplayID
>CGDisplayCapture = _dylib.CGDisplayCapture
>CGDisplayRelease = _dylib.CGDisplayRelease
>
>-bob
>
>_______________________________________________
>Pythonmac-SIG maillist  -  Pythonmac-SIG at python.org
>http://mail.python.org/mailman/listinfo/pythonmac-sig
>  
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/pythonmac-sig/attachments/20060721/6ac682fc/attachment.html 


More information about the Pythonmac-SIG mailing list