<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-GB">
	<id>https://wiki.gideros.rocks/index.php?action=history&amp;feed=atom&amp;title=Tuto_Gideros_Game_Template1_Part_6_Options</id>
	<title>Tuto Gideros Game Template1 Part 6 Options - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.gideros.rocks/index.php?action=history&amp;feed=atom&amp;title=Tuto_Gideros_Game_Template1_Part_6_Options"/>
	<link rel="alternate" type="text/html" href="https://wiki.gideros.rocks/index.php?title=Tuto_Gideros_Game_Template1_Part_6_Options&amp;action=history"/>
	<updated>2026-11-18T01:26:36Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.43.11</generator>
	<entry>
		<id>https://wiki.gideros.rocks/index.php?title=Tuto_Gideros_Game_Template1_Part_6_Options&amp;diff=23857&amp;oldid=prev</id>
		<title>MoKaLux at 12:46, 26 October 2024</title>
		<link rel="alternate" type="text/html" href="https://wiki.gideros.rocks/index.php?title=Tuto_Gideros_Game_Template1_Part_6_Options&amp;diff=23857&amp;oldid=prev"/>
		<updated>2024-10-26T12:46:25Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en-GB&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 12:46, 26 October 2024&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l1&quot;&gt;Line 1:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 1:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;__TOC__&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;__TOC__&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;== Options scene ==&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;== Options scene ==&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;This is going to be the longest scene of &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;this tutorial&lt;/del&gt;!&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;This is going to be the longest scene of &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;the Gideros Game Template1&lt;/ins&gt;!&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt; &lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt; &#039;&#039;&#039;Note: the code is long because we need to setup quite a bunch of buttons and stuff, but hopefully it should not be difficult to follow&#039;&#039;&#039;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Our &amp;#039;&amp;#039;&amp;#039;Options&amp;#039;&amp;#039;&amp;#039; scene will mainly consist of:&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Our &amp;#039;&amp;#039;&amp;#039;Options&amp;#039;&amp;#039;&amp;#039; scene will mainly consist of:&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;* some sliders to control the sound volume&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;* some sliders to control the sound volume&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;* the keys to control the player and a &#039;&#039;&#039;key remapping system&#039;&#039;&#039;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;* the &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&#039;&#039;&#039;&lt;/ins&gt;keys to control the player&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&#039;&#039;&#039; &lt;/ins&gt;and a &#039;&#039;&#039;key remapping system&#039;&#039;&#039;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;* the keyboard navigation system setup&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;* the keyboard navigation system setup&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l17&quot;&gt;Line 17:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 19:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;In order to see it in your project, right click on Files-&amp;gt;Refresh.&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;In order to see it in your project, right click on Files-&amp;gt;Refresh.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt; &lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;== The Options scene code ==&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt; &lt;/div&gt;&lt;/td&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-added&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt; &lt;/div&gt;&lt;/td&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-added&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt; &lt;/div&gt;&lt;/td&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-added&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;It makes sense to create the file in the &amp;#039;&amp;#039;&amp;#039;scenes&amp;#039;&amp;#039;&amp;#039; folder. You can call the file &amp;quot;&amp;#039;&amp;#039;options.lua&amp;#039;&amp;#039;&amp;quot;. Here is the code:&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;It makes sense to create the file in the &amp;#039;&amp;#039;&amp;#039;scenes&amp;#039;&amp;#039;&amp;#039; folder. You can call the file &amp;quot;&amp;#039;&amp;#039;options.lua&amp;#039;&amp;#039;&amp;quot;. Here is the code:&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l414&quot;&gt;Line 414:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 413:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;== Code comments ==&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;== Code comments ==&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;In the &#039;&#039;init&#039;&lt;/del&gt;&#039; &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;function we add some assets like &lt;/del&gt;a &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;sound to play for &lt;/del&gt;the &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;buttons when hovered&lt;/del&gt;.&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;Sometimes a key doesn&lt;/ins&gt;&#039;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;t have &lt;/ins&gt;a &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;KeyCode visual, eg.: &lt;/ins&gt;the &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;arrow keys&lt;/ins&gt;. &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;The local &lt;/ins&gt;&#039;&#039;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;keyNames&lt;/ins&gt;&#039;&#039; &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;variable will translate &lt;/ins&gt;the &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;KeyCode of a key &lt;/ins&gt;to &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;a more user friendly name.&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt; &lt;/div&gt;&lt;/td&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-added&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;We add our buttons:&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-added&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;* &#039;&#039;&lt;/del&gt;&#039;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;START&lt;/del&gt;&#039;&#039;&#039; &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;goes to &lt;/del&gt;the &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;game scene&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-added&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;* &#039;&#039;&#039;OPTIONS&#039;&#039;&#039; goes &lt;/del&gt;to &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;the options scene&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-added&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;* &#039;&#039;&#039;EXIT&#039;&#039;&#039; exits the game&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-added&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;We use &lt;/del&gt;the &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;g_difficulty value &lt;/del&gt;and &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;transform it &lt;/del&gt;to &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;text. The value transformed to text will serve as a tooltip. This is of course optional but I add it here for demonstration.&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;=== init ===&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;In &lt;/ins&gt;the &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&#039;&#039;init&#039;&#039; function we add:&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;* a title for the scene&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;* the sliders to set the game sound volume &lt;/ins&gt;and &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;difficulty&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;* the &#039;&#039;&#039;keys &lt;/ins&gt;to &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;control the player&#039;&#039;&#039; which can be remapped&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;The buttons have many options to configure but they should &lt;/del&gt;be &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;easy to implement/understand&lt;/del&gt;.&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;We listen for any key that can &lt;/ins&gt;be &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;remapped and activate the remap key system when &quot;clicked&quot;&lt;/ins&gt;.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;The &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;numbers at &lt;/del&gt;the &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;end of each buttons are selectors. They are &lt;/del&gt;the &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;buttons id and are used for &lt;/del&gt;navigation&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;. Please make sure to assign them accordingly&lt;/del&gt;.&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;The &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;keys are added to &lt;/ins&gt;the &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&#039;&#039;btns&#039;&#039; table which serves &lt;/ins&gt;the &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;keyboard &lt;/ins&gt;navigation &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;system&lt;/ins&gt;.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;All &lt;/del&gt;the &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;buttons are put in a table which &lt;/del&gt;will &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;serve navigating with &lt;/del&gt;the &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;keyboard&lt;/del&gt;.&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;We add &lt;/ins&gt;the &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;sliders listeners and &lt;/ins&gt;will &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;save any modified value to &lt;/ins&gt;the &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;user preference file&lt;/ins&gt;.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;The &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;buttons are then positioned and listeners are added&lt;/del&gt;.&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;The &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;mouse listener will cancel any key remapping when clicked outside of a remappable key&lt;/ins&gt;.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;=== updateButton ===&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;Finally we update our buttons visuals &lt;/ins&gt;and &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;we are ready to process any change to a slider value or a key remapping event&lt;/ins&gt;.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;This function updates the button visual state &lt;/del&gt;and &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;plays sound when navigating with the keyboard&lt;/del&gt;.&lt;/div&gt;&lt;/td&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-added&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;=== &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;keyboard navigation &lt;/del&gt;===&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;=== &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;sliders functions &lt;/ins&gt;===&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;This function listens &lt;/del&gt;for &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;KEY_DOWN events &lt;/del&gt;to &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;navigate through &lt;/del&gt;the &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;buttons with &lt;/del&gt;the &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;keyboard&lt;/del&gt;.&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;We listen &lt;/ins&gt;for &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;any change in a slider value. A slider is identified by its id and on the &#039;&#039;&#039;onValueChanged&#039;&#039;&#039; event we will save the new value &lt;/ins&gt;to the &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;user preference file so the next time the game is launched &lt;/ins&gt;the &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;value will be used&lt;/ins&gt;.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;The &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;ESC key or &lt;/del&gt;the &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;BACK button key on mobile will exit the app&lt;/del&gt;.&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;The &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&#039;&#039;&#039;difficulty&#039;&#039;&#039; function translates &lt;/ins&gt;the &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&#039;&#039;g_difficulty&#039;&#039; value stored as number to text. This is imho more user friendly&lt;/ins&gt;.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;Pressing ALT+ENTER &lt;/del&gt;will &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;make &lt;/del&gt;the &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;game fullscreen&lt;/del&gt;.&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;=== key remapping ===&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;When we click on a remappable key (most of the buttons in this scene), the new value (KeyCode) will be assigned to that key. A friendly name &lt;/ins&gt;will &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;be displayed to show &lt;/ins&gt;the &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;change&lt;/ins&gt;.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;Pressing SPACE, ENTER or g_keyaction1 will validate an action&lt;/del&gt;.&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;When the remapping is validated we save it to the user preference file&lt;/ins&gt;.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;=== &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;gotoScene &lt;/del&gt;===&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;=== &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;buttons actions &lt;/ins&gt;===&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;This function &lt;/del&gt;will &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;either:&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;The buttons &lt;/ins&gt;will &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;trigger different actions according to the &lt;/ins&gt;button &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;id. If it &lt;/ins&gt;is &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;a remappable key we activate &lt;/ins&gt;the &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;remap system, if it is &lt;/ins&gt;the &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;MENU &lt;/ins&gt;button &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;we go back to &lt;/ins&gt;the &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;Menu scene.&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;* do nothing if &lt;/del&gt;button is &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;disabled&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-added&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;* navigate to &lt;/del&gt;the &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;next scene corresponding to &lt;/del&gt;the button &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;id&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-added&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;* exit &lt;/del&gt;the &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;game&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-added&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;== Next? ==&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;== Next? ==&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;The final scene for this &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;template: &lt;/del&gt;the &#039;&#039;&#039;Game&#039;&#039;&#039; scene.&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;We hopefully have a good base for an &#039;&#039;&#039;Options&#039;&#039;&#039; scene. &lt;/ins&gt;The final scene for this &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;tutorial will be &lt;/ins&gt;the &#039;&#039;&#039;Game&#039;&#039;&#039; scene.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>MoKaLux</name></author>
	</entry>
	<entry>
		<id>https://wiki.gideros.rocks/index.php?title=Tuto_Gideros_Game_Template1_Part_6_Options&amp;diff=23855&amp;oldid=prev</id>
		<title>MoKaLux: wip</title>
		<link rel="alternate" type="text/html" href="https://wiki.gideros.rocks/index.php?title=Tuto_Gideros_Game_Template1_Part_6_Options&amp;diff=23855&amp;oldid=prev"/>
		<updated>2024-10-26T10:12:14Z</updated>

		<summary type="html">&lt;p&gt;wip&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;__TOC__&lt;br /&gt;
== Options scene ==&lt;br /&gt;
This is going to be the longest scene of this tutorial!&lt;br /&gt;
&lt;br /&gt;
Our &amp;#039;&amp;#039;&amp;#039;Options&amp;#039;&amp;#039;&amp;#039; scene will mainly consist of:&lt;br /&gt;
* some sliders to control the sound volume&lt;br /&gt;
* the keys to control the player and a &amp;#039;&amp;#039;&amp;#039;key remapping system&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
* the keyboard navigation system setup&lt;br /&gt;
&lt;br /&gt;
== Adding some Sliders ==&lt;br /&gt;
For this Gideros Game Template1, we will add some sliders. I have chosen to add this Class: &amp;#039;&amp;#039;&amp;#039;[[UI_Slider#Another_Slider]]&amp;#039;&amp;#039;&amp;#039;.&lt;br /&gt;
&lt;br /&gt;
You can download the ASlider Class here: &amp;#039;&amp;#039;&amp;#039;[[Media:Aslider.lua]]&amp;#039;&amp;#039;&amp;#039; &amp;#039;&amp;#039;&amp;#039;(tip: right click and save link as)&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
Please add the &amp;#039;&amp;#039;aslider.lua&amp;#039;&amp;#039; file in the &amp;#039;&amp;#039;&amp;#039;classes&amp;#039;&amp;#039;&amp;#039; folder (I rename it to &amp;#039;&amp;#039;aslider.lua&amp;#039;&amp;#039;).&lt;br /&gt;
&lt;br /&gt;
In order to see it in your project, right click on Files-&amp;gt;Refresh.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
It makes sense to create the file in the &amp;#039;&amp;#039;&amp;#039;scenes&amp;#039;&amp;#039;&amp;#039; folder. You can call the file &amp;quot;&amp;#039;&amp;#039;options.lua&amp;#039;&amp;#039;&amp;quot;. Here is the code:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
Options = Core.class(Sprite)&lt;br /&gt;
&lt;br /&gt;
local keyNames = { -- display nice KeyCode name&lt;br /&gt;
  [KeyCode.LEFT] = &amp;quot;LEFT&amp;quot;,&lt;br /&gt;
  [KeyCode.RIGHT] = &amp;quot;RIGHT&amp;quot;,&lt;br /&gt;
  [KeyCode.UP] = &amp;quot;UP&amp;quot;,&lt;br /&gt;
  [KeyCode.DOWN] = &amp;quot;DOWN&amp;quot;,&lt;br /&gt;
  [KeyCode.NUM0] = &amp;quot;NUMPAD 0&amp;quot;,&lt;br /&gt;
  [KeyCode.NUM1] = &amp;quot;NUMPAD 1&amp;quot;,&lt;br /&gt;
  [KeyCode.NUM2] = &amp;quot;NUMPAD 2&amp;quot;,&lt;br /&gt;
  [KeyCode.NUM3] = &amp;quot;NUMPAD 3&amp;quot;,&lt;br /&gt;
  [KeyCode.NUM4] = &amp;quot;NUMPAD 4&amp;quot;,&lt;br /&gt;
  [KeyCode.NUM5] = &amp;quot;NUMPAD 5&amp;quot;,&lt;br /&gt;
  [KeyCode.NUM6] = &amp;quot;NUMPAD 6&amp;quot;,&lt;br /&gt;
  [KeyCode.NUM7] = &amp;quot;NUMPAD 7&amp;quot;,&lt;br /&gt;
  [KeyCode.NUM8] = &amp;quot;NUMPAD 8&amp;quot;,&lt;br /&gt;
  [KeyCode.NUM9] = &amp;quot;NUMPAD 9&amp;quot;,&lt;br /&gt;
  [KeyCode.SPACE] = &amp;quot;SPACE&amp;quot;,&lt;br /&gt;
  [KeyCode.SHIFT] = &amp;quot;SHIFT&amp;quot;,&lt;br /&gt;
  [KeyCode.CTRL] = &amp;quot;CONTROL&amp;quot;,&lt;br /&gt;
  [KeyCode.ALT] = &amp;quot;ALT&amp;quot;,&lt;br /&gt;
  [KeyCode.TAB] = &amp;quot;TAB&amp;quot;,&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
function Options:init()&lt;br /&gt;
	-- TITLE&lt;br /&gt;
	self.mytitle = ButtonMonster.new({&lt;br /&gt;
		autoscale=false, pixelwidth=16*8, pixelheight=4*8,&lt;br /&gt;
		pixelcolorup=0xaaaaaa,&lt;br /&gt;
		text=&amp;quot;OPTIONS&amp;quot;, ttf=myttf,&lt;br /&gt;
	})&lt;br /&gt;
	-- SLIDERS&lt;br /&gt;
	local slitcolor, knobcolor = g_ui_theme.pixelcolorup, g_ui_theme.pixelcolordown&lt;br /&gt;
	self.bgmvolumeslider = ASlider.new({&lt;br /&gt;
		initialvalue=g_bgmvolume, maximum=100, --steps=2,&lt;br /&gt;
		slitcolor=slitcolor, slitalpha=1, slitw=5*myappwidth/10, slith=24,&lt;br /&gt;
		knobcolor=knobcolor, knobalpha=0.6, knobw=12, knobh=26,&lt;br /&gt;
		text=&amp;quot;BGM VOLUME: &amp;quot;, textscale=2, textoffsetx=-26*8, textoffsety=7,&lt;br /&gt;
		id=1,&lt;br /&gt;
	})&lt;br /&gt;
	self.sfxvolumeslider = ASlider.new({&lt;br /&gt;
		initialvalue=g_sfxvolume, maximum=100, --steps=2,&lt;br /&gt;
		slitcolor=slitcolor, slitalpha=1, slitw=5*myappwidth/10, slith=24,&lt;br /&gt;
		knobcolor=knobcolor, knobalpha=0.6, knobw=12, knobh=26,&lt;br /&gt;
		text=&amp;quot;SFX VOLUME: &amp;quot;, textscale=2, textoffsetx=-26*8, textoffsety=7,&lt;br /&gt;
		id=2,&lt;br /&gt;
	})&lt;br /&gt;
	self.difficultyslider = ASlider.new({&lt;br /&gt;
		initialvalue=g_difficulty, maximum=2, --steps=2,&lt;br /&gt;
		slitcolor=slitcolor, slitalpha=1, slitw=5*myappwidth/10, slith=24,&lt;br /&gt;
		knobcolor=knobcolor, knobalpha=0.6, knobw=12, knobh=26,&lt;br /&gt;
		text=&amp;quot;DIFFICULTY: &amp;quot;, textscale=2, textoffsetx=-26*8, textoffsety=7, textrotation=0,&lt;br /&gt;
		id=3,&lt;br /&gt;
	})&lt;br /&gt;
	-- position&lt;br /&gt;
	self.mytitle:setPosition(myappwidth/2, 0.75*myappheight/10)&lt;br /&gt;
	self.bgmvolumeslider:setPosition(29*8, 2.5*myappheight/10)&lt;br /&gt;
	self.sfxvolumeslider:setPosition(29*8, 3.5*myappheight/10)&lt;br /&gt;
	self.difficultyslider:setPosition(29*8, 4.5*myappheight/10)&lt;br /&gt;
	-- order&lt;br /&gt;
	self:addChild(self.mytitle)&lt;br /&gt;
	self:addChild(self.bgmvolumeslider)&lt;br /&gt;
	self:addChild(self.sfxvolumeslider)&lt;br /&gt;
	self:addChild(self.difficultyslider)&lt;br /&gt;
	-- tooltip layer&lt;br /&gt;
	local tooltiplayer = Sprite.new()&lt;br /&gt;
	-- buttons&lt;br /&gt;
	local key&lt;br /&gt;
	self.sfxsound = {sound=Sound.new(&amp;quot;audio/ui/sfx_sounds_button1.wav&amp;quot;), time=0, delay=0.2}&lt;br /&gt;
	self.sfxvolume = g_sfxvolume * 0.01&lt;br /&gt;
	-- movement&lt;br /&gt;
	if (keyNames[g_keyleft] or 0) == 0 then key = utf8.char(g_keyleft)&lt;br /&gt;
	else key = keyNames[g_keyleft] -- display nice KeyCode name&lt;br /&gt;
	end&lt;br /&gt;
	self.btnLEFT = ButtonMonster.new({&lt;br /&gt;
		autoscale=false, pixelwidth=17*8, pixelheight=6*8,&lt;br /&gt;
		pixelscalexup=0.8, pixelscalexdown=0.9,&lt;br /&gt;
		pixelcolorup=g_ui_theme.pixelcolorup, pixelcolordown=g_ui_theme.pixelcolordown,&lt;br /&gt;
		text=key, ttf=myttf, textcolorup=g_ui_theme.textcolorup, textcolordown=g_ui_theme.textcolordown,&lt;br /&gt;
		sound=self.sfxsound, volume=self.sfxvolume,&lt;br /&gt;
		tooltiptext=&amp;quot;left&amp;quot;, tooltipttf=myttf, tooltiptextcolor=g_ui_theme.tooltiptextcolor,&lt;br /&gt;
		tooltipoffsetx=g_ui_theme.tooltipoffsetx, tooltipoffsety=g_ui_theme.tooltipoffsety,&lt;br /&gt;
	}, 2, tooltiplayer)&lt;br /&gt;
	if (keyNames[g_keyright] or 0) == 0 then key = utf8.char(g_keyright)&lt;br /&gt;
	else key = keyNames[g_keyright] -- display nice KeyCode name&lt;br /&gt;
	end&lt;br /&gt;
	self.btnRIGHT = ButtonMonster.new({&lt;br /&gt;
		autoscale=false, pixelwidth=17*8, pixelheight=6*8,&lt;br /&gt;
		pixelscalexup=0.8, pixelscalexdown=0.9,&lt;br /&gt;
		pixelcolorup=g_ui_theme.pixelcolorup, pixelcolordown=g_ui_theme.pixelcolordown,&lt;br /&gt;
		text=key, ttf=myttf, textcolorup=g_ui_theme.textcolorup, textcolordown=g_ui_theme.textcolordown,&lt;br /&gt;
		sound=self.sfxsound, volume=self.sfxvolume,&lt;br /&gt;
		tooltiptext=&amp;quot;right&amp;quot;, tooltipttf=myttf, tooltiptextcolor=g_ui_theme.tooltiptextcolor,&lt;br /&gt;
		tooltipoffsetx=g_ui_theme.tooltipoffsetx, tooltipoffsety=g_ui_theme.tooltipoffsety,&lt;br /&gt;
	}, 3, tooltiplayer)&lt;br /&gt;
	if (keyNames[g_keyup] or 0) == 0 then key = utf8.char(g_keyup)&lt;br /&gt;
	else key = keyNames[g_keyup] -- display nice KeyCode name&lt;br /&gt;
	end&lt;br /&gt;
	self.btnUP = ButtonMonster.new({&lt;br /&gt;
		autoscale=false, pixelwidth=17*8, pixelheight=6*8,&lt;br /&gt;
		pixelscalexup=0.8, pixelscalexdown=0.9,&lt;br /&gt;
		pixelcolorup=g_ui_theme.pixelcolorup, pixelcolordown=g_ui_theme.pixelcolordown,&lt;br /&gt;
		text=key, ttf=myttf, textcolorup=g_ui_theme.textcolorup, textcolordown=g_ui_theme.textcolordown,&lt;br /&gt;
		sound=self.sfxsound, volume=self.sfxvolume,&lt;br /&gt;
		tooltiptext=&amp;quot;up&amp;quot;, tooltipttf=myttf, tooltiptextcolor=g_ui_theme.tooltiptextcolor,&lt;br /&gt;
		tooltipoffsetx=g_ui_theme.tooltipoffsetx, tooltipoffsety=g_ui_theme.tooltipoffsety,&lt;br /&gt;
	}, 1, tooltiplayer)&lt;br /&gt;
	if (keyNames[g_keydown] or 0) == 0 then key = utf8.char(g_keydown)&lt;br /&gt;
	else key = keyNames[g_keydown] -- display nice KeyCode name&lt;br /&gt;
	end&lt;br /&gt;
	self.btnDOWN = ButtonMonster.new({&lt;br /&gt;
		autoscale=false, pixelwidth=17*8, pixelheight=6*8,&lt;br /&gt;
		pixelscalexup=0.8, pixelscalexdown=0.9,&lt;br /&gt;
		pixelcolorup=g_ui_theme.pixelcolorup, pixelcolordown=g_ui_theme.pixelcolordown,&lt;br /&gt;
		text=key, ttf=myttf, textcolorup=g_ui_theme.textcolorup, textcolordown=g_ui_theme.textcolordown,&lt;br /&gt;
		sound=self.sfxsound, volume=self.sfxvolume,&lt;br /&gt;
		tooltiptext=&amp;quot;down&amp;quot;, tooltipttf=myttf, tooltiptextcolor=g_ui_theme.tooltiptextcolor,&lt;br /&gt;
		tooltipoffsetx=g_ui_theme.tooltipoffsetx, tooltipoffsety=g_ui_theme.tooltipoffsety,&lt;br /&gt;
	}, 4, tooltiplayer)&lt;br /&gt;
	-- actions&lt;br /&gt;
	if (keyNames[g_keyaction1] or 0) == 0 then key = utf8.char(g_keyaction1)&lt;br /&gt;
	else key = keyNames[g_keyaction1] -- display nice KeyCode name&lt;br /&gt;
	end&lt;br /&gt;
	self.btnACTION1 = ButtonMonster.new({&lt;br /&gt;
		autoscale=false, pixelwidth=17*8, pixelheight=6*8,&lt;br /&gt;
		pixelscalexup=0.8, pixelscalexdown=0.9,&lt;br /&gt;
		pixelcolorup=g_ui_theme.pixelcolorup, pixelcolordown=g_ui_theme.pixelcolordown,&lt;br /&gt;
		text=key, ttf=myttf, textcolorup=g_ui_theme.textcolorup, textcolordown=g_ui_theme.textcolordown,&lt;br /&gt;
		sound=self.sfxsound, volume=self.sfxvolume,&lt;br /&gt;
		tooltiptext=&amp;quot;punch1&amp;quot;, tooltipttf=myttf, tooltiptextcolor=g_ui_theme.tooltiptextcolor,&lt;br /&gt;
		tooltipoffsetx=g_ui_theme.tooltipoffsetx, tooltipoffsety=g_ui_theme.tooltipoffsety,&lt;br /&gt;
	}, 5, tooltiplayer)&lt;br /&gt;
	if (keyNames[g_keyaction2] or 0) == 0 then key = utf8.char(g_keyaction2)&lt;br /&gt;
	else key = keyNames[g_keyaction2] -- display nice KeyCode name&lt;br /&gt;
	end&lt;br /&gt;
	self.btnACTION2 = ButtonMonster.new({&lt;br /&gt;
		autoscale=false, pixelwidth=17*8, pixelheight=6*8,&lt;br /&gt;
		pixelscalexup=0.8, pixelscalexdown=0.9,&lt;br /&gt;
		pixelcolorup=g_ui_theme.pixelcolorup, pixelcolordown=g_ui_theme.pixelcolordown,&lt;br /&gt;
		text=key, ttf=myttf, textcolorup=g_ui_theme.textcolorup, textcolordown=g_ui_theme.textcolordown,&lt;br /&gt;
		sound=self.sfxsound, volume=self.sfxvolume,&lt;br /&gt;
		tooltiptext=&amp;quot;punch2&amp;quot;, tooltipttf=myttf, tooltiptextcolor=g_ui_theme.tooltiptextcolor,&lt;br /&gt;
		tooltipoffsetx=g_ui_theme.tooltipoffsetx, tooltipoffsety=g_ui_theme.tooltipoffsety,&lt;br /&gt;
	}, 6, tooltiplayer)&lt;br /&gt;
	if (keyNames[g_keyaction3] or 0) == 0 then key = utf8.char(g_keyaction3)&lt;br /&gt;
	else key = keyNames[g_keyaction3] -- display nice KeyCode name&lt;br /&gt;
	end&lt;br /&gt;
	self.btnACTION3 = ButtonMonster.new({&lt;br /&gt;
		autoscale=false, pixelwidth=17*8, pixelheight=6*8,&lt;br /&gt;
		pixelscalexup=0.8, pixelscalexdown=0.9,&lt;br /&gt;
		pixelcolorup=g_ui_theme.pixelcolorup, pixelcolordown=g_ui_theme.pixelcolordown,&lt;br /&gt;
		text=key, ttf=myttf, textcolorup=g_ui_theme.textcolorup, textcolordown=g_ui_theme.textcolordown,&lt;br /&gt;
		sound=self.sfxsound, volume=self.sfxvolume,&lt;br /&gt;
		tooltiptext=&amp;quot;jump punch&amp;quot;, tooltipttf=myttf, tooltiptextcolor=g_ui_theme.tooltiptextcolor,&lt;br /&gt;
		tooltipoffsetx=g_ui_theme.tooltipoffsetx, tooltipoffsety=g_ui_theme.tooltipoffsety,&lt;br /&gt;
	}, 7, tooltiplayer)&lt;br /&gt;
	-- btn menu&lt;br /&gt;
	self.btnMENU = ButtonMonster.new({&lt;br /&gt;
		autoscale=false, pixelwidth=12*8, pixelheight=6*8,&lt;br /&gt;
		pixelscalexup=0.8, pixelscalexdown=0.9,&lt;br /&gt;
		pixelcolorup=g_ui_theme.pixelcolorup, pixelcolordown=g_ui_theme.pixelcolordown,&lt;br /&gt;
		text=&amp;quot;MENU&amp;quot;, ttf=myttf, textcolorup=0x0009B3, textcolordown=0x45d1ff,&lt;br /&gt;
		sound=self.sfxsound, volume=self.sfxvolume,&lt;br /&gt;
		tooltiptext=&amp;quot;Enter&amp;quot;, tooltipttf=myttf, tooltiptextcolor=g_ui_theme.tooltiptextcolor,&lt;br /&gt;
		tooltipoffsetx=g_ui_theme.tooltipoffsetx, tooltipoffsety=g_ui_theme.tooltipoffsety,&lt;br /&gt;
	}, 8, tooltiplayer)&lt;br /&gt;
	-- put the btns in a table for keyboard navigation&lt;br /&gt;
	self.btns = {}&lt;br /&gt;
	self.btns[#self.btns + 1] = self.btnUP -- 1&lt;br /&gt;
	self.btns[#self.btns + 1] = self.btnLEFT -- 2&lt;br /&gt;
	self.btns[#self.btns + 1] = self.btnRIGHT -- 3&lt;br /&gt;
	self.btns[#self.btns + 1] = self.btnDOWN -- 4&lt;br /&gt;
	self.btns[#self.btns + 1] = self.btnACTION1 -- 5&lt;br /&gt;
	self.btns[#self.btns + 1] = self.btnACTION2 -- 6&lt;br /&gt;
	self.btns[#self.btns + 1] = self.btnACTION3 -- 7&lt;br /&gt;
	self.btns[#self.btns + 1] = self.btnMENU -- 8&lt;br /&gt;
	self.selector = 1 -- starting button&lt;br /&gt;
	self.iskeyboardnavigation = false&lt;br /&gt;
	-- position&lt;br /&gt;
	self.btnLEFT:setPosition(1.5*myappwidth/10+myappleft, 6*8+6*myappheight/10)&lt;br /&gt;
	self.btnRIGHT:setPosition(3.5*myappwidth/10+myappleft, 6*8+6*myappheight/10)&lt;br /&gt;
	self.btnUP:setPosition(2.5*myappwidth/10+myappleft, 6*8+4.6*myappheight/10)&lt;br /&gt;
	self.btnDOWN:setPosition(2.5*myappwidth/10+myappleft, 6*8+7.4*myappheight/10)&lt;br /&gt;
	for i = 5, 7 do -- buttons (eg. punch, ...)&lt;br /&gt;
		self.btns[i]:setPosition(5.6*myappwidth/10+myappleft, (i-5)*6*8+6*myappheight/10)&lt;br /&gt;
	end&lt;br /&gt;
	for i = 8, #self.btns-1 do -- buttons (eg. kick, ...)&lt;br /&gt;
		self.btns[i]:setPosition(7.6*myappwidth/10+myappleft, (i-8)*6*8+6*myappheight/10)&lt;br /&gt;
	end&lt;br /&gt;
	self.btnMENU:setPosition(myappwidth-self.btnMENU:getWidth()/2+myappleft, myappheight-self.btnMENU:getHeight()/2)&lt;br /&gt;
	-- order&lt;br /&gt;
	for k, v in ipairs(self.btns) do self:addChild(v) end&lt;br /&gt;
	self:addChild(tooltiplayer) -- last add tooltip layer&lt;br /&gt;
	-- sliders listeners&lt;br /&gt;
	self.bgmvolumeslider:addEventListener(&amp;quot;value_just_changed&amp;quot;, self.onValueJustChanged, self)&lt;br /&gt;
	self.bgmvolumeslider:addEventListener(&amp;quot;value_changing&amp;quot;, self.onValueChanging, self)&lt;br /&gt;
	self.bgmvolumeslider:addEventListener(&amp;quot;value_changed&amp;quot;, self.onValueChanged, self)&lt;br /&gt;
	self.sfxvolumeslider:addEventListener(&amp;quot;value_just_changed&amp;quot;, self.onValueJustChanged, self)&lt;br /&gt;
	self.sfxvolumeslider:addEventListener(&amp;quot;value_changing&amp;quot;, self.onValueChanging, self)&lt;br /&gt;
	self.sfxvolumeslider:addEventListener(&amp;quot;value_changed&amp;quot;, self.onValueChanged, self)&lt;br /&gt;
	self.difficultyslider:addEventListener(&amp;quot;value_just_changed&amp;quot;, self.onValueJustChanged, self)&lt;br /&gt;
	self.difficultyslider:addEventListener(&amp;quot;value_changing&amp;quot;, self.onValueChanging, self)&lt;br /&gt;
	self.difficultyslider:addEventListener(&amp;quot;value_changed&amp;quot;, self.onValueChanged, self)&lt;br /&gt;
	-- buttons listeners&lt;br /&gt;
	for k, v in ipairs(self.btns) do&lt;br /&gt;
--		v:addEventListener(&amp;quot;pressed&amp;quot;, function(e) -- e.currselector, e.disabled&lt;br /&gt;
--			self.selector = k&lt;br /&gt;
--			self:keyActions()&lt;br /&gt;
--		end)&lt;br /&gt;
		v:addEventListener(&amp;quot;clicked&amp;quot;, function(e) -- e.currselector, e.disabled&lt;br /&gt;
			self:cancelKeyRemapping() -- setColorTransform, self.isremapping = false, updateButton()&lt;br /&gt;
			self.selector = k&lt;br /&gt;
			self:keyActions()&lt;br /&gt;
		end)&lt;br /&gt;
		v:addEventListener(&amp;quot;hovered&amp;quot;, function(e) -- e.currselector, e.disabled&lt;br /&gt;
			if not self.isremapping then&lt;br /&gt;
				self.selector = e.currselector&lt;br /&gt;
			end&lt;br /&gt;
		end)&lt;br /&gt;
		v.btns = self.btns -- for keyboard navigation&lt;br /&gt;
	end&lt;br /&gt;
	-- mouse listener&lt;br /&gt;
	self:addEventListener(Event.MOUSE_DOWN, function(e)&lt;br /&gt;
		if self:hitTestPoint(e.x, e.y) then -- cancel key remapping&lt;br /&gt;
			self.iskeyboardnavigation = false&lt;br /&gt;
			self:cancelKeyRemapping()&lt;br /&gt;
			e:stopPropagation()&lt;br /&gt;
		end&lt;br /&gt;
	end)&lt;br /&gt;
	-- let&amp;#039;s go!&lt;br /&gt;
	self:difficulty(g_difficulty)&lt;br /&gt;
	self.isremapping = false&lt;br /&gt;
	self:myKeysPressed()&lt;br /&gt;
	self:updateButton()&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
-- sliders&lt;br /&gt;
function Options:difficulty(x) -- translate int to text&lt;br /&gt;
	if x &amp;gt;= 2 then self.difficultyslider.textfield:setText(&amp;quot;DIFFICULTY: \e[color=#ddc]HARD\e[color]&amp;quot;)&lt;br /&gt;
	elseif x &amp;gt;= 1 then self.difficultyslider.textfield:setText(&amp;quot;DIFFICULTY: \e[color=#ddc]NORMAL\e[color]&amp;quot;)&lt;br /&gt;
	else self.difficultyslider.textfield:setText(&amp;quot;DIFFICULTY: \e[color=#ddc]EASY\e[color]&amp;quot;)&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
function Options:onValueJustChanged(e)&lt;br /&gt;
	self:cancelKeyRemapping()&lt;br /&gt;
	if e.id == 1 then -- bgm volume&lt;br /&gt;
		g_bgmvolume = e.value&lt;br /&gt;
		self.bgmvolumeslider:setValue(g_bgmvolume)&lt;br /&gt;
	elseif e.id == 2 then -- sfx volume&lt;br /&gt;
		g_sfxvolume = e.value&lt;br /&gt;
		self.sfxvolumeslider:setValue(g_sfxvolume)&lt;br /&gt;
	elseif e.id == 3 then -- difficulty&lt;br /&gt;
		g_difficulty = e.value&lt;br /&gt;
		self:difficulty(g_difficulty)&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
function Options:onValueChanging(e)&lt;br /&gt;
	if e.id == 1 then -- bgm volume&lt;br /&gt;
		g_bgmvolume = e.value&lt;br /&gt;
		self.bgmvolumeslider:setValue(g_bgmvolume)&lt;br /&gt;
	elseif e.id == 2 then -- sfx volume&lt;br /&gt;
		g_sfxvolume = e.value&lt;br /&gt;
		self.sfxvolumeslider:setValue(g_sfxvolume)&lt;br /&gt;
	elseif e.id == 3 then -- difficulty&lt;br /&gt;
		self:difficulty(e.value)&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
function Options:onValueChanged(e)&lt;br /&gt;
	if e.id == 1 then -- bgm volume&lt;br /&gt;
		g_bgmvolume = e.value&lt;br /&gt;
		local audio = Sound.new(&amp;quot;audio/ui/sfx_sounds_button1.wav&amp;quot;)&lt;br /&gt;
		local channel = audio:play() -- feedback&lt;br /&gt;
		if channel then channel:setVolume(g_bgmvolume*0.01) end&lt;br /&gt;
		self.bgmvolumeslider:setValue(g_bgmvolume)&lt;br /&gt;
	elseif e.id == 2 then -- sfx volume&lt;br /&gt;
		g_sfxvolume = e.value&lt;br /&gt;
		local audio = Sound.new(&amp;quot;audio/ui/sfx_sounds_button1.wav&amp;quot;)&lt;br /&gt;
		local channel = audio:play() -- feedback&lt;br /&gt;
		if channel then channel:setVolume(g_sfxvolume*0.01) end&lt;br /&gt;
		self.sfxvolumeslider:setValue(g_sfxvolume)&lt;br /&gt;
		for _, v in pairs(self.btns) do v:setVolume(g_sfxvolume*0.01) end -- change the ui buttons sfx volume&lt;br /&gt;
	elseif e.id == 3 then -- difficulty&lt;br /&gt;
		g_difficulty = e.value&lt;br /&gt;
		self:difficulty(g_difficulty)&lt;br /&gt;
	end&lt;br /&gt;
	mySavePrefs(g_configfilepath)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
-- key remapping&lt;br /&gt;
function Options:remapKey(xbool)&lt;br /&gt;
	local btn = self.btns[self.selector]&lt;br /&gt;
	if xbool then btn:setColorTransform(255/255, 255/255, 0/255, 255/255)&lt;br /&gt;
	else btn:setColorTransform(255/255, 255/255, 255/255, 255/255)&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
function Options:cancelKeyRemapping()&lt;br /&gt;
	self.isremapping = false&lt;br /&gt;
	self:remapKey(self.isremapping)&lt;br /&gt;
	self:updateButton()&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
-- update button state&lt;br /&gt;
function Options:updateButton()&lt;br /&gt;
	for k, v in ipairs(self.btns) do&lt;br /&gt;
		v.currselector = self.selector&lt;br /&gt;
		v:updateVisualState()&lt;br /&gt;
		if self.iskeyboardnavigation then&lt;br /&gt;
			if k == self.selector then v:selectionSfx() end&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
-- keys handler&lt;br /&gt;
function Options:myKeysPressed()&lt;br /&gt;
	self:addEventListener(Event.KEY_DOWN, function(e)&lt;br /&gt;
		if self.isremapping then -- KEY REMAPPING&lt;br /&gt;
			if e.keyCode == KeyCode.ESC or e.keyCode == KeyCode.ENTER then&lt;br /&gt;
				self:cancelKeyRemapping()&lt;br /&gt;
				return&lt;br /&gt;
			end&lt;br /&gt;
			local keycode = e.keyCode&lt;br /&gt;
			local key = keyNames[keycode]&lt;br /&gt;
			if (keyNames[keycode] or 0) == 0 then key = utf8.char(keycode) end&lt;br /&gt;
			self.btns[self.selector]:changeText(key)&lt;br /&gt;
			if self.selector == 1 then g_keyup = keycode -- follows self.btns order&lt;br /&gt;
			elseif self.selector == 2 then g_keyleft = keycode -- follows self.btns order&lt;br /&gt;
			elseif self.selector == 3 then g_keyright = keycode -- follows self.btns order&lt;br /&gt;
			elseif self.selector == 4 then g_keydown = keycode -- follows self.btns order&lt;br /&gt;
			elseif self.selector == 5 then g_keyaction1 = keycode -- follows self.btns order&lt;br /&gt;
			elseif self.selector == 6 then g_keyaction2 = keycode -- follows self.btns order&lt;br /&gt;
			elseif self.selector == 7 then g_keyaction3 = keycode -- follows self.btns order&lt;br /&gt;
			end&lt;br /&gt;
			self:cancelKeyRemapping()&lt;br /&gt;
			mySavePrefs(g_configfilepath)&lt;br /&gt;
		else -- KEYBOARD NAVIGATION&lt;br /&gt;
			if e.keyCode == KeyCode.ESC or e.keyCode == KeyCode.BACK then self:gotoScene() end&lt;br /&gt;
			-- keyboard&lt;br /&gt;
			if e.keyCode == KeyCode.UP or e.keyCode == g_keyup or e.keyCode == KeyCode.LEFT or e.keyCode == g_keyleft then&lt;br /&gt;
				self.selector -= 1 if self.selector &amp;lt; 1 then self.selector = #self.btns end&lt;br /&gt;
				self.iskeyboardnavigation = true&lt;br /&gt;
				self:updateButton()&lt;br /&gt;
			elseif e.keyCode == KeyCode.DOWN or e.keyCode == g_keydown or e.keyCode == KeyCode.RIGHT or e.keyCode == g_keyright then&lt;br /&gt;
				self.selector += 1 if self.selector &amp;gt; #self.btns then self.selector = 1 end&lt;br /&gt;
				self.iskeyboardnavigation = true&lt;br /&gt;
				self:updateButton()&lt;br /&gt;
			end&lt;br /&gt;
			-- modifier&lt;br /&gt;
			local modifier = application:getKeyboardModifiers()&lt;br /&gt;
			local alt = (modifier &amp;amp; KeyCode.MODIFIER_ALT) &amp;gt; 0&lt;br /&gt;
			if not alt and (e.keyCode == KeyCode.ENTER or e.keyCode == KeyCode.SPACE or e.keyCode == g_keyaction1) then -- validate&lt;br /&gt;
				self:keyActions()&lt;br /&gt;
			elseif alt and e.keyCode == KeyCode.ENTER then -- switch full screen&lt;br /&gt;
				if not application:isPlayerMode() then&lt;br /&gt;
					ismyappfullscreen = not ismyappfullscreen&lt;br /&gt;
					application:setFullScreen(ismyappfullscreen)&lt;br /&gt;
				end&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
	end)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
-- buttons actions&lt;br /&gt;
function Options:keyActions()&lt;br /&gt;
	self.isremapping = false&lt;br /&gt;
	for k, v in ipairs(self.btns) do&lt;br /&gt;
		if k == self.selector then&lt;br /&gt;
			if v.isdisabled then&lt;br /&gt;
				print(&amp;quot;btn disabled!&amp;quot;, k)&lt;br /&gt;
			elseif k &amp;gt;= 1 and k &amp;lt;= #self.btns-1 then -- action buttons&lt;br /&gt;
				self.isremapping = true&lt;br /&gt;
				self:remapKey(self.isremapping)&lt;br /&gt;
			elseif k == #self.btns then -- MENU button&lt;br /&gt;
				self:gotoScene()&lt;br /&gt;
			else&lt;br /&gt;
				print(&amp;quot;nothing here!&amp;quot;, k)&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
-- scenes navigation&lt;br /&gt;
function Options:gotoScene()&lt;br /&gt;
	self:removeAllListeners()&lt;br /&gt;
	for i = stage:getNumChildren(), 1, -1 do&lt;br /&gt;
		stage:removeChildAt(i)&lt;br /&gt;
	end collectgarbage()&lt;br /&gt;
	stage:addChild(Transitions.new(Menu.new())) -- next scene&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Code comments ==&lt;br /&gt;
In the &amp;#039;&amp;#039;init&amp;#039;&amp;#039; function we add some assets like a sound to play for the buttons when hovered.&lt;br /&gt;
&lt;br /&gt;
We add our buttons:&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;START&amp;#039;&amp;#039;&amp;#039; goes to the game scene&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;OPTIONS&amp;#039;&amp;#039;&amp;#039; goes to the options scene&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;EXIT&amp;#039;&amp;#039;&amp;#039; exits the game&lt;br /&gt;
&lt;br /&gt;
We use the g_difficulty value and transform it to text. The value transformed to text will serve as a tooltip. This is of course optional but I add it here for demonstration.&lt;br /&gt;
&lt;br /&gt;
The buttons have many options to configure but they should be easy to implement/understand.&lt;br /&gt;
&lt;br /&gt;
The numbers at the end of each buttons are selectors. They are the buttons id and are used for navigation. Please make sure to assign them accordingly.&lt;br /&gt;
&lt;br /&gt;
All the buttons are put in a table which will serve navigating with the keyboard.&lt;br /&gt;
&lt;br /&gt;
The buttons are then positioned and listeners are added.&lt;br /&gt;
&lt;br /&gt;
=== updateButton ===&lt;br /&gt;
This function updates the button visual state and plays sound when navigating with the keyboard.&lt;br /&gt;
&lt;br /&gt;
=== keyboard navigation ===&lt;br /&gt;
This function listens for KEY_DOWN events to navigate through the buttons with the keyboard.&lt;br /&gt;
&lt;br /&gt;
The ESC key or the BACK button key on mobile will exit the app.&lt;br /&gt;
&lt;br /&gt;
Pressing ALT+ENTER will make the game fullscreen.&lt;br /&gt;
&lt;br /&gt;
Pressing SPACE, ENTER or g_keyaction1 will validate an action.&lt;br /&gt;
&lt;br /&gt;
=== gotoScene ===&lt;br /&gt;
This function will either:&lt;br /&gt;
* do nothing if button is disabled&lt;br /&gt;
* navigate to the next scene corresponding to the button id&lt;br /&gt;
* exit the game&lt;br /&gt;
&lt;br /&gt;
== Next? ==&lt;br /&gt;
The final scene for this template: the &amp;#039;&amp;#039;&amp;#039;Game&amp;#039;&amp;#039;&amp;#039; scene.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Prev.: [[Tuto Gideros Game Template1 Part 5 Menu]]&amp;lt;/br&amp;gt;&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Next: [[Tuto Gideros Game Template1 Part 7 Game]]&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;[[Tutorial - Gideros Game Template1]]&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
{{GIDEROS IMPORTANT LINKS}}&lt;/div&gt;</summary>
		<author><name>MoKaLux</name></author>
	</entry>
</feed>