← SPL reference

play (lib/play.py) 30|

Realtime 2D/3D game runtime: pygame (window, input, audio) + ModernGL (OpenGL, GLSL shaders, meshes, textures). Import with use play;. Not the same as built-in game.ticBestMove (tic-tac-toe AI).

40| Install optional deps: pip install 'someProgrammingLanguage[play]' (pygame, moderngl, numpy, Pillow). Needs a desktop display. Check with play.depsOk() (returns 1 / 0).

Quick start

use play;

win <- play.window(640, 480, "My Game");
tex <- play.solidTexture(win, 1, 0.3, 0.5, 1);

test.while(test.isEqualNumber(win.isOpen(), 1)):
  win.tick(60);
  win.poll();
  test.ifTrue(test.isEqualNumber(win.keyPressed("escape"), 1)):
    win.close();
  end;
  win.clear(0.05, 0.05, 0.08, 1);
  win.drawSprite(tex, 100, 80, 64, 64);
  win.flip();
end;

Factories

Window methods

Examples

Implementation: lib/play.py + someProgrammingLanguage/spl_play/