SFML / SFML.Net

Official binding of SFML for .Net languages

Home Page:https://www.sfml-dev.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Unused Pinvoke Methods

Rosst0pher opened this issue · comments

commented

The following pinvoke methods are found to be dead code and not referenced in SFML.Net.

  • sfWindow_getFrameTime isn't referenced and isn't defined in CSFML
  • sfRenderTexture_saveGLStates isn't referenced and isn't defined in CSFML
  • sfRenderTexture_restoreGLStates isn't referenced and isn't defined in CSFML
  • sfShape_copy isn't referenced and isn't defined in CSFML
  • sfText_getString isn't referenced
  • sfText_getRect isn't referenced and isn't defined in CSFML
  • sfTexture_getTexCoords isn't referenced and isn't defined in CSFML

Are these missing features then or are they simply implemented differently in CSFML/SFML.Net?

commented

I need to look over this abit more but I think they're implemented differently today.

I'm pretty confident on the following

  • sfWindow_getFrameTime I think was removed a long time ago from SFML/CSFML. I can't find any mention of it in the SFML API docs and seaching on git results in a commit from 2010 SFML/SFML@04075d6. The GetFrameTime method in that commit is not present in 2.3 SFML branch.
  • sfRenderTexture_saveGLStates and sfRenderTexture_restoreGLStates look like they were replaced by sfRenderTexture_pushGLStates and sfRenderTexture_popGLStates
  • sfText_getString exists is in CSFML and SFML.Net, but the Text class only uses sfText_getUnicodeString

I need to look more into the following

  • sfShape_copy
  • sfText_getRect
  • sfTexture_getTexCoords

I'd like to figure out some sort of static analyzer or plugin to help identify these things. While it wouldn't be overwhelmingly difficult to go through each file (SFML.NET isn't that large) and see what methods aren't being referenced, having this done in some sort of automated way would be nice.

If it could be taken a step further, it would be really nice to find a way to compare CSFML's exported methods vs our DllImports and have a list of CSFML methods that exist and aren't being used to make sure we're maintaining feature parity. I discovered yesterday that SFML.NET doesn't support sfRenderWindow_drawVertexBufferRange() or sfRenderTexture_drawVertexBufferRange() meaning that there's currently no way in SFML.NET to only draw part of a VertexBuffer even though that functionality exists in C/C++

The only method from this issue that's currently present in the codebase seems to be sfText_getString, but that one isn't used since sfText_getUnicodeString exists instead.