diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index c6e2918..7903fdc 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -16,16 +16,22 @@ jobs: test: name: Compile and test runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + # Every version pygame ships a prebuilt wheel for (see + # https://pypi.org/project/pygame/#files), matching requires-python + # in pyproject.toml. Anything outside this range would force a + # from-source build that fails on the runner (missing SDL/freetype + # dev headers), so the declared floor and the tested floor must + # stay in lockstep. + python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"] steps: - uses: actions/checkout@v4 - uses: actions/setup-python@v5 with: - # Pinned rather than "3.x": pygame only ships prebuilt wheels up to - # cp313 (see https://pypi.org/project/pygame/#files), and installing - # on a newer interpreter forces a from-source build that fails on - # the runner (missing SDL/freetype dev headers). - python-version: "3.13" + python-version: ${{ matrix.python-version }} - name: Install package with test dependencies run: python -m pip install --upgrade pip && python -m pip install -e .[test] diff --git a/README.md b/README.md index 60d60f5..23a51d9 100644 --- a/README.md +++ b/README.md @@ -1,11 +1,42 @@ # Graphik This library assists developers with graphics programming. +## Installation +```bash +pip install graphik +``` + +## Usage +```python +import pygame +from preponderous.graphik import Graphik + +pygame.init() +gameDisplay = pygame.display.set_mode((900, 600)) +graphik = Graphik(gameDisplay) + +graphik.drawRectangle(100, 100, 200, 50, Graphik.blue) +graphik.drawText("Hello, world!", 200, 125, 24, Graphik.white) +graphik.drawButton(100, 200, 200, 50, Graphik.green, Graphik.black, 24, "Click me", lambda: print("clicked")) +graphik.drawImage("path/to/image.png", 100, 300, 200, 200) +``` + +Public `Graphik` methods: +- `Graphik(gameDisplay=None)` — construct a helper bound to a pygame display surface (creates a default 900x600 window if none is given). +- `getGameDisplay()` — returns the bound display surface. +- `getVersion()` — returns the installed graphik version string. +- `drawRectangle(xpos, ypos, width, height, color)` +- `drawText(text, xpos, ypos, size, color)` +- `drawButton(xpos, ypos, width, height, colorBox, colorText, sizeText, text, function)` — draws a rectangle and centered text, and calls `function()` on click. +- `drawImage(filePath, xpos, ypos, width, height)` + +Color constants: `Graphik.black`, `Graphik.white`, `Graphik.red`, `Graphik.green`, `Graphik.blue`. + ## Dependencies - pygame ## Projects -[Projects that utilize this library](https://github.com/Preponderous-Software/Graphik/wiki/Projects) +[Projects that utilize this library](https://github.com/Stephenson-Software/graphik/wiki/Projects) ## 📄 License diff --git a/pyproject.toml b/pyproject.toml index edd4279..42224b0 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -7,7 +7,7 @@ name = "graphik" dynamic = ["version"] description = "Simple helper methods for graphics programming with pygame." readme = "README.md" -requires-python = ">=3.8" +requires-python = ">=3.9" license = { text = "MIT" } authors = [{ name = "Daniel McCoy Stephenson" }] dependencies = ["pygame"]