Jump to content
  • Advertisement

randomZ

Member
  • Content Count

    351
  • Joined

  • Last visited

Everything posted by randomZ

  1. While you have a z-axis in orthogonal projection mode, you won't have any distortion with regards to perspective, so it doesn't matter what Z depth an object is actually at. So in this case, you should be able to pick an arbitrary value for the mouse depth.
  2. Are you defining any lights at all? If not, you shouldn't enable lighting. Apart from that, your code looks fine... I don't know if lighting could cause such bugs.
  3. Why does it matter? I don't know much about shaders, but if you don't use the values, it doesn't matter what values they contain, doesn't it? How do you even find out what values you get without accessing them? ^^
  4. randomZ

    Fonts with OpenGL

    If you want a source of inspiration on how to implement a flexible font manager using Freetype 2, check out this tutorial. Beware that the code is written in D, but should be entirely understandable for a C++ programmer.
  5. randomZ

    how do you pass arrays to a function?

    Perhaps you should explain what you are trying to do with these functions or post an example how you're trying to use them. I don't see any mistake in the declarations you posted. What you basically need to know is that when you are passing an array as an argument, you are actually passing a pointer to the first element. Thus, void myFunc(int myArray[]) is equivalent to void myFunc(int* myArray) and myFunc(myArray); is equivalent to myFunc(&(myArray[0])); Of course, this also means that you can use the [] indexing syntax on normal pointers, which of yourse you shouldn't do. This also means that arrays are always passed by reference rather than by value (if you don't know what this means, look it up); i.e. if you modify the array in the function, the original array will be modified, too.
  6. Hi, I'm experiencing FTP upload problems with the servers of various free webspace providers. The problem is that uploads just stop after 8KB of a file have been transferred, and the connection times out. (Smaller files than 8KB are transferred correctly.) However, upload to some other servers seems to work. I've already contacted support of one provider, but all they could tell me was to lower the MTU value, which I did in my router's settings, from previously 1492 to 1460. I'm using a netgear router, in case that might be the problem. Does anyone have any experience with that type of problem? Thanks alot Sebastian
  7. randomZ

    FTP Upload Problems: Upload stops after 8KB

    Updating the firmware seems to have done the trick. Of course I might have come up with that myself ^^ Thanks again :)
  8. randomZ

    FTP Upload Problems: Upload stops after 8KB

    Yes. This was the first thing the support guy asked, too ^^ I've also tried various FTP programs: SmartFTP, WS_FTP LE and Total Commander.
  9. randomZ

    Off Topic (But Interesting)

    However, I wouldn't overuse it - it mostly makes for unreadable code. You can even put more ?: conditionals into the if condition, but if a reader needs five minutes to figure out one line of code, that code isn't worth much. For example, even this slight change: if(min(a, b) < 7) { ... } with min() defined elsewhere is way easier to read, because you moved the additional condition *out of* the if statement.
  10. randomZ

    Freetype question

    To draw TTF fonts to an SDL window, use SDL_ttf. SDL_ttf uses Freetype anyway, but you don't need to worry about it.
  11. Two friends and me made a game for a 72hour competition back in december. The game is kind of a mixture of Lemmings and The Incredible Machine: You need to help the main character reach the level exit by placing bricks and jump markers in the level; all of this in 2d. (You can find the current version of the game at my website.) However, the collision detection is very buggy. Let me illustrate the problem: Currently, the whole world is made up of bounding rectangles (axis-aligned). Collision is checked by checking whether two of these rectangles overlap. However, we also need to know what side of the brick/enemy the player collided with to determine the reaction (turn around, die etc.). E.g., there are bricks who are harmless if touched from above but lethal from any other direction. To check from what direction the collision occured, the overlapping rectangle is examined. If its width is greater than its height, the collision occured from above or below. If its height is greater than its width, the collision occured from the left or right. Obviously, this last part introduces bugs, e.g. when the falling velocity (or *any* velocity, for that matter) is high. So I'm looking for a better way to accomplish this. Some things I already came up with: - Make everything pixel-based and move the player only one pixel at a time. Con: I'd need to rewrite most of the game, since right now it's all floating-point ^^ - Do intersection tests from the player's corners moving with the player's velocity. E.g.: player - moves to the bottom-right ---- | |\ | | \ ---- \ \ \ \ \ \ \ \ \ \ \ ---- \ | | \ | | \ ---- \ brick Since the ray that hits the brick first hits it from above, the hit is from above. But what if the object is small enough that none of the rays hits it? Has anyone got any other suggestions? I'm sure many people have done jump'n'runs before :)
  12. randomZ

    .png files....

    I'm afraid these are statically linked to SDL_Image, so there's nothing you can do short of recompiling SDL_Image. They're not huge, though, so including them shouldn't be a pain.
  13. randomZ

    Classes

    But what happens if you want to have a small, shooting paddle and a large shooting paddle and a small sticky shooting paddle? IMHO, plain inheritance often isn't the right pattern.
  14. randomZ

    % in strings?

    I was meaning to say, "The reason this is incorect is...", that is, I was agreeing with Fruny.
  15. randomZ

    Problem with fps ( openGL + SDL )

    BTW, don't turn off VSYNC. VSYNC is good for your graphics.
  16. randomZ

    % in strings?

    Quote:Original post by Fruny Quote:Original post by pex22 you can also use \%, which tells that % is not a special char so it has the same effect of %%. Incorrect. The reason is that printf conversions come into play at run time, at which point there is no difference between \% and % in a string.
  17. Quote:Original post by antareus 1. should it throw? Or should it just return a boolean value, which can be ignored by the programmer if she wishes? 2. If it does throw, should it throw a specific exception (such as FileNotFoundException)? should it throw a generic exception (IOException)? 1. I think it should. The programmer can always catch it, or check with File.Exists() whether the file can be deleted. There could also be a DeleteIfPossible() function that doesn't throw, but does so explicitly. 2. Both. I like to specify both generic and special exception classes and link them through inheritance.
  18. I think the cleanest thing would be to hardcode all entity constructors - i.e. screw the registerEntityType stuff and just write all the functions, like createEntityPlayer(location). If your project isn't HUGE, the flexibility gained by the registering stuff won't matter.
  19. randomZ

    No double buffer, eh? (solved)

    Quote:Original post by wyrzy I did some testing on two computers I have access two (both of which SDL says that "Hardware Double Buffering is Available), but they both ran simple test apps at a considerably slower rate than when using Software Surfaces. This isn't related to double buffering, but to the display surface being in video memory. When alpha blitting to it, SDL has to read from VRAM, which is very slow. -Sebastian
  20. randomZ

    SDL app only at approx. 1 FPS ??

    Don't worry about clearing the entire screen - SDL_FillRect on the whole screen should be very fast in any case. Your likely problem is that you use alpha blending, and your display surface is in video memory. This means that every time you blit an alpha surface, SDL has to get the old pixels from VRAM (which is VERY slow) and blend them with the ones from your surface. Possible solutions: 1. pass SDL_SWSURFACE to SDL_SetVideoMode() pro: eliminates your problem con: you can't use double buffering and therefore no VSYNC (VSYNC is a good thing!) 2. use SDL_DOUBLEBUF and have a software shadow surface. Then first blit everything to your shadow surface (which you need to create yourself) and then, after all blits, blit the whole shadow surface to VRAM and call SDL_Flip(). pro: you can use double buffering con: uses a bit of extra system memory - but not that much that it should matter. Other things you should pay attention to: After loading, convert every surface to the display format with SDL_DisplayFormatAlpha(). Speeds up blitting drastically. This is also necessary after IMG_Load() calls; SDL_Image doesn't do this for you! On images that use alpha, always call SDL_SetAlpha() with thi SDL_RLEACCEL flag. This speeds up blits, as pixels with 0% / 100% alpha aren't blended, and the alpha information is compressed. Edit: Another thing that came to my mind: Have all your surfaces in system memory, i.e. don't use the SDL_HWSURFACE flag. -Sebastian
  21. randomZ

    Where can I get Unix?

    Try ubuntu, it's very user friendly. www.ubuntulinux.org
  22. randomZ

    dilemma on wether to make this public

    Just post it. People can choose for themselves whether they want to do their homework or not. Directly helping them by talking to them is a different thing than posting some code.
  23. randomZ

    Passing a SDL_Screen Pointer...

    Quote:Original post by Gaiiden Quote:Original post by randomZ Did you call SDL_SetVideoMode with SDL_DOUBLEBUF in the flags? That won't matter. If the surface isn't double buffered then SDL_Flip() will just call SDL_FillRect() instead of flipping the pages. I thought that was only the case if you specified SDL_DOUBLEBUF, but couldn't get it due to hardware reasons. But, thinking about it, it wouldn't make much sense to implement it that way ;)
  24. randomZ

    moving a image

    However, if you draw a lot of stuff every frame, only clearing the parts that have changed last frame *might* make sense. This technique is called "dirty rects". You basically collect the rectangles that have been changed ("dirtied") in the last frame and redraw those. You might want to google for it. However, I should also note that in a large class of games (those that change their whole screen every frame), implementing this would only cost you lots of time and add overhead. For the rest of games, always updating the whole screen usually suffices, too.
  25. randomZ

    Passing a SDL_Screen Pointer...

    Did you call SDL_SetVideoMode with SDL_DOUBLEBUF in the flags? No offense meant ^^
  • Advertisement
×

Important Information

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

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!