153 lines
14 KiB
HTML
153 lines
14 KiB
HTML
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
<html xmlns="http://www.w3.org/1999/xhtml">
|
|
<head>
|
|
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
|
|
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
|
|
<meta name="generator" content="Doxygen 1.9.1"/>
|
|
<meta name="viewport" content="width=device-width, initial-scale=1"/>
|
|
<title>libctru: input/touch-screen/source/main.c</title>
|
|
<link href="tabs.css" rel="stylesheet" type="text/css"/>
|
|
<script type="text/javascript" src="jquery.js"></script>
|
|
<script type="text/javascript" src="dynsections.js"></script>
|
|
<link href="search/search.css" rel="stylesheet" type="text/css"/>
|
|
<script type="text/javascript" src="search/searchdata.js"></script>
|
|
<script type="text/javascript" src="search/search.js"></script>
|
|
<link href="doxygen.css" rel="stylesheet" type="text/css" />
|
|
</head>
|
|
<body>
|
|
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
|
|
<div id="titlearea">
|
|
<table cellspacing="0" cellpadding="0">
|
|
<tbody>
|
|
<tr style="height: 56px;">
|
|
<td id="projectalign" style="padding-left: 0.5em;">
|
|
<div id="projectname">libctru
|
|
 <span id="projectnumber">v2.4.1</span>
|
|
</div>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
<!-- end header part -->
|
|
<!-- Generated by Doxygen 1.9.1 -->
|
|
<script type="text/javascript">
|
|
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */
|
|
var searchBox = new SearchBox("searchBox", "search",false,'Search','.html');
|
|
/* @license-end */
|
|
</script>
|
|
<script type="text/javascript" src="menudata.js"></script>
|
|
<script type="text/javascript" src="menu.js"></script>
|
|
<script type="text/javascript">
|
|
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */
|
|
$(function() {
|
|
initMenu('',true,false,'search.php','Search');
|
|
$(document).ready(function() { init_search(); });
|
|
});
|
|
/* @license-end */</script>
|
|
<div id="main-nav"></div>
|
|
</div><!-- top -->
|
|
<!-- window showing the filter options -->
|
|
<div id="MSearchSelectWindow"
|
|
onmouseover="return searchBox.OnSearchSelectShow()"
|
|
onmouseout="return searchBox.OnSearchSelectHide()"
|
|
onkeydown="return searchBox.OnSearchSelectKey(event)">
|
|
</div>
|
|
|
|
<!-- iframe showing the search results (closed by default) -->
|
|
<div id="MSearchResultsWindow">
|
|
<iframe src="javascript:void(0)" frameborder="0"
|
|
name="MSearchResults" id="MSearchResults">
|
|
</iframe>
|
|
</div>
|
|
|
|
<div class="header">
|
|
<div class="headertitle">
|
|
<div class="title">input/touch-screen/source/main.c</div> </div>
|
|
</div><!--header-->
|
|
<div class="contents">
|
|
<div class="fragment"><div class="line"><span class="comment">/*</span></div>
|
|
<div class="line"><span class="comment"> Touch Screen example made by Aurelio Mannara for libctru</span></div>
|
|
<div class="line"><span class="comment"> Please refer to https://github.com/devkitPro/libctru/blob/master/libctru/include/3ds/services/hid.h for more information</span></div>
|
|
<div class="line"><span class="comment"> This code was modified for the last time on: 12/13/2014 2:30 UTC+1</span></div>
|
|
<div class="line"><span class="comment"></span> </div>
|
|
<div class="line"><span class="comment"> This wouldn't be possible without the amazing work done by:</span></div>
|
|
<div class="line"><span class="comment"> -Smealum</span></div>
|
|
<div class="line"><span class="comment"> -fincs</span></div>
|
|
<div class="line"><span class="comment"> -WinterMute</span></div>
|
|
<div class="line"><span class="comment"> -yellows8</span></div>
|
|
<div class="line"><span class="comment"> -plutoo</span></div>
|
|
<div class="line"><span class="comment"> -mtheall</span></div>
|
|
<div class="line"><span class="comment"> -Many others who worked on 3DS and I'm surely forgetting about</span></div>
|
|
<div class="line"><span class="comment">*/</span></div>
|
|
<div class="line"> </div>
|
|
<div class="line"><span class="preprocessor">#include <<a class="code" href="3ds_8h.html">3ds.h</a>></span></div>
|
|
<div class="line"><span class="preprocessor">#include <stdio.h></span></div>
|
|
<div class="line"> </div>
|
|
<div class="line"><span class="keywordtype">int</span> main(<span class="keywordtype">int</span> argc, <span class="keywordtype">char</span> **argv)</div>
|
|
<div class="line">{</div>
|
|
<div class="line"> <a name="a0"></a><a class="code" href="gfx_8h.html#a236a005ae029247c8bfe4a4a649206fc">gfxInitDefault</a>();</div>
|
|
<div class="line"> </div>
|
|
<div class="line"> <span class="comment">//Initialize console on top screen. Using NULL as the second argument tells the console library to use the internal console structure as current one</span></div>
|
|
<div class="line"> <a name="a1"></a><a class="code" href="console_8h.html#a8e014e84f81ff901ca62d7669a8c8de8">consoleInit</a>(<a name="a2"></a><a class="code" href="gfx_8h.html#a356112d87f5cf6bbba3ea3b6b010e09caf9d44178134d07cf9c5923200e14af09">GFX_TOP</a>, NULL);</div>
|
|
<div class="line"> </div>
|
|
<div class="line"> printf(<span class="stringliteral">"\x1b[0;0HPress Start to exit."</span>);</div>
|
|
<div class="line"> printf(<span class="stringliteral">"\x1b[1;0HTouch Screen position:"</span>);</div>
|
|
<div class="line"> </div>
|
|
<div class="line"> <span class="comment">// Main loop</span></div>
|
|
<div class="line"> <span class="keywordflow">while</span> (<a name="a3"></a><a class="code" href="apt_8h.html#a84808c36d9a8c389896ecf241c7f89cb">aptMainLoop</a>())</div>
|
|
<div class="line"> {</div>
|
|
<div class="line"> <span class="comment">//Scan all the inputs. This should be done once for each frame</span></div>
|
|
<div class="line"> <a name="a4"></a><a class="code" href="hid_8h.html#abbbf0e1f3a79a75e459e19f85a66bee6">hidScanInput</a>();</div>
|
|
<div class="line"> </div>
|
|
<div class="line"> <span class="comment">//hidKeysDown returns information about which buttons have been just pressed (and they weren't in the previous frame)</span></div>
|
|
<div class="line"> <a class="code" href="types_8h.html#afaa62991928fb9fb18ff0db62a040aba">u32</a> kDown = <a name="a5"></a><a class="code" href="hid_8h.html#aa2cababf764bf0b4297dc2e2fffe2a76">hidKeysDown</a>();</div>
|
|
<div class="line"> </div>
|
|
<div class="line"> <span class="keywordflow">if</span> (kDown & <a name="a6"></a><a class="code" href="hid_8h.html#a531c35e38ede3ea4e5ba5afb24b29493a616a1f5c4ed36080ca954453084aea3b">KEY_START</a>) <span class="keywordflow">break</span>; <span class="comment">// break in order to return to hbmenu</span></div>
|
|
<div class="line"> </div>
|
|
<div class="line"> <a name="_a7"></a><a class="code" href="structtouchPosition.html">touchPosition</a> touch;</div>
|
|
<div class="line"> </div>
|
|
<div class="line"> <span class="comment">//Read the touch screen coordinates</span></div>
|
|
<div class="line"> <a name="a8"></a><a class="code" href="hid_8h.html#acbeb326bdd6790f15684c70908403bb8">hidTouchRead</a>(&touch);</div>
|
|
<div class="line"> </div>
|
|
<div class="line"> <span class="comment">//Print the touch screen coordinates</span></div>
|
|
<div class="line"> printf(<span class="stringliteral">"\x1b[2;0H%03d; %03d"</span>, touch.<a name="a9"></a><a class="code" href="structtouchPosition.html#a0c42630911c33ca134f04ded5d1aafba">px</a>, touch.<a name="a10"></a><a class="code" href="structtouchPosition.html#a4a437ac7c0e754fe59638541b4d314e1">py</a>);</div>
|
|
<div class="line"> </div>
|
|
<div class="line"> </div>
|
|
<div class="line"> <span class="comment">// Flush and swap framebuffers</span></div>
|
|
<div class="line"> <a name="a11"></a><a class="code" href="gfx_8h.html#aea1808bd74fe0c00f9794e455fc8499b">gfxFlushBuffers</a>();</div>
|
|
<div class="line"> <a name="a12"></a><a class="code" href="gfx_8h.html#a0f338920111994110975dc0d1360bb1f">gfxSwapBuffers</a>();</div>
|
|
<div class="line"> </div>
|
|
<div class="line"> <span class="comment">//Wait for VBlank</span></div>
|
|
<div class="line"> <a name="a13"></a><a class="code" href="gspgpu_8h.html#abf0a992835649b5fe90e95d8a58b8c45">gspWaitForVBlank</a>();</div>
|
|
<div class="line"> }</div>
|
|
<div class="line"> </div>
|
|
<div class="line"> <span class="comment">// Exit services</span></div>
|
|
<div class="line"> <a name="a14"></a><a class="code" href="gfx_8h.html#aa446ccfdfdd4c575e648956ae96f2a3b">gfxExit</a>();</div>
|
|
<div class="line"> <span class="keywordflow">return</span> 0;</div>
|
|
<div class="line">}</div>
|
|
<div class="ttc" id="a3ds_8h_html"><div class="ttname"><a href="3ds_8h.html">3ds.h</a></div><div class="ttdoc">Central 3DS header.</div></div>
|
|
<div class="ttc" id="aapt_8h_html_a84808c36d9a8c389896ecf241c7f89cb"><div class="ttname"><a href="apt_8h.html#a84808c36d9a8c389896ecf241c7f89cb">aptMainLoop</a></div><div class="ttdeci">bool aptMainLoop(void)</div><div class="ttdoc">Main function which handles sleep mode and HOME/power buttons - call this at the beginning of every f...</div></div>
|
|
<div class="ttc" id="aconsole_8h_html_a8e014e84f81ff901ca62d7669a8c8de8"><div class="ttname"><a href="console_8h.html#a8e014e84f81ff901ca62d7669a8c8de8">consoleInit</a></div><div class="ttdeci">PrintConsole * consoleInit(gfxScreen_t screen, PrintConsole *console)</div><div class="ttdoc">Initialise the console.</div></div>
|
|
<div class="ttc" id="agfx_8h_html_a0f338920111994110975dc0d1360bb1f"><div class="ttname"><a href="gfx_8h.html#a0f338920111994110975dc0d1360bb1f">gfxSwapBuffers</a></div><div class="ttdeci">void gfxSwapBuffers(void)</div><div class="ttdoc">Updates the configuration of both screens.</div></div>
|
|
<div class="ttc" id="agfx_8h_html_a236a005ae029247c8bfe4a4a649206fc"><div class="ttname"><a href="gfx_8h.html#a236a005ae029247c8bfe4a4a649206fc">gfxInitDefault</a></div><div class="ttdeci">void gfxInitDefault(void)</div><div class="ttdoc">Initializes the LCD framebuffers with default parameters This is equivalent to calling:</div></div>
|
|
<div class="ttc" id="agfx_8h_html_a356112d87f5cf6bbba3ea3b6b010e09caf9d44178134d07cf9c5923200e14af09"><div class="ttname"><a href="gfx_8h.html#a356112d87f5cf6bbba3ea3b6b010e09caf9d44178134d07cf9c5923200e14af09">GFX_TOP</a></div><div class="ttdeci">@ GFX_TOP</div><div class="ttdoc">Top screen.</div><div class="ttdef"><b>Definition:</b> gfx.h:26</div></div>
|
|
<div class="ttc" id="agfx_8h_html_aa446ccfdfdd4c575e648956ae96f2a3b"><div class="ttname"><a href="gfx_8h.html#aa446ccfdfdd4c575e648956ae96f2a3b">gfxExit</a></div><div class="ttdeci">void gfxExit(void)</div><div class="ttdoc">Deinitializes and frees the LCD framebuffers.</div></div>
|
|
<div class="ttc" id="agfx_8h_html_aea1808bd74fe0c00f9794e455fc8499b"><div class="ttname"><a href="gfx_8h.html#aea1808bd74fe0c00f9794e455fc8499b">gfxFlushBuffers</a></div><div class="ttdeci">void gfxFlushBuffers(void)</div><div class="ttdoc">Flushes the data cache for the current framebuffers.</div></div>
|
|
<div class="ttc" id="agspgpu_8h_html_abf0a992835649b5fe90e95d8a58b8c45"><div class="ttname"><a href="gspgpu_8h.html#abf0a992835649b5fe90e95d8a58b8c45">gspWaitForVBlank</a></div><div class="ttdeci">#define gspWaitForVBlank()</div><div class="ttdoc">Waits for VBlank.</div><div class="ttdef"><b>Definition:</b> gspgpu.h:151</div></div>
|
|
<div class="ttc" id="ahid_8h_html_a531c35e38ede3ea4e5ba5afb24b29493a616a1f5c4ed36080ca954453084aea3b"><div class="ttname"><a href="hid_8h.html#a531c35e38ede3ea4e5ba5afb24b29493a616a1f5c4ed36080ca954453084aea3b">KEY_START</a></div><div class="ttdeci">@ KEY_START</div><div class="ttdoc">Start.</div><div class="ttdef"><b>Definition:</b> hid.h:15</div></div>
|
|
<div class="ttc" id="ahid_8h_html_aa2cababf764bf0b4297dc2e2fffe2a76"><div class="ttname"><a href="hid_8h.html#aa2cababf764bf0b4297dc2e2fffe2a76">hidKeysDown</a></div><div class="ttdeci">u32 hidKeysDown(void)</div><div class="ttdoc">Returns a bitmask of newly pressed buttons, this frame.</div></div>
|
|
<div class="ttc" id="ahid_8h_html_abbbf0e1f3a79a75e459e19f85a66bee6"><div class="ttname"><a href="hid_8h.html#abbbf0e1f3a79a75e459e19f85a66bee6">hidScanInput</a></div><div class="ttdeci">void hidScanInput(void)</div><div class="ttdoc">Scans HID for input data.</div></div>
|
|
<div class="ttc" id="ahid_8h_html_acbeb326bdd6790f15684c70908403bb8"><div class="ttname"><a href="hid_8h.html#acbeb326bdd6790f15684c70908403bb8">hidTouchRead</a></div><div class="ttdeci">void hidTouchRead(touchPosition *pos)</div><div class="ttdoc">Reads the current touch position.</div></div>
|
|
<div class="ttc" id="astructtouchPosition_html"><div class="ttname"><a href="structtouchPosition.html">touchPosition</a></div><div class="ttdoc">Touch position.</div><div class="ttdef"><b>Definition:</b> hid.h:45</div></div>
|
|
<div class="ttc" id="astructtouchPosition_html_a0c42630911c33ca134f04ded5d1aafba"><div class="ttname"><a href="structtouchPosition.html#a0c42630911c33ca134f04ded5d1aafba">touchPosition::px</a></div><div class="ttdeci">u16 px</div><div class="ttdoc">Touch X.</div><div class="ttdef"><b>Definition:</b> hid.h:46</div></div>
|
|
<div class="ttc" id="astructtouchPosition_html_a4a437ac7c0e754fe59638541b4d314e1"><div class="ttname"><a href="structtouchPosition.html#a4a437ac7c0e754fe59638541b4d314e1">touchPosition::py</a></div><div class="ttdeci">u16 py</div><div class="ttdoc">Touch Y.</div><div class="ttdef"><b>Definition:</b> hid.h:47</div></div>
|
|
<div class="ttc" id="atypes_8h_html_afaa62991928fb9fb18ff0db62a040aba"><div class="ttname"><a href="types_8h.html#afaa62991928fb9fb18ff0db62a040aba">u32</a></div><div class="ttdeci">uint32_t u32</div><div class="ttdoc">32-bit unsigned integer</div><div class="ttdef"><b>Definition:</b> types.h:23</div></div>
|
|
</div><!-- fragment --> </div><!-- contents -->
|
|
<!-- start footer part -->
|
|
<hr class="footer"/><address class="footer"><small>
|
|
Generated by <a href="https://www.doxygen.org/index.html"><img class="footer" src="doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.9.1
|
|
</small></address>
|
|
</body>
|
|
</html>
|