Changeset 1d1c77e in python-game


Ignore:
Timestamp:
Mar 6, 2017, 2:47:30 AM (8 years ago)
Author:
Dmitry Portnoy <dmitry.portnoy@…>
Branches:
master
Children:
e79c833
Parents:
b632a7c
Message:

Correctly detect the native resolution on Mac

Files:
2 edited

Legend:

Unmodified
Added
Removed
  • README.md

    rb632a7c r1d1c77e  
    22sudo apt-get install python3-tk
    33
     4On mac, install pygame like this:
     5
     6brew install python3
     7
     8# Not sure if this is actually needed
     9brew install sdl sdl_image sdl_mixer sdl_ttf smpeg portmidi
     10
     11pip3 install pygame
     12pip3 install pyobjc
  • game.py

    rb632a7c r1d1c77e  
    1919   w = root.winfo_screenwidth()
    2020   h = root.winfo_screenheight()
     21elif system == 'Darwin':
     22   print("Mac detected")
     23
     24   from AppKit import NSScreen
     25   res = NSScreen.mainScreen().frame().size
     26   w = int(res.width)
     27   h = int(res.height)
    2128else:
    2229   print("Unknown OS: " + system)
Note: See TracChangeset for help on using the changeset viewer.