fpc/packages/libndsfpc/examples/input/Touch_Pad/touch_area/touchArea.pp
Legolas d2dabe9a33 * updated nds/gba linker scripts and reverted some changes for 2.2.4a release
- Removed unused/outdated stuff from libndsfpc
+ Added new examples for libndsfpc
+ Added working (I hope so...) makefile.fpc for all libndsfpc/libgbafpc examples

git-svn-id: trunk@13217 -
2009-05-31 12:15:24 +00:00

41 lines
759 B
ObjectPascal

program touchArea;
uses
nds9;
const
//my experimental value for pen vs finger (higher value == lower area)
threshold = 400;
var
touch: touchPosition;
area: integer = 0;
begin
consoleDemoInit();
while true do
begin
scanKeys();
touchRead(touch);
area := (touch.px * touch.z2) div (touch.z1 - touch.px);
iprintf(#27'[10;0H' + 'Touch x = %04i, %04i'#10, touch.rawx, touch.px);
iprintf('Touch y = %04i, %04i'#10, touch.rawy, touch.py);
iprintf('Touch Area (pressure) %04i'#10, area);
if (keysHeld() and KEY_TOUCH) <> 0 then
if area > threshold then
iprintf('Last touched by: pen')
else
iprintf('Last touched by: finger');
swiWaitForVBlank();
end;
end.