menuAppendStringImage
function menuAppendStringImage(text: string; img:image): integer;
Appends a string entry to current menu. The entry contains an image next to the text. The function returns the index of the new entry within the menu.
var tetris, minesweeper, snake : integer;
play, clicked : command;
begin
showMenu('Select a game', CH_IMPLICIT);
tetris := menuAppendStringImage('Tetris', loadImage('/tetris.png'));
minesweeper := menuAppendStringImage('Minesweeper', loadImage('/mine.png'));
snake := menuAppendStringImage('Snake', loadImage('/snake.png'));
play := createCommand('Play', CM_SCREEN, 1);
addCommand(play);
repeat
delay(100);
clicked := getClickedCommand;
until clicked = play;
showCanvas; // show canvas and remove menu from the screen
if menuGetSelectedIndex = tetris then playTetris;
if menuGetSelectedIndex = minesweeper then playMinesweeper;
if menuGetSelectedIndex = snake then playSnake;
...
end.
See also: showMenu, menuAppendString, menuIsSelected, menuGetSelectedIndex