首先,这是我第一次编写代码,所以我是新手。
我正在使用devkit pro为nds编写代码,所以所有代码都是用c++编写的。我想要一个菜单,每个菜单屏幕都是void类型,并且我需要有一种方法返回到上一个菜单。
此外,我确保实际代码中没有语法错误(除非在此范围内未声明被视为语法错误)。
如何避免出现“Error 'settings' was not declared in this scope”错误? 代码:
AND NOTE,这段代码之外的某个地方将激活mainMenu()。那么,有谁知道如何正确编写此代码?
提前感谢。
我正在使用devkit pro为nds编写代码,所以所有代码都是用c++编写的。我想要一个菜单,每个菜单屏幕都是void类型,并且我需要有一种方法返回到上一个菜单。
此外,我确保实际代码中没有语法错误(除非在此范围内未声明被视为语法错误)。
如何避免出现“Error 'settings' was not declared in this scope”错误? 代码:
//Headers go here
void controls()
{
//Inits and what not go here
if (key_press & key_down)
/*This is generally how you say if the down key has been pressed (This syntax might be wrong, but ignore that part)*/
{
settings(); //This part doesn't work because it can't read back in the code
}
}
void settings()
{
//Inits and what not go here
if (key_press & key_down)
{
controls();
}
}
void mainMenu()
{
//Inits and what not go here
if (key_press & key_down)
{
settings();
}
}
AND NOTE,这段代码之外的某个地方将激活mainMenu()。那么,有谁知道如何正确编写此代码?
提前感谢。