summaryrefslogtreecommitdiff
path: root/packages/libndsfpc/examples/graphics/Printing/console_windows/ConsoleWindows.pp
blob: c3cb78f889cc496408acb85d2c1d4bb73c86be83 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
program ConsoleWindows;

{$mode objfpc}

uses
  ctypes, nds9;

const border =  '------------' +
                '|          |' +
                '|          |' +
                '|          |' +
                '|          |' +
                '|          |' +
                '|          |' +
                '|          |' +
                '|          |' +
                '|          |' +
                '|          |' +
                '|          |' +
                '|          |' +
                '|          |' +
                '|          |' +
                '------------';

var
  touch: touchPosition;
	left: pPrintConsole;
	right: PrintConsole;
  keys: integer;
begin

	left := consoleDemoInit();
	right := left^;

	consoleSetWindow(left, 15,1,12,16);
	consoleSetWindow(@right, 1,1,12,16);

	consoleSelect(left);
	iprintf(border);
	consoleSelect(@right);
	iprintf(border);

	consoleSetWindow(left, 2,2,10,14);
	consoleSetWindow(@right,16,2,10,14);

	while true do
	begin
		scanKeys();
		keys := keysHeld();
    if (keys and KEY_START) <> 0 then break;
		if (keys and KEY_TOUCH) <> 0 then
		begin
			touchRead(touch);

			if (touch.px < 128) then
				consoleSelect(left)
			else
				consoleSelect(@right);

			iprintf(#10'T: %i', touch.px);
		end;

		swiWaitForVBlank();
	end;

end.