示例#1
0
int TestApp::main(const std::vector<std::string> &args)
{
	// Create a console window for text-output if not available
	ConsoleWindow console("Console");

	try
	{
		DisplayWindowDescription desc;
		desc.set_size(Size(800,600), true);
		desc.set_title("Fullscreen test");
		DisplayWindow window(desc);
		
		while (!window.get_ic().get_keyboard().get_keycode(keycode_escape))
		{
			if (window.get_ic().get_keyboard().get_keycode(keycode_f11))
			{
				desc.set_fullscreen(!desc.is_fullscreen());
				window = DisplayWindow(desc);
			}

			window.get_gc().clear(Colorf::gray30);

			window.flip();
			KeepAlive::process();
			System::sleep(50);
		}
	}
	catch(Exception error)
	{
		Console::write_line("Exception caught:");
		Console::write_line(error.message);

		console.display_close_message();
		return -1;
	}

	return 0;
}
示例#2
0
DisplayWindow::DisplayWindow(
	const std::string &title,
	int width,
	int height,
	bool start_fullscreen,
	bool allow_resize,
	int flipping_buffers)
{
	DisplayWindowDescription description;
	description.set_title(title);
	description.set_size(Size(width, height), false);
	description.set_fullscreen(start_fullscreen);

	if (start_fullscreen)
	{
		description.show_caption(false);
	}

	description.set_allow_resize(allow_resize);
	description.set_flipping_buffers(flipping_buffers);

	*this = DisplayWindow(description);
}