how do i make a pixel perfect button

thanks! the path formatting code works but i put some printf everywhere and got this:

map made!
loaded map!
map made!
new page!

it should say “map drawn!” a bajillion times after “new page!” but it never happens for some odd reason

Do you have a github that you can put up the whole project on?
It’s easier to have all the source files at hand and being able to also run it.

If/when you put the project on github, also add all the images, fonts etc that’s needed to run the application aswell.

i will release the code whenever i’m the most comfortable releasing it

Then it will be hard to help out with the printf printing that you referred to. You’ll have to set out some breakpoints and step through the code to see why the printing isn’t happening.

well guess what i did now, but it still crashes so i need to figure that part out

By the way, I saw in your code that in the drawMap function, you create and destroy a texture on each call to that function.

Also, in the drawImage function, you’re creating a surface and a texture, renders the texture and then destroys the surface and the texture, on each call to that function.

I assume that those functions are called every frame, which means that you’re creating and destroying surfaces and textures every frame.

I recommend to not create/destroy surfaces/textures during runtime, unless it’s absolutely necessary.

Create as many assets as possible during the startup of the application and destroy them at application shutdown.

1 Like

thanks for the suggestion!