示例#1
0
void DemoKeeper::createScene()
{
    getGUI()->load("Wallpaper0.layout");
    MyGUI::VectorWidgetPtr& root = MyGUI::LayoutManager::getInstance().load("BackHelp.layout");
    root.at(0)->findWidget("Text")->setCaption("Select skin theme in combobox to see default MyGUI themes.");

    createDemo(0);
}
示例#2
0
// Find and create a demo, otherwise return the error demo
hkDemo* hkDemoDatabase::createDemo(const char* name, hkDemoEnvironment* env) const
{
	int i = findDemo(name);
	if( i != -1 )
	{
		return createDemo(i, env);
	}

	return new ErrorDemo(env, name);
}
示例#3
0
 virtual void initializeControls()
 {
     MyGUI::LayoutManager::getInstance().loadLayout("Wallpaper.layout");
     const MyGUI::VectorWidgetPtr& root = MyGUI::LayoutManager::getInstance().loadLayout("HelpPanel.layout");
     if ( root.size()==1 )
     {
         root.at(0)->findWidget("Text")->castType<MyGUI::TextBox>()->setCaption(
             "Select skin theme in combobox to see default MyGUI themes.");
     }
     createDemo( 0 );
 }
示例#4
0
void DemoKeeper::notifyComboAccept(MyGUI::ComboBox* _sender, size_t _index)
{
    createDemo(_index);
}
示例#5
0
 void notifyComboAccept( MyGUI::ComboBox* sender, size_t index )
 {
     createDemo( index );
 }
示例#6
0
文件: main.cpp 项目: MarkSkyzoid/ciri
int main() {
	// enable memory leak checking
#ifdef _DEBUG
	int debugFlag = _CrtSetDbgFlag(_CRTDBG_REPORT_FLAG);
	debugFlag|= _CRTDBG_LEAK_CHECK_DF;
	debugFlag |= _CRTDBG_CHECK_ALWAYS_DF;
	_CrtSetDbgFlag(debugFlag);
#endif

	// create the demo and get its configuration
	std::unique_ptr<IDemo> demo = createDemo(Demo::Terrain);
	const DemoConfig config = demo->getConfig();

	// create window
	std::shared_ptr<ciri::IWindow> window = ciri::createWindow();
	if( !window->create(config.windowWidth, config.windowHeight) ) {
		return -1;
	}

	// set window title
	window->setWindowText(config.windowTitle.c_str());

	// create and initialize input
	std::shared_ptr<ciri::IInput> input = ciri::createInput();
	if( !input->create(window) ) {
		return -1;
	}

	// create and initialize the graphics device
	std::shared_ptr<ciri::IGraphicsDevice> graphicsDevice = ciri::createGraphicsDevice();
	if( !graphicsDevice->create(window) ) {
		return -1;
	}

	// set the demo's resources
	demo->setWindow(window);
	demo->setInput(input);
	demo->setGraphicsDevice(graphicsDevice);

	// initialize and load the demo's content
	demo->onInitialize();
	demo->onLoadContent();

	// timer for delta and elapsed timing
	double elapsedTime = 0.0;
	double lastTime = 0.0;
	std::shared_ptr<ciri::ITimer> timer = ciri::createTimer();
	timer->start();

	// main loop
	bool running = true;
	while( running && !demo->hasRequestedToQuit() ) {
		// event processing
		ciri::WindowEvent evt;
		while( window->pollEvent(evt) ) {
			demo->onEvent(evt);

			if( ciri::WindowEvent::Closed == evt.type ) {
				running = false;
				break;
			}
		}

		// poll input
		input->poll();

		// delta and elapsed time
		const double currTime = timer->getElapsedMicrosecs();
		const double deltaTime = (currTime - lastTime) * 0.000001;
		lastTime = currTime;
		elapsedTime += deltaTime;

		// update and draw
		demo->onUpdate(deltaTime, elapsedTime);
		demo->onDraw();

		// update input
		input->update();
	}

	// clean demo
	demo->onUnloadContent();
	demo.reset();

	// clean graphic device
	graphicsDevice->destroy();
	graphicsDevice.reset();

	// clean window
	window->close();
	window.reset();

	return 0;
}