Wonx.c 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. #include "WonxP.h"
  2. #include "etc.h"
  3. #include <sys/disp.h>
  4. #include <sys/text.h>
  5. /*****************************************************************************/
  6. /* ディスプレイの確保 */
  7. /*****************************************************************************/
  8. static Wonx wonx = NULL;
  9. int Wonx_IsCreated(void)
  10. {
  11. return (wonx != NULL);
  12. }
  13. void Wonx_Create(void)
  14. {
  15. WWScreen screen;
  16. WWPalette palette;
  17. wonx = (Wonx)malloc(sizeof(_Wonx));
  18. if (wonx == NULL) Error("Wonx_Create", "Cannot allocate memory.");
  19. wonx->wonx_display =
  20. WonxDisplay_Create(LCD_PIXEL_WIDTH * 2, LCD_PIXEL_HEIGHT * 2,
  21. LCD_PIXEL_WIDTH, LCD_PIXEL_HEIGHT,
  22. SCREEN_CHAR_WIDTH, SCREEN_CHAR_HEIGHT);
  23. screen =
  24. WWDisplay_GetScreen(WonxDisplay_GetWWDisplay(wonx->wonx_display), SCREEN2);
  25. /* デフォルトのテキスト表示用パレットは0 */
  26. palette =
  27. WWDisplay_GetPalette(WonxDisplay_GetWWDisplay(wonx->wonx_display), 0);
  28. wonx->wonx_text =
  29. WonxText_Create(screen, 0, 0, TEXT_SCREEN_WIDTH, TEXT_SCREEN_HEIGHT,
  30. palette);
  31. return;
  32. }
  33. WonxDisplay Wonx_GetWonxDisplay(void)
  34. {
  35. return (wonx->wonx_display);
  36. }
  37. WonxText Wonx_GetWonxText(void)
  38. {
  39. return (wonx->wonx_text);
  40. }