Пример #1
0
	void VehicleSim::key_callback(GLFWwindow* window, int key,
		int scancode, int action, int mods)
	{
		// Do default action (exit on esc)
		_default_key_callback(window, key, scancode, action, mods);

		// Get class instance
		VehicleSim* app = (VehicleSim*)glfwGetWindowUserPointer(window);
		Gwen::Controls::Canvas* canvas = app->_guiCanvas;

		// Update GUI
		canvas->InputKey(InputConverter::translateKeyCode(key), action == GLFW_PRESS);

		// Update tools
		std::vector<Tool*>& tools = app->_tools;
		for (auto it = tools.begin(); it != tools.end(); ++it)
		{
			(*it)->key_base(key, scancode, action, mods);
		}
	}