Baekalfen / PyBoy

Game Boy emulator written in Python
Other
4.57k stars 472 forks source link

Look if SDL2 color palettes can simplify GameWindow_SDL2.py #21

Closed Baekalfen closed 5 years ago

Baekalfen commented 7 years ago

http://pysdl2.readthedocs.io/en/rel_0_9_4/modules/sdl2ext_colorpalettes.html

krs013 commented 5 years ago

I've been planning on using sdl2.ext.colorpalettes.GRAY2PALETTE for my Renderer-based reimplementation of the GameWindow. From what I've seen, it would not do much to change GameWindow_SDL2.py as it is simply a list of cached sdl2.ext.color.Color objects, which are useful for Renderers, but not when you need to write directly to the screen buffer returned by pixels2d.

Also fyi, all the colors in that palette are the same except for the light gray, which is 0xAA instead of 0x99, so it's a little lighter.

Baekalfen commented 5 years ago

My hope was to reduce some of the overhead of get_color_code and some of the other rendering code. I haven't really look into what the color palettes are capable of, so if it has no use, then we can just close the issue.

krs013 commented 5 years ago

I think most of that overhead is in combining the bits and doing the BGP/OBP0/OBP1 lookups, unfortunately, so it probably won't help there.

Baekalfen commented 5 years ago

I agree. I think this issue actually predates all of that. I'll just close it.