jo-ruether / led_table

LED table
5 stars 0 forks source link

Change type of `pixel_matrix` in Output #18

Closed jo-ruether closed 4 years ago

jo-ruether commented 4 years ago

pixel_matrix should be a 12x12x3 numpy array instead of a list of list of tuples, which will make a lot of things in application design easier.

This should happen before developing any new applications.

arjunsarin commented 4 years ago

In addition: I don't like that games are calling setValueRGB(..) one without knowing if the set pixel will ever be displayed. At the moment, only an additional call of Output.show(..) displays the image.

I suggest renaming the class Output to PixelMatrix. PixelMatrix implements setValueRGB(..), setValueHSV(..), fill(..), empty(..) and other operations on the matrix. Each game can use as many instances of PixelMatrix as they wish. PixelMatrix can be published via the Postman and are then processed by a new Thread OutputTable or OutputSim, respectively.

Speaking on a higher level, I suggest decentralizing the PixelMatrix whereas still only one thread or class is rendering on the table.

arjunsarin commented 4 years ago

To illustrate a specific use-case: For the implementation of Tetris I need to keep track of the current pixel_matrix and also I need to set pixel on the table. So I will use a matrix as a class member to store the current matrix and then write this matrix out to the Output class. There is some overhead as I am reimplementing setPixel(..)

arjunsarin commented 4 years ago

Change x-y-coordinates to row-col-indeces.

arjunsarin commented 4 years ago

See 21ae8a7f4df9e445c0100292670ed8553aedcc0f and 5f402ea209a8008bd4035147937a8d2f10abb54d. Thanks to @jo-ruether