class SteampakDemo(object): def __init__(self, app_id, fullscreen=False): glut.glutInit() glut.glutInitDisplayMode(glut.GLUT_DOUBLE | glut.GLUT_RGBA) if fullscreen: glut.glutGameModeString('1920x1080:32@60') glut.glutEnterGameMode() else: glut.glutInitWindowPosition(100, 100) glut.glutInitWindowSize(1024, 768) glut.glutCreateWindow('steampak demo') glut.glutDisplayFunc(self.redraw) glut.glutIdleFunc(self.redraw) glut.glutKeyboardFunc(self.keypress) self.api = SteamApi(LIBRARY_PATH, app_id=app_id) def redraw(self): glut.glutSwapBuffers() self.api.run_callbacks() def keypress(self, key, x, y): if key == 'q': self.api.shutdown() sys.exit() elif key == 'o': self.api.overlay.activate() elif key == 'p': self.api.overlay.activate('https://github.com/idlesign/steampak/') def run(self): glut.glutMainLoop()
def __init__(self, app_id, fullscreen=False): glut.glutInit() glut.glutInitDisplayMode(glut.GLUT_DOUBLE | glut.GLUT_RGBA) if fullscreen: glut.glutGameModeString('1920x1080:32@60') glut.glutEnterGameMode() else: glut.glutInitWindowPosition(100, 100) glut.glutInitWindowSize(1024, 768) glut.glutCreateWindow('steampak demo') glut.glutDisplayFunc(self.redraw) glut.glutIdleFunc(self.redraw) glut.glutKeyboardFunc(self.keypress) self.api = SteamApi(LIBRARY_PATH, app_id=app_id)