PLUGIN_API void Berkelium_Window_destroy(int windowID)
{
	WindowMap::iterator it = windows.find(windowID);
	if(it != windows.end())
	{
		delete it->second;
		windows.erase(it);
	}
}
UnityBerkeliumWindow *getWindow(int id)
{
	WindowMap::const_iterator it = windows.find(id);
	if(it == windows.end())
	{
		cerr << "Warning: no berkelium window found with ID " << id << "!" << endl;
		return 0;
	}

	return it->second;
}
Ejemplo n.º 3
0
EXPORT_CDECL(HICON) GetWindowIcon(HWND window, UINT32 size) {
  WindowMap::iterator iter = sWindowData.find(window);
  if (iter == sWindowData.end()) {
    if (IsTaskbarWindow(window)) {
      UpdateWindowData(window);
    }
    return nullptr;
  }
  if (size > 20 && iter->second.largeIcon != nullptr) {
    return iter->second.largeIcon;
  }
  return iter->second.smallIcon;
}
PLUGIN_API bool Berkelium_Window_create(int uniqueID, float *colors, bool transparency, int width, int height, char *url)
{
	if(windows.find(uniqueID) != windows.end())
	{
		cerr << "Error: a berkelium window with ID " << uniqueID << " already exists!" << endl;
		return false;
	}

	UnityBerkeliumWindow *pWindow = new UnityBerkeliumWindow(uniqueID, colors, transparency, width, height, url);

	cerr << "Berkelium window created: " << pWindow << " (size=" << width << ", " << height << "; url=" << url << ")" << endl;
	windows[uniqueID] = pWindow;

	return true;
}
/// Получение окна
  Window& GetWindow (size_t id)
  {
    try
    {
      WindowMap::iterator iter = windows.find (id);

      if (iter == windows.end ())
        throw xtl::make_argument_exception ("", "window_id", id, "No window with such id");

      return *iter->second;
    }
    catch (xtl::exception& e)
    {
      e.touch ("render::scene::server::WindowManager::Impl::GetWindow");
      throw;
    }
  }
PLUGIN_API bool Berkelium_Window_create(int uniqueID, float *colors, int width, int height, char *url) // changed void* to float* since we know we're passing floats
{
	if(windows.find(uniqueID) != windows.end())
	{
		cerr << "Error: a berkelium window with ID " << uniqueID << " already exists!" << endl;
		return false;
	}

	// Unity uses floats for colors
	float *data = reinterpret_cast<float *>(colors);

	UnityBerkeliumWindow *pWindow = new UnityBerkeliumWindow(uniqueID, data, width, height, url);

	cerr << "Berkelium window created: " << pWindow << " (size=" << width << ", " << height << "; url=" << url << ")" << endl;
	windows[uniqueID] = pWindow;

	return true;
}
UnityBerkeliumWindow *getWindow(int id)
{
	WindowMap::const_iterator it = windows.find(id);
	return (it == windows.end()) ? 0 : it->second;
}