Wonx.c 1.6 KB

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