How to create a dialog box in the plot window.
As a personal project, I have been writing a game engine in Matlab. It will be a sort of text-based RPG, where you input your command into a text box and then the game interprets that. Right now, this is the state of my getCommand function:
function GetCommand(n)
sprintf("GetCommand %d", n)
pause(0.1)
String = input(‘Input n’, ‘s’);
String = split(String);
Command = String{1,1};
Subject = String{2,1};
switch command
case ‘go’
go(subject)
end
The idea is to run Command through a switch function to find that command, and run the command using Subject as its argument.
It currently works well enough. However, the input function requests input directly from Matlab’s command line. I would like to request input from the plot window, which is where I’m rendering the game. I found inputdlg(), but that creates an entirely new window, which is not what I want either.
I hope I made myself clear. Is there any way to create a dialog box within the plot window?As a personal project, I have been writing a game engine in Matlab. It will be a sort of text-based RPG, where you input your command into a text box and then the game interprets that. Right now, this is the state of my getCommand function:
function GetCommand(n)
sprintf("GetCommand %d", n)
pause(0.1)
String = input(‘Input n’, ‘s’);
String = split(String);
Command = String{1,1};
Subject = String{2,1};
switch command
case ‘go’
go(subject)
end
The idea is to run Command through a switch function to find that command, and run the command using Subject as its argument.
It currently works well enough. However, the input function requests input directly from Matlab’s command line. I would like to request input from the plot window, which is where I’m rendering the game. I found inputdlg(), but that creates an entirely new window, which is not what I want either.
I hope I made myself clear. Is there any way to create a dialog box within the plot window? As a personal project, I have been writing a game engine in Matlab. It will be a sort of text-based RPG, where you input your command into a text box and then the game interprets that. Right now, this is the state of my getCommand function:
function GetCommand(n)
sprintf("GetCommand %d", n)
pause(0.1)
String = input(‘Input n’, ‘s’);
String = split(String);
Command = String{1,1};
Subject = String{2,1};
switch command
case ‘go’
go(subject)
end
The idea is to run Command through a switch function to find that command, and run the command using Subject as its argument.
It currently works well enough. However, the input function requests input directly from Matlab’s command line. I would like to request input from the plot window, which is where I’m rendering the game. I found inputdlg(), but that creates an entirely new window, which is not what I want either.
I hope I made myself clear. Is there any way to create a dialog box within the plot window? user input, string, plot window, plotting, dialog box MATLAB Answers — New Questions