Skip to content

Instantly share code, notes, and snippets.

@sinistersnare
Last active December 31, 2015 13:29
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sinistersnare/7992856 to your computer and use it in GitHub Desktop.
Save sinistersnare/7992856 to your computer and use it in GitHub Desktop.
Markdown -> PDF Halp
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import argparse
import os.path
import subprocess
def main():
parser = argparse.ArgumentParser(description="Simple driver for pandoc. Or use pandoc directly for more options.")
parser.add_argument("--format", help="Output format", default="beamer")
parser.add_argument("--incremental", "-i", help="Incremental display of lists", default=False, action="store_true")
parser.add_argument("source", help="Source markdown file")
args = parser.parse_args()
output = os.path.splitext(args.source)[0] + ".pdf" #".tex"
pan_args = ["pandoc", "-f", "markdown", "-V", "theme:PaloAlto"]
if args.incremental:
pan_args.append("-i")
pan_args.extend(["--write", "beamer", "--template", "lecture.beamer", "-o", output, args.source])
print "Executing:", " ".join(pan_args)
subprocess.check_call(pan_args)
if __name__ == "__main__":
main()
sinistersnare@Aelita [02:26:51] [~/Desktop/jandev]
-> % ./generate JythonGameDev.md
Executing: pandoc -f markdown -V theme:PaloAlto --write beamer --template lecture.beamer -o JythonGameDev.pdf JythonGameDev.md

% Creating Games With Python And Java % Davis Silverman

About Me

  • Ameteur programmer and game developer
  • High school now, College in the future
  • Seeking a job as a developer!

Jython

  • CPython is the reference implementation for Python.
  • Jython is a Python implementation in Java
  • Offers superb interoperability with Java libraries, along with the amazing benefits of the JVM
  • 2.7 betas are out!

Comparisons of CPython and Jython

#Jython                  |  #CPython
def fibonacci():         |  def fibonacci():
    a, b = 0, 1          |      a, b = 0, 1  
    while True:          |      while True:
        yield a          |          yield a
        a, b = b, a + b  |          a, b = b, a + b

LibGDX

  • A cross-platform Java game development framework based on OpenGL (ES) that works on Windows, Linux, Mac OS X, Android, your WebGL enabled browser and iOS.

My Work with LibGDX

  • Translated the LibGDX wiki (GoogleCode -> Github)
  • Worked on Polyglot LibGDX (as shown in this very talk!)
  • Regular on IRC
  • Started Game-dev club at my school to teach and create games with LibGDX

LibGDX Classes Of Use

  • ApplicationListener is the base java interface for a LibGDX game
  • OrthographicCamera for camera magic
  • SpriteBatch to draw on the screen
  • Standard Math classes Vector2, Rectangle, etc.

Small example!

  • Small game from wiki translated to Python
  • To the demo! (lets hope this works!)

Limitations of LibGDX with Jython

  • GWT
    • This backend is java only, so HTML LibGDX backend is a pipe dream

Future

  • Android Support

    • Once jython can attain DynamicProxy support, it might be possible to have Jython on android!
  • iOS support

    • the RoboVM backend runs the Android class library, so if it can anddroid, theres a good chance it can iOS!
  • packaging

    • There has been some work on compiling/packaging jython into jars, this will make distribution of your awesome Python games very easy!

Links!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment