Jump to content
  • Advertisement


  • Content Count

  • Joined

  • Last visited

Community Reputation

178 Neutral

About Jolle

  • Rank
  1. Jolle

    Better card shuffling routine

    I think I've heard that "rand() * DeckCount / RAND_MAX" gives statistically better results than "rand() % DeckCount", and as above said, just srand once.
  2. Check http://www.wischik.com/scr/howtoscr.html, it has a part about the parsing (although it's ugly). Google is your friend.
  3. I've heard that the easiest way if you want mutlisampling, just draw to the main backbuffer and copy it.
  4. It may look like trivial recursion, but it seems it isn't. Anyway I didn't find the trivial stuff about it, but I manage to write some Haskell code that solves the problem. Maybe I missed some vital trick that makes it much easier, I dunno. f 0 = [[]] f n = concat [[x : z | z <- f (n - x), z == [] || head z <= x] | x <- [n, n - 1 .. 1]] stylish = putStr . unlines . map (init . tail . show) . f Main> stylish 5 5 4,1 3,2 3,1,1 2,2,1 2,1,1,1 1,1,1,1,1 (zeroes not included, it didn't make any sense)
  5. Jolle

    random number

    As said by many people already, you should only call srand once. The code you show above calls it for every random number you generate.
  6. Here's some code I used in an old app. It uses a lot of bad things, but the basic word wrap technique isn't very bad. (And yeah, you don't spell length that way) char** WrapLine(char* str, int w) { static char* lines[16]; int currentLine = 0; int place = 0; while (str[place] != 0) { int lenght = w / FONTW; if (strlen(&str[place]) < lenght) lenght = strlen(&str[place]); else { while (str[place + lenght] != ' ' && lenght != 0) lenght--; if (lenght == 0) lenght = w / FONTW; } lines[currentLine] = new char[lenght + 1]; memcpy(lines[currentLine], &str[place], lenght); lines[currentLine][lenght] = 0; place += lenght; if (str[place] == ' ') place++; currentLine++; } lines[currentLine] = NULL; return lines; }
  7. Jolle

    New to Opengl

    I've never really liked the nehe tutorials. I found them messy and unpedagogic. When I was new to OpenGL they didn't help much. But each to his own I guess.
  8. Jolle

    Problem with recv (Winsock)

    atoi wants a null terminating string, doesn't it? edit: also, always check n.
  9. Too bad they've completely destroyed the settlers concept.
  10. Jolle

    Condition testing

    It will skip "another == one_more", but will check something_else. If it was "if( something && veryLargeLongRunningFunction() )", the function would only be run if something was true.
  11. Unless you loop the code you show from World.cpp three times, m_Cycles will only have one vector. Edit: Otherwise I think it works as you want it to. Edit: Edit: When pushing m_Values into m_Cycles, what is added to m_Cycles is a copy of m_Values, so you won't need more m_Values vectors.
  12. Jolle

    Check out my Particle Engine

    http://members.gamedev.net/ryan_zec/OpenGL_Demos/SDLGameParticleEngine.zip clicky Looks nice.
  13. Jolle

    Socket Descriptor Range

    In other words, use a hash table.
  14. Jolle

    fps affected by mouse

    It would help if you posted your main loop.
  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!