首先,这是我第一次编写代码,所以我是新手。
我正在使用 devkit pro 为 nds 写作,所以它都是用 c++ 编写的。我想要一个菜单,每个菜单屏幕都是一个空白,我需要有办法回到上一个菜单。
此外,我确保在实际代码中没有语法错误(除非未在此范围内声明被视为语法错误)。
如果没有得到“错误'设置'未在此范围内声明”,我该如何做到这一点。代码:
//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();
}
}
并且注意,在这段代码之外的某个地方,mainMenu() 会被激活。那么有人知道如何正确编码吗?
提前致谢。