r/C_Programming • u/Choice_Structure4001 • Jun 28 '26
Abstraction issues, I need insight
https://github.com/KeefChief/DisplayStuffSo, I was building an x11 (and later win32) wrapper to learn about graphics programming and for another project where I’d need it (I know I could just use sdl but I thought why not make my own), but I’m now hitting a wall where I realize I didn’t make the abstraction the right way at all and some functions that should have been in my general platform because they shouldn’t require os specific stuff (for exemple the PBM_draw_image function) end up needing to be cloned between the different os platforms and I have no idea how to change my abstraction in a way that makes it work like I would want to
Sorry if my explanation was bad, I’m not really good at English, the project repo should be links to this post if someone is willing to dive in to help me, thanks!
(Also the rainbow background by default when creating images was to test if colors worked well)
•
u/AutoModerator Jun 28 '26
Hi /u/Choice_Structure4001,
Your submission in r/C_Programming was filtered because it links to a git project.
You must edit the submission or respond to this comment with an explanation about how AI was involved in the creation of your project.
While AI-generated code is not disallowed, low-effort "slop" projects may be removed and it's likely that other users push back strongly on substantially AI-generated projects.
I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.
2
u/Choice_Structure4001 Jun 28 '26
Also I forgot to mention but there’s a bug with the function to get mouse position, I don’t know why XQueryPointer gives me an fsanitizer error so if you want to run the program you should remove that function (and it only runs on Linux since for now it only supports x11)
1
u/EpochVanquisher Jun 29 '26
Can you use a cross-platform graphics library instead of X11? For example, can you use SDL3? SDL3 was designed to solve exactly this kind of problem, mostly for games.
1
u/mlugo02 Jul 04 '26
Can you explain exactly what abstraction issue you’re having?