EDN Admin
Well-known member
Hi, Im developing a 2D game editor using C++ with native Windows functions and GDI. Basically, this game editor uses an array of colors (the palette entries) and various 8x8 4BPP images that together become the level. The game that I want to develop uses
dynamic palettes and dynamic tiles (they are refreshed 30 times for second), so I need something that offers me easy and fast memory management for this purpose on my editor. Firstly I tried with Direct2D, but I saw that it doesnt offer palettized textures
(source http://msdn.microsoft.com/en-us/library/windows/desktop/bb173059(v=vs.85).aspx on DXGI_FORMAT_P8), so I decided to use GDI (I was thinking also to use DirectDraw, but its too obsolete and seems to give artifacts in 256 color mode on NT6). on WM_PAINT,
Im calling some functions that uses CreateCompatibleDC to create a surface where 8x8 images are stored and CreateDIBSection to define the size and the BPP of the surface. After I use BitBlt to do SRCCPY from the 8x8 tiles to a backbuffer and SCRRPY the backbuffer
to the main DC. Using DIB_PAL_COLORS in CreateDIBSection and SetDIBColorTable, I can palettize the DC easily, like the consoles that handle native 2D, but GDI force to me to use 32 bit colors. For high performance and few memory usage , I prefer to use X1R5G5B5
(or R5G5B5X1) colors, but I didnt find anything about it (all my researches falls on 16-bit indexing with DC). Id like to use native 16 bit colors, with or without GDI. I hope that someone can help me.
View the full article
dynamic palettes and dynamic tiles (they are refreshed 30 times for second), so I need something that offers me easy and fast memory management for this purpose on my editor. Firstly I tried with Direct2D, but I saw that it doesnt offer palettized textures
(source http://msdn.microsoft.com/en-us/library/windows/desktop/bb173059(v=vs.85).aspx on DXGI_FORMAT_P8), so I decided to use GDI (I was thinking also to use DirectDraw, but its too obsolete and seems to give artifacts in 256 color mode on NT6). on WM_PAINT,
Im calling some functions that uses CreateCompatibleDC to create a surface where 8x8 images are stored and CreateDIBSection to define the size and the BPP of the surface. After I use BitBlt to do SRCCPY from the 8x8 tiles to a backbuffer and SCRRPY the backbuffer
to the main DC. Using DIB_PAL_COLORS in CreateDIBSection and SetDIBColorTable, I can palettize the DC easily, like the consoles that handle native 2D, but GDI force to me to use 32 bit colors. For high performance and few memory usage , I prefer to use X1R5G5B5
(or R5G5B5X1) colors, but I didnt find anything about it (all my researches falls on 16-bit indexing with DC). Id like to use native 16 bit colors, with or without GDI. I hope that someone can help me.
View the full article