当前位置: 首页>>代码示例>>C++>>正文


C++ Window::Close方法代码示例

本文整理汇总了C++中Window::Close方法的典型用法代码示例。如果您正苦于以下问题:C++ Window::Close方法的具体用法?C++ Window::Close怎么用?C++ Window::Close使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Window的用法示例。


在下文中一共展示了Window::Close方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: lime_window_close

	value lime_window_close (value window) {
		
		Window* targetWindow = (Window*)(intptr_t)val_float (window);
		targetWindow->Close ();
		return alloc_null ();
		
	}
开发者ID:jarnik,项目名称:lime,代码行数:7,代码来源:ExternalInterface.cpp

示例2: main

int main(int argc, char** argv)
{
  int wndFlags = Window::WF_DEFAULT;

  // If the user passes -fullscreen as an argument, then
  // a fullscreen window will be created.
  if (argc > 1)
  {
    if (strcmp(argv[1], "-fullscreen") == 0)
    {
      wndFlags = Window::WF_FULLSCREEN;
    }
  }

  // Create a new window instance
	Window wnd;
  // Open the window
  if (!wnd.Open(800, 600, L"Hello, World!", wndFlags))
  {
    printf("Error - Unable to open the window!\n");
    exit(-1);
  }

  // By default the window is placed in the center of the screen.
  // Move it to (100, 100).
  wnd.setPosition(100, 100);

  // Until the user closes the window
	while (!wnd.isCloseRequested())
	{
    // Poll window events
		wnd.pollEvents();
	}

  // Close the window. This line is not required, because the
  // window is automatically close when the wnd instance is destroyed.
  wnd.Close();
	return 0;
}
开发者ID:IceCubeDev,项目名称:LiteCube,代码行数:39,代码来源:example_window.cpp

示例3: CloseSecondaryWidget

    // static
    void Window::CloseSecondaryWidget(Widget* widget)
    {
        if(!widget)
        {
            return;
        }

        // Close widget if it's identified as a secondary window.
        Window* window = widget->GetWindow();
        if(window)
        {
            if(!window->IsAppWindow())
            {
                window->Close();
            }
        }
        else
        {
            // If it's not a Window, then close it anyway since it probably is
            // secondary.
            widget->Close();
        }
    }
开发者ID:Strongc,项目名称:Chrome_Library,代码行数:24,代码来源:window.cpp

示例4: main

int main()
{
	// Init GLFW
	glfwInit();
	
	// Create a GLFWwindow object that we can use for GLFW's functions
	Window window = Window(WIDTH, HEIGHT, TITLE);
	window.DefineViewport();

	//glfwSetInputMode(window.getWindowPtr(), GLFW_CURSOR, GLFW_CURSOR_DISABLED);			
	/// ^(Maybe use this later)

	// Callback functions
	glfwSetKeyCallback(window.getWindowPtr() , key_callback);

	// Init GLEW
	glewExperimental = GL_TRUE;
	glewInit();

	// Enable alpha channel transparency
	glEnable(GL_BLEND);
	glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);

	// Load and compile shaders to a program
	Shader ShaderProgram = Shader("../deps/shaders/shadervert.vs", "../deps/shaders/shaderfrag.fs");

	// Load explosion graphics
	extern_Explosion.Init(ShaderProgram.GetProgramID());

	// Load texture/Game objects
	Texture2D texture_background1 = Texture2D("../deps/textures/backgroundSpace_01.1.png", PNG_RGB);
	SpriteMap Background = SpriteMap(texture_background1, 1.0f, 1.0f, glm::vec3(0.0f, 0.0f, 0.0f), 1.0f, BACKGROUND);

	Player PlayerShip;
	PlayerShip.Init(moveSpeed);

	Enemy Enemies;
	Enemies.Init();

	// Projection matrix: ortho for 2D
	glm::mat4 proj = glm::ortho(0, window.getWidth(), 0, window.getHeight());


	// Game loop
	while (!window.ShouldClose())
	{
		double startFrame = glfwGetTime();  ///< for FPS limiting

		// Check if any events have been activiated and call callback function (via GLFW)
		glfwPollEvents();

		// Clear the colorbuffer
		glClearColor(0.6f, 0.8f, 0.8f, 1.0f);
		glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

		/*	   Drawing	    */

		ShaderProgram.Use();

		// Background position and drawing calculations - just identity matrix
		glm::mat4 model;
		GLint modelLoc = glGetUniformLocation(ShaderProgram.GetProgramID(), "model");
		glUniformMatrix4fv(modelLoc, 1, GL_FALSE, glm::value_ptr(model));

		Background.BackgroundScroll(scrollSpeed);
		Background.Draw();

		Collision::EnemyHit(&PlayerShip, &Enemies);
		Collision::PlayerHit(&PlayerShip, &Enemies);
		Collision::ShipsCollide(&PlayerShip, &Enemies);

		PlayerShip.Move(keys);
		PlayerShip.AddShots(keys);
		PlayerShip.Draw(ShaderProgram.GetProgramID());
		
		Enemies.Move();
		Enemies.Shoot(PlayerShip.GetPosition());
		Enemies.Draw(ShaderProgram.GetProgramID());

		extern_Explosion.Draw();

		// FPS Calculation/Limiting
		float fps = CalculateFPS();
		static int printFPS = 0;
		if (printFPS == 100) {
			Enemies.Add(EN_0, PlayerShip.GetPosition());
			Enemies.Add(EN_1, PlayerShip.GetPosition());
			std::cout << fps << std::endl;
			printFPS = 0;
		} else {
			printFPS++;
		}
		
		
		LimitFPS(FPS, startFrame);
		
		if (PlayerShip.GetLives() <= 0)
		{
			window.Close();
		}
//.........这里部分代码省略.........
开发者ID:CurtisBuckoll,项目名称:SpaceGame,代码行数:101,代码来源:main.cpp

示例5: CloseAllWindows

void View::CloseAllWindows( void ) {
  for ( Window *w = static_cast<Window *>(windows.Head());
        w && !w->Closed(); w = static_cast<Window *>(w->Next()) )
    w->Close();
  Refresh();
}
开发者ID:drodin,项目名称:Crimson,代码行数:6,代码来源:view.cpp

示例6: main


//.........这里部分代码省略.........
		0.822f,  0.569f,  0.201f,
		0.435f,  0.602f,  0.223f,
		0.310f,  0.747f,  0.185f,
		0.597f,  0.770f,  0.761f,
		0.559f,  0.436f,  0.730f,
		0.359f,  0.583f,  0.152f,
		0.483f,  0.596f,  0.789f,
		0.559f,  0.861f,  0.639f,
		0.195f,  0.548f,  0.859f,
		0.014f,  0.184f,  0.576f,
		0.771f,  0.328f,  0.970f,
		0.406f,  0.615f,  0.116f,
		0.676f,  0.977f,  0.133f,
		0.971f,  0.572f,  0.833f,
		0.140f,  0.616f,  0.489f,
		0.997f,  0.513f,  0.064f,
		0.945f,  0.719f,  0.592f,
		0.543f,  0.021f,  0.978f,
		0.279f,  0.317f,  0.505f,
		0.167f,  0.620f,  0.077f,
		0.347f,  0.857f,  0.137f,
		0.055f,  0.953f,  0.042f,
		0.714f,  0.505f,  0.345f,
		0.783f,  0.290f,  0.734f,
		0.722f,  0.645f,  0.174f,
		0.302f,  0.455f,  0.848f,
		0.225f,  0.587f,  0.040f,
		0.517f,  0.713f,  0.338f,
		0.053f,  0.959f,  0.120f,
		0.393f,  0.621f,  0.362f,
		0.673f,  0.211f,  0.457f,
		0.820f,  0.883f,  0.371f,
		0.982f,  0.099f,  0.879f
	};

	GLushort indicesData[] =
	{
		0,  1,  2,      0,  2,  3,    // front
		4,  5,  6,      4,  6,  7,    // back
		8,  9,  10,     8,  10, 11,   // top
		12, 13, 14,     12, 14, 15,   // bottom
		16, 17, 18,     16, 18, 19,   // right
		20, 21, 22,     20, 22, 23    // left
	};


	VertexArray cube, cube2;
	IndexBuffer ibo(indicesData, std::end(indicesData) - std::begin(indicesData));

	cube.AddBuffer(sfnew Buffer(vertexBufferData, sizeof(vertexBufferData), 3), 0);
	cube.AddBuffer(sfnew Buffer(colorBufferData, sizeof(colorBufferData), 3), 1);

	cube2.AddBuffer(sfnew Buffer(vertexBufferData, sizeof(vertexBufferData), 3), 0);
	cube2.AddBuffer(sfnew Buffer(colorBufferData, sizeof(colorBufferData), 3), 1);

	Matrix4 projection = Matrix4::Perspective(100.0f, window.GetSize().X / window.GetSize().Y, 0.1f, 100.f);
	Matrix4 view = Matrix4::LookAt(Vector3(4, 3, 3), Vector3(0, 0, 0), Vector3(0, 0.8f, 0));
	Matrix4 model = Matrix4(1.0f);
	Matrix4 mvp = projection * view * model;

	Shader shader = Shader("tri_vertex.glsl", "tri_fragment.glsl");
	shader.Enable();

	while (!window.ShouldClose())
	{
		window.Clear(clearColor);

		// Render here
		cube.Bind();
		ibo.Bind();
		model = Matrix4::Translation(Vector3(0, 0, 0));
		mvp = projection * view * model;
		shader.SetUniformMat4("MVP", mvp);
		glDrawElements(GL_TRIANGLES, ibo.GetCount(), GL_UNSIGNED_SHORT, 0);
		ibo.Bind();
		cube.Unbind();

		cube2.Bind();
		ibo.Bind();
		model = Matrix4::Translation(Vector3(4, 0, 0));
		mvp = projection * view * model;
		shader.SetUniformMat4("MVP", mvp);
		glDrawElements(GL_TRIANGLES, ibo.GetCount(), GL_UNSIGNED_SHORT, 0);
		ibo.Bind();
		cube2.Unbind();


		window.Display();
		window.Update();
	}

	window.Close();

#if _DEBUG
	LOG_DEBUG("PAUSING NOW!");
	system("PAUSE");
#endif

	return EXIT_SUCCESS;
}
开发者ID:zockerlive,项目名称:Snowflake,代码行数:101,代码来源:main.cpp

示例7: WindowClosed

void Window::WindowClosed(GLFWwindow* Handle)
{
    Window* BakgeWindow = (Window*)glfwGetWindowUserPointer(Handle);
    BakgeWindow->Close();
}
开发者ID:Adrianis,项目名称:bakge,代码行数:5,代码来源:Window.cpp

示例8: Execute

// Methods used by instantiator/creator and/or self
OP_BOOLEAN TransferManagerDownloadCallback::Execute()
{
	OP_STATUS status;
	BOOL done = FALSE;

	if (!cancelled)
	{
		if (called)
		{
			switch (download_action_mode)
			{
			case DOWNLOAD_UNDECIDED:
				// TODO: This should not be possible, need to test......
				// Use this to throw things back at document manager
				done = TRUE;
				break;
			case DOWNLOAD_ABORT:
				if (keep_loading)
				{
					if (document_manager)
						document_manager->SetLoadStatus(WAIT_FOR_LOADING_FINISHED);
				}
				else
				{
					if (document_manager)
						document_manager->StopLoading(FALSE);
					if (!download_url.GetRep()->GetUsedCount()) // These two lines belong in the url module
						download_url.Unload();					// rfz 20071028
				}
				EnableWindowClose();
				done = TRUE;
				break;
			case DOWNLOAD_SAVE:
			case DOWNLOAD_RUN:
				if (!dont_add_to_transfers)
				{
					BOOL show_transfer = TRUE;
					if (download_context)
						show_transfer = download_context->IsShownDownload();

					TransferItem* newitem = 0;
					// Put the download object into TransferManager
					status = ((TransferManager*)g_transferManager)->AddTransferItem(download_url,
							download_filename.CStr(),
							OpTransferItem::ACTION_UNKNOWN,
							FALSE,
							0,
							TransferItem::TRANSFERTYPE_DOWNLOAD,
							NULL,
							NULL,
							FALSE,
							show_transfer,
							m_privacy_mode,
							&newitem);
					if (status == OpStatus::OK)
					{
						if (download_context && download_context->GetTransferListener())
							newitem->SetTransferListener(download_context->GetTransferListener());

						if (download_action_mode == DOWNLOAD_SAVE)
							newitem->SetAction(OpTransferItem::ACTION_SAVE);
						else if (download_action_mode == DOWNLOAD_RUN)
							newitem->SetAction(OpTransferItem::ACTION_RUN_WHEN_FINISHED);

						newitem->SetViewer(viewer);

						if (need_copy_when_downloaded)
							newitem->SetCopyWhenDownloaded(download_filename);

						MessageHandler *oldHandler = download_url.GetFirstMessageHandler();

						// Check if this URL is already being downloaded to some file
						// (the same file or another file - who knows?). The Opera core
						// doesn't handle concurrent downloading of the same URL properly.
						// So just give up.
						//
						// The result will be that the transfer already in progress completes
						// without problems, while the new transfer that was attempted added,
						// will hang (the progress bar in the window that triggered the transfer
						// will stay there until the user aborts it somehow).
						MessageHandler *currentHandler = oldHandler;
						BOOL transfer_in_progress = FALSE;
						while (currentHandler && !transfer_in_progress)
						{
							if (currentHandler == g_main_message_handler)
								transfer_in_progress = TRUE;
							else
								currentHandler = static_cast<MessageHandler *>(currentHandler->Suc());
						}

						if (!transfer_in_progress)
						{
							FramesDocument *doc = document_manager ? document_manager->GetCurrentDoc() : NULL;

							URLStatus ust = download_url.Status(FALSE);
							switch (ust)
							{
							case URL_UNLOADED:
								download_url.Load(g_main_message_handler, doc ? doc->GetURL() : URL());
//.........这里部分代码省略.........
开发者ID:prestocore,项目名称:browser,代码行数:101,代码来源:TransferManagerDownload.cpp

示例9: main

int main(){
	try{
		ILogger::Init();
		Settings::Call().Parse();
		ResourceManager::Call().AddPath("Data/shaders", "Shader");
		ResourceManager::Call().AddPath("Data/textures", "Image");

		{
			Window myWindow;
			Image Crate;
			Texture CrateTexture;
			Text FPSText, MousePosText;
			Clock FrameClock, FpsClock;
		
			Input myInput;
			myInput.Init(myWindow);

			Renderer& myRenderer = Renderer::Call();
			myRenderer.Init(myWindow);
		
			Crate.LoadFromFile("crate.jpg");
			CrateTexture.LoadFromImage(Crate);

			Light l;
			l.SetPosition(Vector3F(1,3,1.5));
			l.SetDiffuse(Color(1.f,1.f,1.f));
			l.SetRange(8);

			Shader ColorShader;
			ColorShader.Compile("shaderColor.vs", "shaderColor.fs");
			ColorShader.Bind();
			ColorShader.SendColor("ambientColor", myRenderer.GetSpecifications().mAmbientColor);
			ColorShader.SendFloat("constantAtt", l.GetAttenuationConstant());
			ColorShader.SendFloat("linearAtt", l.GetAttenuationLinear());
			ColorShader.SendFloat("quadraticAtt", l.GetAttenuationQuadratic());
			ColorShader.SendFloat("range", l.GetRange());
	
			ColorShader.SendVector3("lightPosition", l.GetPosition());
			ColorShader.SendColor("lightColor", l.GetDiffuse());
			ColorShader.UnBind();

			Object obj1;
			obj1.MakeCube("cube", ColorShader);
			obj1.GetMaterial().mAmbient = Color(0.f, 0.08f, 0.08f);
			obj1.GetMaterial().mDiffuse = Color(0.f, 0.8f, 0.8f);
			obj1.GetMaterial().mSpecular = Color(0.0f, 0.5f, 0.5f);
			obj1.GetMaterial().mShininess = 50.f;

			Camera cam;
			cam.LookAt(Vector3F(0.5f,0,1), Vector3F(-2.5f,2,4));
		
			FPSText.SetSize(12);
			FPSText.SetPosition(10,10);
			MousePosText.SetSize(12);
			MousePosText.SetPosition(10,22);

			while(myWindow.IsOpened()){
				ElapsedTime = FrameClock.GetElapsedTime();
				FrameClock.Reset();

				if(FpsClock.GetElapsedTime() > 1.f){
					FPSText.SetText(String(1.f/ElapsedTime));
					FpsClock.Reset();
				}

			
				while(myInput.GetEvent()){
					if(myInput.GetEventType() == sf::Event::Closed)
						myWindow.Close();

					if(myInput.IsKeyHit(Space))
						if(!paused){
							paused = true;
							FrameClock.Pause();
						}else{
							paused = false;
							FrameClock.Resume();
						}
				}

				MousePosText.SetText(String("X : ")+myInput.GetMouseX()+" Y : "+myInput.GetMouseY());
			
				MousePosText.Draw();
				FPSText.Draw();
				obj1.Draw();

				myRenderer.BeginScene(myRenderer.GetSpecifications().mAmbientColor);
					myRenderer.Render();
				myRenderer.EndScene();
			}
		}
	}catch(Exception e){
		std::cout << e.what() << std::endl;
		system("PAUSE");
	}

	Renderer::Kill();
	ResourceManager::Kill();
	Settings::Kill();
	ILogger::Kill();
//.........这里部分代码省略.........
开发者ID:caiwan,项目名称:00xengine,代码行数:101,代码来源:main.cpp

示例10: lime_window_close

	void lime_window_close (value window) {
		
		Window* targetWindow = (Window*)val_data (window);
		targetWindow->Close ();
		
	}
开发者ID:Rezmason,项目名称:lime,代码行数:6,代码来源:ExternalInterface.cpp


注:本文中的Window::Close方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。