本文整理汇总了C++中View::Init方法的典型用法代码示例。如果您正苦于以下问题:C++ View::Init方法的具体用法?C++ View::Init怎么用?C++ View::Init使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类View
的用法示例。
在下文中一共展示了View::Init方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
void main(void)
{
Model* model = new CMainMenuModel();
View* view = new CMainMenuView(model); // this is the view that changes
Controller* controller = new CMainMenuController(model, view);
// Initialize GLFW
if (!glfwInit()) exit(EXIT_FAILURE);
controller->Init();
glewExperimental = true; // Needed for core profile
// Initialize GLEW
if (glewInit() != GLEW_OK) exit(EXIT_FAILURE);
view->Init();
model->Init();
GLFWwindow *window = view->getWindow();
MenuBGM1->play2D("../irrKlang/media/Menu.mp3", true);
int n = true;
while(true)
{
try{
controller->RunLoop();
}
catch (int state)
{
delete model; model = NULL;
delete view; view = NULL;
delete controller; controller = NULL;
switch (state)
{
case -2:
controller->ExitKey = true;
n = false;
break;
case -1:
MenuBGM1->stopAllSounds();
model = new CMainMenuModel();
view = new CMainMenuView(model);
controller = new CMainMenuController(model, view);
MenuBGM1->play2D("../irrKlang/media/Menu.mp3", true);
break;
case 0:
MenuBGM1->stopAllSounds();
model = new NDlvl();
MenuBGM1->play2D("../irrKlang/media/Drums.mp3", true);
break;
case 1:
MenuBGM1->stopAllSounds();
model = new TutLvl2();
MenuBGM1->play2D("../irrKlang/media/Drums.mp3", true);
break;
case 2:
MenuBGM1->stopAllSounds();
model = new TutLvl3();
MenuBGM1->play2D("../irrKlang/media/Drums.mp3", true);
break;
case 3:
MenuBGM1->stopAllSounds();
model = new StoryModel1();
MenuBGM1->play2D("../irrKlang/media/Drums.mp3", true);
break;
case 4:
MenuBGM1->stopAllSounds();
model = new JSlvl();
MenuBGM1->play2D("../irrKlang/media/level5.mp3", true);
break;
case 5:
MenuBGM1->stopAllSounds();
model = new jslvl2();
MenuBGM1->play2D("../irrKlang/media/level5.mp3", true);
break;
case 6:
MenuBGM1->stopAllSounds();
model = new RyLevel();
MenuBGM1->play2D("../irrKlang/media/level5.mp3", true);
break;
}
if(state > -1)
{
view = new GameView(model);
controller = new GameController(model, view);
}
if (!n) break;
// Initialize GLFW
if (!glfwInit()) exit(EXIT_FAILURE);
controller->Init(window);
glewExperimental = true; // Needed for core profile
// Initialize GLEW
if (glewInit() != GLEW_OK) exit(EXIT_FAILURE);
view->Init();
model->Init();
}
}
//.........这里部分代码省略.........