1 /*---------------------------------------------------------------------------*
2 Project: Horizon
3 File: tp.cpp
4
5 Copyright (C)2009-2012 Nintendo Co., Ltd. All rights reserved.
6
7 These coded instructions, statements, and computer programs contain
8 proprietary information of Nintendo of America Inc. and/or Nintendo
9 Company Ltd., and are protected by Federal copyright law. They may
10 not be disclosed to third parties or copied or duplicated in any form,
11 in whole or in part, without the prior written consent of Nintendo.
12
13 $Rev: 46365 $
14 *---------------------------------------------------------------------------*/
15
16 #include <nn/os.h>
17 #include <nn/hid.h>
18 #include "tp.h"
19
20 // Display touch mark in the specified position.
MakeTouchMark(demo::RenderSystemDrawing * p_RenderSystem,u16 x,u16 y,u16 length)21 void MakeTouchMark(demo::RenderSystemDrawing* p_RenderSystem, u16 x, u16 y, u16 length)
22 {
23 p_RenderSystem->DrawLine(x - length, y, x + length + 1, y);
24 p_RenderSystem->DrawLine(x, y - length, x, y + length + 1);
25 }
26
DrawFrame(void)27 void TouchPanelDemo::DrawFrame(void)
28 {
29 mp_RenderSystem->SetColor(1.0f, 1.0f, 1.0f, 1.0f);
30
31 // Get most recent touch panel data
32 nn::hid::TouchPanelStatus tpStatus;
33 m_TouchPanelReader.ReadLatest(&tpStatus);
34
35 // Display mark when touched
36 if(tpStatus.touch)
37 {
38 MakeTouchMark(mp_RenderSystem, tpStatus.x, tpStatus.y, 5);
39 }
40 }
41
GetLatestTouchPanelStatus(void)42 nn::hid::TouchPanelStatus TouchPanelDemo::GetLatestTouchPanelStatus(void)
43 {
44 // Get most recent touch panel data
45 nn::hid::TouchPanelStatus tpStatus;
46 m_TouchPanelReader.ReadLatest(&tpStatus);
47
48 return tpStatus;
49 }
50
51 /*---------------------------------------------------------------------------*
52 End of file
53 *---------------------------------------------------------------------------*/
54