arcade icon indicating copy to clipboard operation
arcade copied to clipboard

Prototype: Scary Vec2s and Nice Sprites

Open pushfoo opened this issue 1 year ago • 6 comments

TL;DR: Proof we can Vec2 all *Sprite without destroying the universe!

[ Obligatory Skrillex Noises ]

[!NOTE] The remaining pyright issues belong in #2183

How to try it

In your Arcade clone

  1. git checkout upstream/scary-vecs-and-nice-sprites or however you have your remotes instealled
  2. pip install -I -e .[dev]
    • This is very important
    • Do it every time you switch to or back from this branch
  3. Proceed as normal, see what breaks

In your Project

For the latest unstable version: arcade@git+https://github.com/pythonarcade/arcade/arcade.git@scary-vecs-and-nice-sprites#egg=arcade

You can also pin specific commits using a zipball link, but that's more convoluted.

Changes

  1. For BasicSprite and subclasses, the following are now Vec2:
    • .size is now a Vec2 backed by ._size
    • .position is now a Vec2
    • .scale is now a Vec2
  2. _width and _height are now compatibility properties for any subclasses we missed
  3. Dependent functions are mostly updated

What's not changed

Anything outside the sprites really. Seriously. There's a sound tweak to get it to pass and run, but otherwise, not even tests.

Current Code Quality

Already done:

  • [x] #2226
  • [x] #2021

Sprites pass:

  • [x] pytest tests/unit
  • [x] pyright
  • [x] ./make./py format + ruff check arcade

Otherwise, no guarantees: image

Follow-up Work

  • [ ] Verify the tests cover what they should
  • [ ] Perf tests and metrics to decide how to proceed with:

pushfoo avatar Jul 07 '24 13:07 pushfoo

Right, I need to figure out the zipballs since it's dependent on https://github.com/pyglet/pyglet/pull/1154

pushfoo avatar Jul 07 '24 13:07 pushfoo

Zipball's fixed, but the other pyright issues belong in #2183.

pushfoo avatar Jul 07 '24 13:07 pushfoo

I've dropped the zipball commits during rebase onto development. We're on pyglet==2.1dev4 now.

pushfoo avatar Jul 19 '24 00:07 pushfoo

Maybe set this PR to draft for now?

DragonMoffon avatar Sep 30 '24 23:09 DragonMoffon

@einarf @Cleptomania Given the pyglet 3.0 work, should I close this or leave it here as a reminder to look into the vectors?

pushfoo avatar May 17 '25 22:05 pushfoo

We can just leave it here for now

einarf avatar May 18 '25 00:05 einarf