Re: Need help with game framework

2018-11-17 Thread anoNIMous
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

2018-11-17 Thread doofenstein
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

2018-11-17 Thread anoNIMous
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

2018-11-17 Thread doofenstein
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

2018-11-17 Thread anoNIMous
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

2018-11-17 Thread miran
> 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

2018-11-16 Thread anoNIMous
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

2018-11-16 Thread treeform
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

2018-11-16 Thread anoNIMous
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

2018-11-16 Thread SolitudeSF
ummm, what exactly doesn't work? since it compiles and launches (after deleting 
unused strfmt import) with latest devel.