Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unused Pinvoke Methods #214

Closed
Rosst0pher opened this issue Jan 13, 2022 · 4 comments · Fixed by #257
Closed

Unused Pinvoke Methods #214

Rosst0pher opened this issue Jan 13, 2022 · 4 comments · Fixed by #257
Labels

Comments

@Rosst0pher
Copy link
Contributor

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
@eXpl0it3r eXpl0it3r added the Bug label Jan 13, 2022
@eXpl0it3r
Copy link
Member

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

@Rosst0pher
Copy link
Contributor Author

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

@DemoXinMC
Copy link
Contributor

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++

@Marioalexsan
Copy link
Contributor

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants