Re: Need help with game framework
Yeah, that's probably the best way. I was putting it off because it sounded complicated but I guess it's probably the best way. Thanks :)
Re: Need help with game framework
one way to accomplish this(which also simplifies a lot of your scaling code and is probably the "standard" way of doing it) is by rendering everything [to a texture](https://wiki.libsdl.org/SDL_SetRenderTarget?highlight=%28%5CbCategoryRender%5Cb%29%7C%28CategoryEnum%29%7C%28CategoryStruct%29) at a scale of 1:1 and then rendering this texture upscaled
Re: Need help with game framework
I tried that, but I don't know how to scale the pixels, so they look out of place. Is there any way to change the pixel size of the draw functions so they aren't always one pixel?
Re: Need help with game framework
you can probably can replace all these bresenham line and circle functions, which set one pixel at a time, since SDL2 has a function for all these things. They're probably faster too. [https://wiki.libsdl.org/CategoryRender](https://wiki.libsdl.org/CategoryRender)
Re: Need help with game framework
Fixed it, thanks! I changed it to allow for more flexibility when using a custom font. Now there is a string, "glyphs", which stores the chars in the font in order, and the function now checks it to return a number. Also, thanks for reminding me of ranges, I completely forgot about them
Re: Need help with game framework
> I am not experienced enough to see where I could make improvements. I've just skimmed through your repo and the first place where I would start with the improvements is that [loong case statement](https://github.com/NIMNIMNIMNIM/NIM16/blob/master/src/engine.nim#L121). You could start with something like this (didn't test it, I write it directly here on the forum): let c = character.toLower() case c of 'a' .. 'z': return c - 'a' + 1 of '1' .. '9': return 26 + c - '0' # etc. Run This keeps your return values as they are, but this could/should be improved even more.
Re: Need help with game framework
I am trying to improve it, but I feel like I am not experienced enough to see where I could make improvements.
Re: Need help with game framework
Then make it better? What you describe is basically how I program. Probably how everyone programs. Eventually I learn how the thing works and can comeback to cleanup my exploration code. At first I copy stuff from Stack Overflow and where ever... then some times try out permutations of things till they work, but after I figure it out there are probably better, cleaner ways of doing it... I might come back years after, and clean stuff up. Its the process. Make it work. Make it work better.
Re: Need help with game framework
O shit it does lol Sorry, I guess it didn't work on some other version haha. Anyway, the problem isn't it not working (it does), it's just that I feel like I made it wrong, since I don't know alot about this stuff, so i would feel a lot more confident if someone knowledgeable would check it out and improve it.
Re: Need help with game framework
ummm, what exactly doesn't work? since it compiles and launches (after deleting unused strfmt import) with latest devel.
Need help with game framework
Don't know if this is the right place to ask, but here I go I'm a complete noob at programming, so I wanted to make a simple SDL2-based game framework as an exercise. I've managed to make it do what I wanted (Draw sprites, play sounds, draw primitives, pixel art etc.), BUT It's absolute jank. Extremely janky, scrapped it together in like two days. I don't know anything about SDL, so for everything I just googled "SDL2 how to _thing_ " and tried to translate it to Nim. If it didn't work I just randomly changed pointers and variables until it did. Horrible development all round, pretty sure I just copypasted the boilerplate from some tutorial. Also It doesn't work with the new Nim version. Basically, I'm looking for someone who is more experienced with Nim to help me sort this out. LINK: [https://github.com/NIMNIMNIMNIM/NIM16](https://github.com/NIMNIMNIMNIM/NIM16)