In the explanation of screen 2 _ set _ window () of the manual, "width and height of the display area" Although it is written, in fact it operates with "horizontal width of display area + 1 and vertical width + 1" want to see? (Unconfirmed), do not you have to do -1? Or, in actual operation in WonderWitch, ex = sx + WWScreen_GetDrawWidth (screen); Not ex = WWScreen_GetDrawWidth (screen); It may be. Implemented sprite enable / disable. LCD color map, palette, character, sprite data dump function implemented. Improve display message when calling function. Version 0.0.3 alpha - from wonx-a03.tar.gz
89 lines
2.3 KiB
C
89 lines
2.3 KiB
C
/*****************************************************************************/
|
|
/* ここから */
|
|
/*****************************************************************************/
|
|
|
|
#include "WWColorMapP.h"
|
|
|
|
/*****************************************************************************/
|
|
/* メンバ関数の定義 */
|
|
/*****************************************************************************/
|
|
|
|
WWColorMap WWColorMap_Create(int * lcd_colors)
|
|
{
|
|
WWColorMap color_map;
|
|
|
|
color_map = (WWColorMap)malloc(sizeof(_WWColorMap));
|
|
if (color_map == NULL) Error("WWColorMap_Create", "Cannot allocate memory");
|
|
|
|
WWColorMap_SetLCDColors(color_map, lcd_colors);
|
|
|
|
return (color_map);
|
|
}
|
|
|
|
WWColorMap WWColorMap_Destroy(WWColorMap color_map)
|
|
{
|
|
if (color_map == NULL) return (NULL);
|
|
free(color_map);
|
|
return (NULL);
|
|
}
|
|
|
|
int * WWColorMap_GetLCDColors(WWColorMap color_map, int * lcd_colors)
|
|
{
|
|
int i;
|
|
|
|
for (i = 0; i < 8; i++) {
|
|
lcd_colors[i] = WWColorMap_GetLCDColor(color_map, i);
|
|
}
|
|
|
|
return (lcd_colors);
|
|
}
|
|
|
|
int WWColorMap_SetLCDColors(WWColorMap color_map, int * lcd_colors)
|
|
{
|
|
int i;
|
|
|
|
for (i = 0; i < 8; i++) {
|
|
if (lcd_colors == NULL) {
|
|
WWColorMap_SetLCDColor(color_map, i, (i * 2) + ((i == 7) ? 1 : 0));
|
|
} else {
|
|
WWColorMap_SetLCDColor(color_map, i, lcd_colors[i]);
|
|
}
|
|
}
|
|
|
|
return (0);
|
|
}
|
|
|
|
int WWColorMap_GetLCDColor(WWColorMap color_map, int color)
|
|
{
|
|
return (color_map->lcd_color[color]);
|
|
}
|
|
|
|
int WWColorMap_SetLCDColor(WWColorMap color_map, int color, int lcd_color)
|
|
{
|
|
return (color_map->lcd_color[color] = lcd_color);
|
|
}
|
|
|
|
int WWColorMap_PrintData(WWColorMap c, FILE * f)
|
|
{
|
|
int i, n;
|
|
|
|
fprintf(f, "\n");
|
|
|
|
for (i = 0; i < 8; i++) {
|
|
fprintf(f, "colormap :\tcolor[%d] = %d\n",
|
|
i, WWColorMap_GetLCDColor(c, i));
|
|
}
|
|
|
|
fflush(f);
|
|
|
|
return (0);
|
|
}
|
|
|
|
/*****************************************************************************/
|
|
/* ここまで */
|
|
/*****************************************************************************/
|
|
|
|
/*****************************************************************************/
|
|
/* End of File. */
|
|
/*****************************************************************************/
|