<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>touchscreen | Learn C Games Programming Blog</title>
	<atom:link href="https://learncgames.com/category/touchscreen/feed/" rel="self" type="application/rss+xml" />
	<link>https://learncgames.com</link>
	<description>A blog about C, programming games and my ebook(s).</description>
	<lastBuildDate>Mon, 13 Jul 2020 15:14:33 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9.4</generator>

<image>
	<url>https://learncgames.com/wp-content/uploads/2020/03/cropped-favicon-32x32.png</url>
	<title>touchscreen | Learn C Games Programming Blog</title>
	<link>https://learncgames.com</link>
	<width>32</width>
	<height>32</height>
</image> 
<site xmlns="com-wordpress:feed-additions:1">181446779</site>	<item>
		<title>Working with Mice in SDL</title>
		<link>https://learncgames.com/working-with-mice-in-sdl/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=working-with-mice-in-sdl</link>
		
		<dc:creator><![CDATA[David]]></dc:creator>
		<pubDate>Sun, 12 Jul 2020 23:00:18 +0000</pubDate>
				<category><![CDATA[C]]></category>
		<category><![CDATA[Game]]></category>
		<category><![CDATA[touchscreen]]></category>
		<category><![CDATA[matchthree]]></category>
		<guid isPermaLink="false">https://learncgames.com/?p=976</guid>

					<description><![CDATA[<p>On the Match three game, I&#8217;m at the point where I need to be able to click on a piece and drag it to the next piece (horizontal or vertical) and then start the two animating to swap positions. In SDL, I&#8217;ve got a simple mouseclick function that is called from ProcessEvents (my function for [&#8230;]</p>
The post <a href="https://learncgames.com/working-with-mice-in-sdl/">Working with Mice in SDL</a> first appeared on <a href="https://learncgames.com">Learn C Games Programming Blog</a>.]]></description>
										<content:encoded><![CDATA[<div class='__iawmlf-post-loop-links' style='display:none;' data-iawmlf-post-links='[{&quot;id&quot;:628,&quot;href&quot;:&quot;https:\/\/pixabay.com\/users\/OpenClipart-Vectors-30363\/?utm_source=link-attribution&amp;utm_medium=referral&amp;utm_campaign=image&amp;utm_content=152249&quot;,&quot;archived_href&quot;:&quot;http:\/\/web-wp.archive.org\/web\/20251230124419\/https:\/\/pixabay.com\/users\/openclipart-vectors-30363\/?utm_source=link-attribution&quot;,&quot;redirect_href&quot;:&quot;&quot;,&quot;checks&quot;:[{&quot;date&quot;:&quot;2026-02-06 16:50:10&quot;,&quot;http_code&quot;:403},{&quot;date&quot;:&quot;2026-02-10 23:17:04&quot;,&quot;http_code&quot;:403},{&quot;date&quot;:&quot;2026-02-17 06:57:17&quot;,&quot;http_code&quot;:403},{&quot;date&quot;:&quot;2026-02-23 16:08:37&quot;,&quot;http_code&quot;:403},{&quot;date&quot;:&quot;2026-02-28 13:35:04&quot;,&quot;http_code&quot;:403},{&quot;date&quot;:&quot;2026-03-05 00:12:55&quot;,&quot;http_code&quot;:403},{&quot;date&quot;:&quot;2026-03-11 03:06:02&quot;,&quot;http_code&quot;:403},{&quot;date&quot;:&quot;2026-03-21 15:14:54&quot;,&quot;http_code&quot;:403},{&quot;date&quot;:&quot;2026-03-30 07:25:51&quot;,&quot;http_code&quot;:403},{&quot;date&quot;:&quot;2026-04-09 01:55:53&quot;,&quot;http_code&quot;:403},{&quot;date&quot;:&quot;2026-04-12 17:44:15&quot;,&quot;http_code&quot;:403},{&quot;date&quot;:&quot;2026-04-16 08:50:07&quot;,&quot;http_code&quot;:403},{&quot;date&quot;:&quot;2026-04-19 11:52:53&quot;,&quot;http_code&quot;:403}],&quot;broken&quot;:true,&quot;last_checked&quot;:{&quot;date&quot;:&quot;2026-04-19 11:52:53&quot;,&quot;http_code&quot;:403},&quot;process&quot;:&quot;done&quot;},{&quot;id&quot;:629,&quot;href&quot;:&quot;https:\/\/pixabay.com\/?utm_source=link-attribution&amp;utm_medium=referral&amp;utm_campaign=image&amp;utm_content=152249&quot;,&quot;archived_href&quot;:&quot;http:\/\/web-wp.archive.org\/web\/20260205102120\/https:\/\/pixabay.com\/?utm_source=link-attribution&quot;,&quot;redirect_href&quot;:&quot;&quot;,&quot;checks&quot;:[{&quot;date&quot;:&quot;2026-02-06 16:50:12&quot;,&quot;http_code&quot;:403},{&quot;date&quot;:&quot;2026-02-10 23:17:04&quot;,&quot;http_code&quot;:403},{&quot;date&quot;:&quot;2026-02-17 06:57:17&quot;,&quot;http_code&quot;:403},{&quot;date&quot;:&quot;2026-02-23 16:08:36&quot;,&quot;http_code&quot;:403},{&quot;date&quot;:&quot;2026-02-28 13:35:04&quot;,&quot;http_code&quot;:403},{&quot;date&quot;:&quot;2026-03-05 00:12:55&quot;,&quot;http_code&quot;:403},{&quot;date&quot;:&quot;2026-03-11 03:06:02&quot;,&quot;http_code&quot;:403},{&quot;date&quot;:&quot;2026-03-21 15:14:55&quot;,&quot;http_code&quot;:403},{&quot;date&quot;:&quot;2026-03-30 07:25:51&quot;,&quot;http_code&quot;:403},{&quot;date&quot;:&quot;2026-04-09 01:55:59&quot;,&quot;http_code&quot;:403},{&quot;date&quot;:&quot;2026-04-13 05:47:45&quot;,&quot;http_code&quot;:403},{&quot;date&quot;:&quot;2026-04-19 22:44:54&quot;,&quot;http_code&quot;:403}],&quot;broken&quot;:true,&quot;last_checked&quot;:{&quot;date&quot;:&quot;2026-04-19 22:44:54&quot;,&quot;http_code&quot;:403},&quot;process&quot;:&quot;done&quot;},{&quot;id&quot;:630,&quot;href&quot;:&quot;https:\/\/gamedev.stackexchange.com\/questions\/151156\/sdl2-dragging-a-sprite-with-mouse&quot;,&quot;archived_href&quot;:&quot;http:\/\/web-wp.archive.org\/web\/20240915230903\/https:\/\/gamedev.stackexchange.com\/questions\/151156\/sdl2-dragging-a-sprite-with-mouse&quot;,&quot;redirect_href&quot;:&quot;&quot;,&quot;checks&quot;:[{&quot;date&quot;:&quot;2026-02-06 16:50:15&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-02-10 23:17:04&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-02-17 06:57:18&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-02-23 16:08:36&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-02-28 13:35:05&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-03-05 00:12:54&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-03-11 03:06:02&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-03-21 15:14:54&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-03-30 07:25:52&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-04-09 01:55:56&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-04-13 05:47:44&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-04-18 08:27:42&quot;,&quot;http_code&quot;:200}],&quot;broken&quot;:false,&quot;last_checked&quot;:{&quot;date&quot;:&quot;2026-04-18 08:27:42&quot;,&quot;http_code&quot;:200},&quot;process&quot;:&quot;done&quot;}]'></div>
<figure id="attachment_977" aria-describedby="caption-attachment-977" style="width: 300px" class="wp-caption alignleft"><img fetchpriority="high" decoding="async" class="size-medium wp-image-977" src="https://learncgames.com/wp-content/uploads/2020/07/computer-mouse-152249_640-300x282.png" alt="Computer mouse" width="300" height="282" srcset="https://learncgames.com/wp-content/uploads/2020/07/computer-mouse-152249_640-300x282.png 300w, https://learncgames.com/wp-content/uploads/2020/07/computer-mouse-152249_640.png 640w" sizes="(max-width: 300px) 100vw, 300px" /><figcaption id="caption-attachment-977" class="wp-caption-text">Image by <a href="https://pixabay.com/users/OpenClipart-Vectors-30363/?utm_source=link-attribution&amp;utm_medium=referral&amp;utm_campaign=image&amp;utm_content=152249">OpenClipart-Vectors</a> from <a href="https://pixabay.com/?utm_source=link-attribution&amp;utm_medium=referral&amp;utm_campaign=image&amp;utm_content=152249">Pixabay</a></figcaption></figure>
<p>On the Match three game, I&#8217;m at the point where I need to be able to click on a piece and drag it to the next piece (horizontal or vertical) and then start the two animating to swap positions.</p>
<p>In SDL, I&#8217;ve got a simple mouseclick function that is called from ProcessEvents (my function for handling all input) with the x,y coordinates on the screen where clicked. These have to be  converted from screen coordinates to board coordinates (or ignored if not on the board) to identify the piece clicked. However the mouse now needs to drag this piece to an adjacent piece.</p>
<p>As usual I&#8217;m not the first person to ask this and there&#8217;s a <a title="Link to StackOverflow Question about SDL2 mouse dragging" href="https://gamedev.stackexchange.com/questions/151156/sdl2-dragging-a-sprite-with-mouse" target="_blank" rel="nofollow noopener noreferrer">StackOverflow Question</a> with an answer. So I&#8217;ll be following this answer and hopefully get it working. This is possibly the key mechanic in a MatchThree game so it&#8217;s important to get it right. After that I&#8217;ll get teh touchscreen working again which should in theory use the same code apart from reading the game controller..</p>The post <a href="https://learncgames.com/working-with-mice-in-sdl/">Working with Mice in SDL</a> first appeared on <a href="https://learncgames.com">Learn C Games Programming Blog</a>.]]></content:encoded>
					
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">976</post-id>	</item>
		<item>
		<title>My raspberry Pi touchscreen arrived but it wasn&#8217;t smooth going</title>
		<link>https://learncgames.com/my-raspberry-pi-touchscreen-arrived-but-it-wasnt-smooth-going/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=my-raspberry-pi-touchscreen-arrived-but-it-wasnt-smooth-going</link>
		
		<dc:creator><![CDATA[David]]></dc:creator>
		<pubDate>Fri, 12 Jun 2020 23:00:50 +0000</pubDate>
				<category><![CDATA[touchscreen]]></category>
		<category><![CDATA[config]]></category>
		<category><![CDATA[putty]]></category>
		<category><![CDATA[WinSCP]]></category>
		<guid isPermaLink="false">https://learncgames.com/?p=791</guid>

					<description><![CDATA[<p>I bought the Longruner (no, not a typo!) 7&#8243; touch screen and it turned up after a few days. It&#8217;s nicely made and similar to this, though it looks slightly different. That hand must be a dolls hand! It doesn&#8217;t have any documentation but there was a DVD with three MS Word documents which I [&#8230;]</p>
The post <a href="https://learncgames.com/my-raspberry-pi-touchscreen-arrived-but-it-wasnt-smooth-going/">My raspberry Pi touchscreen arrived but it wasn’t smooth going</a> first appeared on <a href="https://learncgames.com">Learn C Games Programming Blog</a>.]]></description>
										<content:encoded><![CDATA[<div class='__iawmlf-post-loop-links' style='display:none;' data-iawmlf-post-links='[{&quot;id&quot;:671,&quot;href&quot;:&quot;http:\/\/longrunerpro.com\/a\/Products\/Products\/20190819\/135.html&quot;,&quot;archived_href&quot;:&quot;&quot;,&quot;redirect_href&quot;:&quot;&quot;,&quot;checks&quot;:[],&quot;broken&quot;:false,&quot;last_checked&quot;:null,&quot;process&quot;:&quot;done&quot;},{&quot;id&quot;:672,&quot;href&quot;:&quot;https:\/\/www.chiark.greenend.org.uk\/~sgtatham\/putty\/latest.html&quot;,&quot;archived_href&quot;:&quot;http:\/\/web-wp.archive.org\/web\/20260205132646\/https:\/\/www.chiark.greenend.org.uk\/~sgtatham\/putty\/latest.html&quot;,&quot;redirect_href&quot;:&quot;&quot;,&quot;checks&quot;:[{&quot;date&quot;:&quot;2026-02-06 17:24:04&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-02-13 06:07:10&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-02-17 06:57:18&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-02-20 11:27:18&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-02-28 13:35:05&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-03-05 08:46:46&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-03-11 08:48:17&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-03-21 15:14:55&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-03-30 07:25:59&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-04-09 01:56:03&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-04-13 05:47:45&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-04-19 11:52:55&quot;,&quot;http_code&quot;:503}],&quot;broken&quot;:false,&quot;last_checked&quot;:{&quot;date&quot;:&quot;2026-04-19 11:52:55&quot;,&quot;http_code&quot;:503},&quot;process&quot;:&quot;done&quot;}]'></div>
<p><img decoding="async" class="alignleft size-full wp-image-794" src="https://learncgames.com/wp-content/uploads/2020/06/longruner.png" alt="" width="500" height="375" srcset="https://learncgames.com/wp-content/uploads/2020/06/longruner.png 500w, https://learncgames.com/wp-content/uploads/2020/06/longruner-300x225.png 300w" sizes="(max-width: 500px) 100vw, 500px" />I bought the Longruner (<em>no, not a typo!</em>) 7&#8243; touch screen and it turned up after a few days. It&#8217;s nicely made and similar to this, though it <a title="Link to Longruner" href="http://longrunerpro.com/a/Products/Products/20190819/135.html" target="_blank" rel="nofollow noopener noreferrer">looks slightly</a> different. That hand must be a dolls hand!</p>
<p>It doesn&#8217;t have any documentation but there was a DVD with three MS Word documents which I opened on my Windows PC (<em>It comes in useful sometimes!</em>). One of them the &#8220;7inch HDMI Display user Manual(En).docx&#8221; has a photo of the three ports.</p>
<p>There&#8217;s a full size HDMI socket and a USB to Android (<em>Micro USB-B I believe</em>) cable is included that plugs into a USB port and either of the Android type ports. You can either have power and touch screen with the port nearest the HDMI as I did or just power alone, if you want to use it as a monitor. The two green squares show the USB and touch/power cables.</p>
<p>When I switched it on, it just sat there saying no HDMI signal. That MS Word document included instructions to edit the config.txt in \boot. Of course I had no display but the Pi was plugged into the network and I ran WinSCP which logged in and let me view files. I don&#8217;t think you can edit files as root with WinSCP, and that config.txt file needs root access to edit it.</p>
<p>However I am a long time user of <a title="Link to putty official website" href="https://www.chiark.greenend.org.uk/~sgtatham/putty/latest.html" target="_blank" rel="noopener noreferrer">Putty</a>. (You can also get putty from putty.org but I don&#8217;t know if that is also an official one). After that I could ssh into the pi, do a <em>sudo -s</em> command to switch in root and then <em>nano /boot/config.txt </em>to edit config.txt.</p>
<p><img decoding="async" class="alignleft size-full wp-image-796" src="https://learncgames.com/wp-content/uploads/2020/06/longruner.jpg" alt="longruner touchscreen being touched" width="540" height="405" srcset="https://learncgames.com/wp-content/uploads/2020/06/longruner.jpg 540w, https://learncgames.com/wp-content/uploads/2020/06/longruner-300x225.jpg 300w" sizes="(max-width: 540px) 100vw, 540px" />Here&#8217;s a photo of my fat finger moving the cursor round the screen. It works surprisingly well, and the display is lovely though my photos probably do not do it justice.</p>
<p>These are the lines you paste into the end of the config.txt, save it out and reboot.</p>
<pre>max_usb_curren=1
hdmi_force_hotplug=1
config_hdmi_boost=7
hdmi_group=2
hdmi_mode=87
hdmi_drive=1
display_rotate=0
hdmi_cvt 1024 600 60 6 0 0 0</pre>
<p>Now I just have to figure out how to use it in my games. The display is 1024 x 600 btw.</p>
<p>Plugging in a second monitor worked fine as this photo shows. The blacks are darker on the touchscreen but that&#8217;s just because the gammas don&#8217;t match and I was too lazy to change them!</p>
<p><img loading="lazy" decoding="async" class="alignleft size-medium wp-image-805" src="https://learncgames.com/wp-content/uploads/2020/06/touchscreen-monitor-300x225.jpg" alt="Touchscreen and 2nd monitor on Raspberry Pi" width="300" height="225" srcset="https://learncgames.com/wp-content/uploads/2020/06/touchscreen-monitor-300x225.jpg 300w, https://learncgames.com/wp-content/uploads/2020/06/touchscreen-monitor.jpg 640w" sizes="auto, (max-width: 300px) 100vw, 300px" /></p>The post <a href="https://learncgames.com/my-raspberry-pi-touchscreen-arrived-but-it-wasnt-smooth-going/">My raspberry Pi touchscreen arrived but it wasn’t smooth going</a> first appeared on <a href="https://learncgames.com">Learn C Games Programming Blog</a>.]]></content:encoded>
					
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">791</post-id>	</item>
	</channel>
</rss>
