<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
		<id>https://aoineko.org/msxgl/index.php?action=history&amp;feed=atom&amp;title=Modules%2Fgame%2Fmenu%2FUsage</id>
		<title>Modules/game/menu/Usage - Revision history</title>
		<link rel="self" type="application/atom+xml" href="https://aoineko.org/msxgl/index.php?action=history&amp;feed=atom&amp;title=Modules%2Fgame%2Fmenu%2FUsage"/>
		<link rel="alternate" type="text/html" href="https://aoineko.org/msxgl/index.php?title=Modules/game/menu/Usage&amp;action=history"/>
		<updated>2026-04-24T10:46:10Z</updated>
		<subtitle>Revision history for this page on the wiki</subtitle>
		<generator>MediaWiki 1.30.2</generator>

	<entry>
		<id>https://aoineko.org/msxgl/index.php?title=Modules/game/menu/Usage&amp;diff=3395&amp;oldid=prev</id>
		<title>Aoineko: Aoineko moved page Modules/game menu/Usage to Modules/game/menu/Usage without leaving a redirect</title>
		<link rel="alternate" type="text/html" href="https://aoineko.org/msxgl/index.php?title=Modules/game/menu/Usage&amp;diff=3395&amp;oldid=prev"/>
				<updated>2025-09-22T21:56:01Z</updated>
		
		<summary type="html">&lt;p&gt;Aoineko moved page &lt;a href=&quot;/msxgl/index.php?title=Modules/game_menu/Usage&amp;amp;action=edit&amp;amp;redlink=1&quot; class=&quot;new&quot; title=&quot;Modules/game menu/Usage (page does not exist)&quot;&gt;Modules/game menu/Usage&lt;/a&gt; to &lt;a href=&quot;/msxgl/index.php?title=Modules/game/menu/Usage&quot; title=&quot;Modules/game/menu/Usage&quot;&gt;Modules/game/menu/Usage&lt;/a&gt; without leaving a redirect&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left&quot; data-mw=&quot;interface&quot;&gt;
				&lt;tr style=&quot;vertical-align: top;&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;Revision as of 21:56, 22 September 2025&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; style=&quot;text-align: center;&quot; lang=&quot;en&quot;&gt;&lt;div class=&quot;mw-diff-empty&quot;&gt;(No difference)&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;</summary>
		<author><name>Aoineko</name></author>	</entry>

	<entry>
		<id>https://aoineko.org/msxgl/index.php?title=Modules/game/menu/Usage&amp;diff=1926&amp;oldid=prev</id>
		<title>Aoineko: /* Exemple */</title>
		<link rel="alternate" type="text/html" href="https://aoineko.org/msxgl/index.php?title=Modules/game/menu/Usage&amp;diff=1926&amp;oldid=prev"/>
				<updated>2024-01-05T09:20:28Z</updated>
		
		<summary type="html">&lt;p&gt;‎&lt;span dir=&quot;auto&quot;&gt;&lt;span class=&quot;autocomment&quot;&gt;Exemple&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left&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 style=&quot;vertical-align: top;&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;Revision as of 09:20, 5 January 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-l42&quot; &gt;Line 42:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 42:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;=== Exemple ===&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;=== Exemple ===&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color:black; 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;Here's an example of a &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;table &lt;/del&gt;with 2 pages (Main and Option) each containing 5 entries.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; 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;Here's an example of a &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;menu &lt;/ins&gt;with 2 pages (Main and Option) each containing 5 entries.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;syntaxhighlight lang=&amp;quot;c&amp;quot;&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;syntaxhighlight lang=&amp;quot;c&amp;quot;&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;// Entries description for the Main menu&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;// Entries description for the Main menu&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Aoineko</name></author>	</entry>

	<entry>
		<id>https://aoineko.org/msxgl/index.php?title=Modules/game/menu/Usage&amp;diff=1897&amp;oldid=prev</id>
		<title>Aoineko: Created page with &quot;The module is data-driven, meaning that its behavior is completely determined by the data passed to it. The system is based on two structures.   Structure that represents an e...&quot;</title>
		<link rel="alternate" type="text/html" href="https://aoineko.org/msxgl/index.php?title=Modules/game/menu/Usage&amp;diff=1897&amp;oldid=prev"/>
				<updated>2024-01-04T23:20:16Z</updated>
		
		<summary type="html">&lt;p&gt;Created page with &amp;quot;The module is data-driven, meaning that its behavior is completely determined by the data passed to it. The system is based on two structures.   Structure that represents an e...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;The module is data-driven, meaning that its behavior is completely determined by the data passed to it. The system is based on two structures. &lt;br /&gt;
&lt;br /&gt;
Structure that represents an entry on a menu page:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
// Menu item structure&lt;br /&gt;
typedef struct&lt;br /&gt;
{&lt;br /&gt;
	const c8* Text;		// Name of the item&lt;br /&gt;
	u8        Type;		// Type of the item (see &amp;lt;MENU_ITEM_TYPE&amp;gt;)&lt;br /&gt;
	void*     Action;	// Action associated to the item (depends on item type)&lt;br /&gt;
	i16       Value;	// Value associated to the item (depends on item type)&lt;br /&gt;
} MenuItem;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Structure that represents a complete page:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
// Menu structure&lt;br /&gt;
typedef struct&lt;br /&gt;
{&lt;br /&gt;
	const c8* Title;		// Title of the page (NULL means no title)&lt;br /&gt;
	MenuItem* Items;		// List of the page's menu entries&lt;br /&gt;
	u8        ItemNum;		// Number of the page's menu entries&lt;br /&gt;
	callback  Callback;		// Function to be called when page is opened&lt;br /&gt;
} Menu;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A page is generally composed of a list of entries, and a menu is composed of a list of pages.&lt;br /&gt;
&lt;br /&gt;
The menu system initialization function (&amp;lt;tt&amp;gt;Menu_Initialize&amp;lt;/tt&amp;gt;) takes as its parameter an array of pages representing a whole menu.&lt;br /&gt;
&lt;br /&gt;
=== Menu item types ===&lt;br /&gt;
Here's a list of possible menu entry types and how they use the 'Action' and 'Value' parameters:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
MENU_ITEM_ACTION	// Execute callback function defined in 'Action' with 'Value' as a parameter&lt;br /&gt;
MENU_ITEM_GOTO		// Change page to the one defined in 'Value'&lt;br /&gt;
MENU_ITEM_INT		// Handle pointer to 8-bits integer defined in 'Action' (can be incremented or decremented)&lt;br /&gt;
MENU_ITEM_BOOL		// Handle pointer to boolean defined in 'Action' (can be turned ON or OFF)&lt;br /&gt;
MENU_ITEM_TEXT		// Handle pointer to zero-terminated string (non-interactive)&lt;br /&gt;
MENU_ITEM_EMPTY		// Empty entry (used to create an empty gap in the menu)&lt;br /&gt;
MENU_ITEM_UPDATE	// Execute callback function defined in 'Action' with 'Value' as a parameter every frame&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Exemple ===&lt;br /&gt;
Here's an example of a table with 2 pages (Main and Option) each containing 5 entries.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
// Entries description for the Main menu&lt;br /&gt;
const MenuItem g_MenuMain[] =&lt;br /&gt;
{&lt;br /&gt;
	{ &amp;quot;Start&amp;quot;,               MENU_ITEM_ACTION, MenuAction_Start, 1 }, // Entry to start a game (will trigger MenuAction_Start with 'value' parameter equal to '1')&lt;br /&gt;
	{ &amp;quot;Options&amp;quot;,             MENU_ITEM_GOTO, NULL, MENU_OPTION },     // Entry to go to Option menu page (page are defined using their index into the menu structure)&lt;br /&gt;
	{ &amp;quot;Align&amp;quot;,               MENU_ITEM_GOTO, NULL, MENU_ALIGN },      // Entry to go to Align menu page&lt;br /&gt;
	{ NULL,                  MENU_ITEM_EMPTY, NULL, 0 },              // Blank entry to create a gap&lt;br /&gt;
	{ &amp;quot;Exit&amp;quot;,                MENU_ITEM_ACTION, MenuAction_Start, 0 }, // Entry to exit the game (will trigger MenuAction_Start with 'value' parameter equal to '0')&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
// Entries description for the Option menu&lt;br /&gt;
MenuItem g_MenuOption[] =&lt;br /&gt;
{&lt;br /&gt;
	{ &amp;quot;Mode&amp;quot;,                MENU_ITEM_ACTION, MenuAction_Screen, 0 }, // Entry to change the screen mode (will trigger MenuAction_Screen)&lt;br /&gt;
	{ &amp;quot;Integer&amp;quot;,             MENU_ITEM_INT, &amp;amp;g_Integer, 0 },           // Entry to edit an integer&lt;br /&gt;
	{ &amp;quot;Boolean&amp;quot;,             MENU_ITEM_BOOL, &amp;amp;g_Boolean, 0 },          // Entry to edit a boolean&lt;br /&gt;
	{ NULL,                  MENU_ITEM_EMPTY, NULL, 0 },               // Blank entry to create a gap&lt;br /&gt;
	{ &amp;quot;Back&amp;quot;,                MENU_ITEM_GOTO, NULL, MENU_MAIN },        // Entry to go back to the main menu&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
// List of all menus&lt;br /&gt;
const Menu g_Menus[MENU_MAX] =&lt;br /&gt;
{&lt;br /&gt;
	{ &amp;quot;Main&amp;quot;,    g_MenuMain,   numberof(g_MenuMain),   NULL }, // MENU_MAIN&lt;br /&gt;
	{ &amp;quot;Options&amp;quot;, g_MenuOption, numberof(g_MenuOption), NULL }, // MENU_OPTION&lt;br /&gt;
};&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
Then, you can initialize the menu using: &amp;lt;tt&amp;gt;Menu_Initialize(&amp;amp;g_Menus);&amp;lt;/tt&amp;gt;&lt;/div&gt;</summary>
		<author><name>Aoineko</name></author>	</entry>

	</feed>