wonx/Wonx.c
Hiroaki Sakai eb06f7f4f8 Added text display function. (Only 0 to 127 ASCII characters, kanji is not supported)
Changed to create Wonx class and manage all resources with Wonx class.
(See Wonx.x WonxP.h)

When p is pressed to switch display / non-display of the screen, redraw the LCD panel
Improvement.

Added -Wall to compile option.

We have summarized the processing part of the function which is duplicated processing in disp.c.

Version 0.1 beta - from wonx-b01.tar.gz
2018-03-07 23:05:40 +00:00

53 lines
1.2 KiB
C

#include "WonxP.h"
#include "etc.h"
#include <sys/disp.h>
#include <sys/text.h>
/*****************************************************************************/
/* ディスプレイの確保 */
/*****************************************************************************/
static Wonx wonx = NULL;
int Wonx_IsCreated(void)
{
return (wonx != NULL);
}
void Wonx_Create(void)
{
WWScreen screen;
WWPalette palette;
wonx = (Wonx)malloc(sizeof(_Wonx));
if (wonx == NULL) Error("Wonx_Create", "Cannot allocate memory.");
wonx->wonx_display =
WonxDisplay_Create(LCD_PIXEL_WIDTH * 2, LCD_PIXEL_HEIGHT * 2,
LCD_PIXEL_WIDTH, LCD_PIXEL_HEIGHT,
SCREEN_CHAR_WIDTH, SCREEN_CHAR_HEIGHT);
screen =
WWDisplay_GetScreen(WonxDisplay_GetWWDisplay(wonx->wonx_display), SCREEN2);
/* デフォルトのテキスト表示用パレットは0 */
palette =
WWDisplay_GetPalette(WonxDisplay_GetWWDisplay(wonx->wonx_display), 0);
wonx->wonx_text =
WonxText_Create(screen, 0, 0, TEXT_SCREEN_WIDTH, TEXT_SCREEN_HEIGHT,
palette);
return;
}
WonxDisplay Wonx_GetWonxDisplay(void)
{
return (wonx->wonx_display);
}
WonxText Wonx_GetWonxText(void)
{
return (wonx->wonx_text);
}