Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why PyGame coordinate system has its origin at the top-left corner?

Tags:

People also ask

How does the coordinate system work in Pygame?

In pygame we always pass positions as an (X,Y) coordinate. This represents the number of pixels to the right, and the number of pixels down to place the image. The top-left corner of a Surface is coordinate (0, 0). Moving to the right a little would be (10, 0), and then moving down just as much would be (10, 10).

How do you change origin on pygame?

The simplest way to do it would be to have a function to convert coordinates, and use it just before drawing any object. This will take your coordinates and convert them into pygame's coordinates for drawing, given height , the height of the window, and coords , the top left corner of an object.


I've been using PyGame for a while and I have had to make coordinate transformations to change the normal coordinate system used in mathematics (with its origin at the bottom-left corner) to the PyGame coordinate system (with its origin at the top-left corner). I found this post very useful for that.

But I am wondering, why is PyGame using this odd coordinate system?