faiface / pixel

A hand-crafted 2D game library in Go
MIT License
4.43k stars 244 forks source link

Scale coordinates? #309

Closed johngebbie closed 1 year ago

johngebbie commented 1 year ago

How can I scale the coordinate system so everything is drawn bigger but not pixelated? I tried Window.SetMatrix but it went pixelated, and the same drawing a scaled canvas.

I think this is different from https://github.com/faiface/pixel/issues/96 as they want to scale the pixels.

Now I think about, I could write my own Push function, but I'll post in case something like Window.Scale would be good.

johngebbie commented 1 year ago

I worked it out, using SetMatrix on a IMDraw. something like:

imd.SetMatrix(pixel.IM.Scaled(pixel.ZV, 5))
...
win.SetMatrix(pixel.IM.Moved(win.Bounds().Center()))
imd.Draw(win)