OGRECave / ogre

scene-oriented, flexible 3D engine (C++, Python, C#, Java)
https://ogrecave.github.io/ogre/
MIT License
3.84k stars 957 forks source link

[OGRE-39] Ogre::Window::getCustomAttribute() uses void* #12

Open paroj opened 8 years ago

paroj commented 8 years ago

[reporter="spacegaier", created="Sat, 24 Nov 2012 20:08:54 +0100"]

Original reporter: Sauce

The void* argument in Ogre::Window::getCustomAttribute() should be replaced with an Ogre::Any return value to promote type-safety.

Whilst not entirely trivial to implement (each platform uses a different implementation), the changes shouldn't affect plugin writers in any significant way as custom render systems aren't common.

End users will only have to add 1 or 2 lines of code to handle the changes to the interface, to handle casting to the appropriate type.

Current usage:
size_t hWnd = 0;
m_pWindow->getCustomAttribute("WINDOW", &hWnd);

Proposed usage:
size_t hWnd = Ogre::any_cast(m_pWindow->GetCustomAttribute("WINDOW"));

Original Mantis Ticket: http://www.ogre3d.org/mantis/view.php?id=422

paroj commented 8 years ago

[author="spacegaier", created="Fri, 4 Jan 2013 02:34:22 +0100"]

Discussion on twitter: https://twitter.com/davidjrogers/status/285210876926099456