Jump to content
  • Advertisement

ciroknight

Member
  • Content Count

    272
  • Joined

  • Last visited

Community Reputation

328 Neutral

About ciroknight

  • Rank
    Member
  1. ciroknight

    Could SDL render in another window?

    Mari_p: No, SDL for the most part is windowing-system agnostic (it has a few routines to modify its own windows, but that's as far as it goes; it can't even make its own window frame disappear, for example). This is because it has to use different toolkits on different operating systems. However, this shouldn't discourage you, especially if you're just using SDL to render something, then bring it into your program. It's entirely possible to have SDL draw everything to an off-screen buffer, then just grab that buffer and run with it (use it however you like). In theory, depending on the operating system, you could overwrite the pixel data of the other window or widget within a window with the pixel data from the SDL. The function you're looking for is SDL_CreateRGBSurfaceFrom(), and for reference, the pixel data of an image surface is stored in SDL_Surface->pixels (so you could memcpy it, for example). These are nice to know, because sometimes you'll want to use a buffer you've already drawn something to in software and load it as an SDL_Surface, or if you're wanting to implement a screenshot routine, you can copy the pixel data and save it as a file. Hope that gives you a starting point.
  2. ciroknight

    Using SDL as a blitting engine for GTK+

    For future knowledge, the "stride" of an image is the distance between lines in bytes. For example, if I have an image WIDTH wide using 32-bit colors, the stride of the image is WIDTH * 4 (bytes). This "stride" value is there so that you can modify a sub-image (update a smaller image inside of a larger image buffer). So, to fix your problems, all you should need to do is change that stride value from 1 byte (which is undoubtedly why it's not drawing anything) to WIDTH * Texture::BITSPERPIXEL (or whatever, you get the idea).
  3. ciroknight

    Creating a snake

    The solution is a linked list. The list carries the current location, "wriggle" state (direction of the next move to make), and a pointer to the next object ahead of it (or behind it, as I would do; makes propagating the movement down the snake from the head easier). When the head moves, it simply calls a routine that propagates the wriggle-state down to each segment on the list, and moves each segment accordingly. It's how I implemented the movement in my simple "snake" clone years ago, and the simplest solutions are usually the best.
  4. ciroknight

    Which API to learn first?

    This is about the most flamebait question you can ask on a game development forum, but here's a simple answer; if you're comfortable with C, go with OpenGL. If you're comfortable with C++, go with Direct X. If you want your app to be cross platform, go with Open GL. If you only are concerned with Windows, go with DirectX. Both APIs are very powerful, both are reasonably easy to use if you have the basic mathematics down, and both can generate equally good end products (a lot of professional game companies will build their engines in such a way that the underlying API doesn't matter, and can be selected by the user). It's a preference and target audience call.
  5. I code something else or look busy. Or, you know, live.
  6. ciroknight

    question about arrays of structures

    Quote:Original post by Rubiks14 Wait I don't know what I'm thinkin...Do vectors work simalar to Arrays? Could someone show me an example of using them with structures? EDIT: OH I know how vectors work now...it's just been forever since I've used them that I forgot. Just one Question. How do you make vectors random? Vectors are "Smart Arrays", they just adjust their size for you, instead of having you have to do it yourself. Very handy if you're using C++. I'm not exactly sure what you mean by "random", but if you just want a random element from it, you can do like you would with arrays; generate a random number that's within the bounds of the vector and get it from the vector with array[random_number];. If you're wanting to sort the vector in a random way, you're going to have to come up with some kind of shuffling algorithm, and that's really going to be specific to what you want to do and the performance you want. A "simple" shuffling algorithm would look something like: make second array until array is filled { generate a random number inside of the bounds of the array. if the number isn't already taken { pop that element off of the first array. stash the number in the second array. make a note that this number has been chosen} } repeat; return/replace first array with second array. Hope that helps. (edit: had to fight with that opening bracket...)
  7. ciroknight

    8bit BMP loading

    Just a cursory glance (like the person above has stated, it's practically impossible without seeing some code to be sure), but it looks like you're missing the top fourth of the image. ;) Perhaps something in your algorithm isn't catching all of the bits when you use an 8-bit image, or you're not allocating enough space? There's just nothing we can do without seeing some code.
  8. ciroknight

    [C++]Heavyweight XML lib?

    Expat. Does just about everything you want, and it's pretty hefty. It's written in C, it's fast, it's still not huge, but it does support DTDs if you compile it in.
  9. ciroknight

    Jpeg format patent?

    Quote:Original post by Obscure Quote:Original post by Tac-Tics If you don't have any money, companies won't bother suing you.... (unless you're an 8-year-old girl downloading her favorite MP3 X-D While they might not be able to get any money they could certainly force you to stop distributing your product, so all the effort would be wasted. And of course, this is the biggest threat. But then again, if you're just developing it to learn how it works, go for it.
  10. ciroknight

    Jpeg format patent?

    Quote:Original post by The C modest god If I will somehow improve a bit the compression algorithem, then they will no longer be able to sue me for violating their patent rights? Jpeg is also quite old, isn't its patent should have expired already? JPEG is old, but it's not that old. Besides, as I understand the "claimed" JPEG patent (there are some ongoing disputes to see if the patent is actually legal, seeing as there is legal precidence), it only covers the explicit process that their algorithm covers. It'd be perfectly legal to design your own image compression algorithm using the bits that JPEG does, but I'd change the order of operations at least, and to do my best to comply with the patent I'd make a listing in my own patent application stating in all of the ways JPEG isn't my compression technique. Besides, if the JPEG patent holds, part of MPEG-I and all of Motion JPEG are both in violation, and there will be some very pissed off businesses out there.
  11. Windows: C(API). I'm probably the last person alive to still use the CAPI in Windows, but I just don't like MFCs, I don't like .Net at all, and I've got a ton of old code that's already C that I like to keep around (makes doing new stuff quick and easy). Mac: Objective C (Cocoa). (Cocoa's the API for those not of the Mac persuasion). I've really found the language to be very nice and well rounded, and I can code in ObjC faster than I can C++ and generally with less bugs. If only Apple moved Cocoa to Windows/Linux... and I've given up doing hand optimizations for my code (with the current platform shift, Accellerate.framework is the better way to go anyways). Linux: C++ (Qt), C (GTK, libSDL), i686 assm (namely SSE optimizations). The Internet: PHP, with either Postgres or MySQL depending on what's available. (and everyone uses HTML, JS, CSS of course). I'm a fan of HTML4, I still code my pages to HTML4 Transitional, and will continue to code my pages to HTML4 until HTML5 is done and browser support is catching up (and yes, they're working on HTML5, it's not just XHTML from here on out. Thank you Google.) Other Platforms: PPC assembly (I've been "blessed" to work on some supercomputer code from time to time and most of the coders in my area always start with C, compile, and aggressively optimize the rest by hand. I think it's masochistic, but they swear by it and When in Rome...), various ARM platforms C (yay Linux), Motorola Dragonball assembly, C (PalmOS; the world's most convoluted operating system). (everything above is ranked in order of how I use them, except I code on my Mac more often than I do on Windows, and I code for the Internet these days more than I do Linux (just not enough time anymore). And I very rarely ever code for the "other platforms" anymore, but they're worth mentioning.)
  12. ciroknight

    Can you put structures in structures?

    Certainly, though it's usually not preferred; most people will get away with packing a structure inside of another with a pointer to the other structure you want to include. It'll look something like this typedef struct { int x, y, z; } point; typedef struct { point *start; point *end; } line_segment;
  13. ciroknight

    Can Someone break this down for me???

    The proper (C99) way is "int main (int argc, char **argv);" (though "char *argv[]" is also acceptible, see Objective C). Main should always have an integer return type and should never be void (lest the program not tell the Operating System when it has completed execution). You can get away with void in modern OSs, though returning an integer is much better practice (as you can return error codes that tell the OS things like "This application crashed on exit"). std::endl just returns "/r/n" or "/n" depending on your platform, so I don't see any point in having to use it. But then again, why not use it? It's simple, it's easy to remember, and newer programmers will understand "ENDL" ENDs a Line. (the only exception here, of course, is a network protocol, where returning the right string is a neccesity).
  14. ciroknight

    3D maze simulation making peaple sick

    Quote:Original post by Skeleton_V@T Have you ever heard of Microsoft Windows' 3D Maze [wink] ?. That used to make me seriously sick to the stomach. I couldn't even look at the screen while it was going.. something about how fast it turned and the colors.. ugh I think I'm getting queazy just thinking about it
  15. Torrents would work really nicely for this; throw your project up on a torrent server and link to it. That way, the more people who download it, the faster it goes. Good way to gauge how many people like it too ;).
  • 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!