ConsoleWindows.pp 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. program ConsoleWindows;
  2. {$mode objfpc}
  3. uses
  4. ctypes, nds9;
  5. const border = '------------' +
  6. '| |' +
  7. '| |' +
  8. '| |' +
  9. '| |' +
  10. '| |' +
  11. '| |' +
  12. '| |' +
  13. '| |' +
  14. '| |' +
  15. '| |' +
  16. '| |' +
  17. '| |' +
  18. '| |' +
  19. '| |' +
  20. '------------';
  21. var
  22. touch: touchPosition;
  23. left: pPrintConsole;
  24. right: PrintConsole;
  25. keys: integer;
  26. begin
  27. left := consoleDemoInit();
  28. right := left^;
  29. consoleSetWindow(left, 15,1,12,16);
  30. consoleSetWindow(@right, 1,1,12,16);
  31. consoleSelect(left);
  32. iprintf(border);
  33. consoleSelect(@right);
  34. iprintf(border);
  35. consoleSetWindow(left, 2,2,10,14);
  36. consoleSetWindow(@right,16,2,10,14);
  37. while true do
  38. begin
  39. scanKeys();
  40. keys := keysHeld();
  41. if (keys and KEY_TOUCH) <> 0 then
  42. begin
  43. touchRead(touch);
  44. if (touch.px < 128) then
  45. consoleSelect(left)
  46. else
  47. consoleSelect(@right);
  48. iprintf(#10'T: %i', touch.px);
  49. end;
  50. swiWaitForVBlank();
  51. end;
  52. end.