This is a pre-production deployment of Warehouse, however changes made here WILL affect the production instance of PyPI.
Latest Version Dependencies status unknown Test status unknown Test coverage unknown
Project Description

Polygon primitives for pyglet.

This package provides a Shape object that can be acts as an interface between the libraries polygon and pyglet. The former provides numerical routines for handling shapes, and the latter can process OpenGL bindings. With pyglet2d, you can incorporate 2D shapes into your applications without having to write your own OpenGL calls.

Features

  • In addition to the standard constructor (from a list or array of points), four others are provided: Shape.regular_polygon, Shape.circle, Shape.rectangle, and Shape.from_dict. The latter is a specification-based constructor that is easy to use with JSON or YAML.
  • Shape has two methods that are useful as pyglet callbacks: Shape.draw and Shape.update. A Shape can be given a velocity and/or an angular velocity, and it will be updated accordingly when Shape.update is called.
  • A Shape can be manipulated using the methods Shape.scale, Shape.rotate, Shape.flip_x, Shape.flip_y, Shape.flip, and Shape.translate, or with in-place arithmetic (e.g. shape += [5, 0]).
  • Alternatively, setting the properties Shape.center and Shape.radius will translate and scale the shape, respectively.
  • Clipping operations provided by polygon are bound to the operators |, +, (union), & (intersection), - (difference), and ^ (xor).
  • Additional polygon methods can be accessed directly from the Shape.poly attribute, where the Polygon object is stored.
  • Shortcuts are provided to polygon functions via the boolean methods Shape.overlaps(other) and Shape.covers(other).

Example

See tests/graphics_demo.py for a usage example. This script also serves as a test. Run it to make sure that your graphics pipeline is working correctly:

python tests/graphics_demo.py

Requirements

  • Python >= 3.3
  • pyglet >= 1.2alpha1. This must be manually installed as it is not on PyPi.
  • polygon >= 3
  • numpy

Installation

pip install pyglet2d --upgrade

Development

To run the all tests run:

tox

Changelog

0.2.1 (2014-07-27)

  • All in-place operations now return the Shape, allowing operations to be chained.

0.2.0 (2014-07-27)

  • Added optional arguments y_factor and center to Shape.scale.
  • Implemented Shape.rotate.
  • Implemented angular velocity.
  • Argument start_angle in Shape.regular_polygon is now in radians.
  • graphics_test.py renamed to graphics_demo.py.
  • Implement Shape.flip_x, Shape.flip_y, and Shape.flip.
  • Explicitly set the Polygon3 data style to STYLE_NUMPY.
  • Implement Shape union and difference with the addition and subtraction operators.
  • Don’t throw an error when comparing the equality of shapes with different numbers of vertices.

0.1.2 (2014-07-26)

  • Fixed Shape docstring.
  • Changed docs from napoleon to numpydoc.

0.1.1 (2014-07-26)

  • Mocking of graphics calls to pyglet, for testing without a display (e.g., on Travis).
  • Fixed intersphinx links in docs.
  • Fixed coveralls.io integration.

0.1.0 (2014-07-25)

  • First release on PyPI.
Release History

Release History

0.2.1

This version

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.2.0

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.1.2

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.1.1

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.1.0

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

Download Files

Download Files

TODO: Brief introduction on what you do with files - including link to relevant help section.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
pyglet2d-0.2.1-py2.py3-none-any.whl (9.5 kB) Copy SHA256 Checksum SHA256 3.4 Wheel Jul 27, 2014
pyglet2d-0.2.1.tar.gz (16.3 kB) Copy SHA256 Checksum SHA256 Source Jul 27, 2014

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS HPE HPE Development Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting