• Advertisement


  • Content count

  • Joined

  • Last visited

Community Reputation

496 Neutral

About Peregrin

  • Rank
  1. [web] Jooleem

    Hi tzappa, I'm the original Jooleem's developer. I'm really glad you like the game. Great work on the javascript version! I would appreciate it if you added a link to the original game (http://jooleem.sourceforge.net). Thanks, Peregrin
  2. Dictionary file for word game

    Hi, This page lists a bunch of open/free/public domain word lists. It seems to be English-centric, but it can get you started. I highly recommend YAWL, compiled by Mendel Cooper.
  3. I had the same problem with 1.2.7. According to this post it was caused by a C runtime mismatch in the original 1.2.7 release. I have downloaded the SDL mixer runtime files again, and everything works perfectly. You can find the new files here: http://www.libsdl.org/projects/SDL_mixer/release/SDL_mixer-1.2.7-win32.zip Hope this helps.
  4. Announcing SDL 1.2.10

    Hey Vegettex, I also started getting a bunch of C4312 warnings after upgrading to 1.2.10. You can silence these warning (although I am not sure this is the best idea) by turning off 64 bit portability checking: Project->Properties->C/C++->General->Detect 64-bit Portability Issues Hope this helps.
  5. Int to c-string

    Quote:Original post by furby100 You didn't add one for the null terminator! Eek! Good point. Although I did warn this was a proof-of-concept, uncompiled, untested and unverified. As I said, there might be a bunch of off-by-one issues that need to be addressed: does the result of log10 need to be rounded up? How about a space for the number's sign character? And, as you said, an extra char for the null terminator.
  6. Int to c-string

    You could figure out what's the maximum number of digits the integer can take by using the log10 function. #include <limits.h> #include <math.h> ... int max_chars_in_int = (int) log10((double) INT_MAX); // You might need to add 1 for the sign digit char* string = (char *) malloc (max_chars_in_int); That this is just off the top of my head, and totally untested. There might be off-by-one errors hiding in the code. Note that this technique is just a curiosity and I would not recommend using it in an actualy product. I would go with Kuladus and advise you to just pick a reasonable number.
  7. This is how I launch a broswer on OS X in Jooleem: CFURLRef url = NULL; // Create a string ref of the URL: CFStringRef urlStr = CFStringCreateWithCString( NULL, "http://address.goes.here", kCFStringEncodingASCII); // Create a URL object: url = CFURLCreateWithString (NULL, urlStr, NULL); // Open the URL: LSOpenCFURLRef(url, NULL); // Release the created resources: CFRelease(url); CFRelease(urlStr); Hope this helps.
  8. baby question circular collision

    Here is some pseudo-code: // Compute the distance (squared) between P and C: D = (Px - Cx) ^ 2 + (Py - Cy) ^ 2 // Compare the distance to the radius (both squared, saving us a square root operation): if D <= (R ^ 2) // P is in the circle else // P is outside the circle Note that ^ represents "raise to the power of" and not XOR.
  9. Nehe's lesson 36 covers rendering to a texture.
  10. Alogg

    Included in the alogg source zip is alogg_play.c, a sample program that demonstrates loading and playing an Ogg file. Hope this helps.
  11. PNG-images? (LoadPNG)

    An annotated sample program is included in the loadpng zip. Here it is: /* example.c - annotated example program for loadpng * * Peter Wang <tjaden@users.sf.net> */ #include <png.h> #include <allegro.h> #include "loadpng.h" int main(int argc, char *argv[]) { char *filename; BITMAP *bmp; PALETTE pal; int depth = 16; /* Initialise Allegro. */ allegro_init(); install_keyboard(); /* Get filename from command-line. */ if (argc < 2) { allegro_message("usage: %s filename.png [depth]\n", argv[0]); return 1; } filename = argv[1]; if (argc >= 3) depth = atoi(argv[2]); /* Make Allegro aware of PNG file format. */ register_png_file_type(); /* Set a suitable graphics mode. */ set_color_depth(depth); if ((set_gfx_mode(GFX_AUTODETECT_WINDOWED, 640, 480, 0, 0) < 0) && (set_gfx_mode(GFX_AUTODETECT, 640, 480, 0, 0) < 0)) { allegro_message("Error setting video mode (640x480x%d).\n", depth); return 1; } /* Load the PNG into a BITMAP structure. */ bmp = load_png(filename, pal); if (!bmp) { set_gfx_mode(GFX_TEXT, 0, 0, 0, 0); allegro_message("Error loading file `%s'.\n", filename); return 1; } /* If we have a palette, set it. */ if (bitmap_color_depth(bmp) == 8) set_palette(pal); /* Show it on the screen. */ clear(screen); blit(bmp, screen, 0, 0, 0, 0, bmp->w, bmp->h); /* Write the image onto disk. */ save_bitmap("saved.png", bmp, pal); /* Press any key to continue... */ readkey(); /* The End. */ destroy_bitmap(bmp); return 0; } END_OF_MAIN()
  12. Procedural Islands

    Hi Deffer, I'm confused. I don't really notice any difference between the frequencies of the two diagonals. Could you please highlight them for me? Also note that the third picture (the textured one) has a simulated directional light, coming from the left. The light causes self-shadowing, so in that image it does appear as if the diagonals are different. Is that what you mean?
  13. Procedural Islands

    Deffer, I used the diamond-square algorithm described here.
  14. Procedural Islands

    If you want a single large island you could constrain the height map to a hemisphere. Here's what I did: 1. Create a fractal map (in this case using mid-point displacement). 2. Constrain to a hemisphere (see code below). 3. Apply textures, shadows etc. Here is the hemisphere algorithm: // Change every value depending on its distance from the center of the terrain: for (x = 0 ; x < m_iHighResSize ; x++) for (z = 0 ; z < m_iHighResSize ; z++) { // Calculate the distance from center of the map (D = sqrt(R^2 - dX^2 - dZ^2): l_fDist = sqrt(pow(l_fRadius, 2) - pow(x - l_fRadius, 2) - pow(z - l_fRadius, 2)); // If the result is negative, the point is outside the sphere: if (l_fDist < 0.0f) { m_fpHighResMap[x * m_iHighResSize + z] = 0.0f; } // Otherwise, the point needs to be weighted using its distance from the center: // (sqrt(R^2 - X^2 - Z^2)) / R, or distance / radius else { m_fpHighResMap[x * m_iHighResSize + z] *= (l_fDist / (l_fRadius)); } And this is how it looks with an ocean and a skybox: Hope this helps.
  15. && operator commutative

    See this thread.
  • Advertisement