Wonx.c 1.4 KB

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