<?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>matchthree | Learn C Games Programming Blog</title>
	<atom:link href="https://learncgames.com/tag/matchthree/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>matchthree | 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;date&quot;:&quot;2026-04-22 07:59:34&quot;,&quot;http_code&quot;:200}],&quot;broken&quot;:false,&quot;last_checked&quot;:{&quot;date&quot;:&quot;2026-04-22 07:59:34&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>
	</channel>
</rss>
