Results 1 to 8 of 8

Thread: One big image instead images list?

  1. #1

    One big image instead images list?

    Is it absolutely necessary to use a list of images to draw sprites with DelphiX? I'm building a game, but it uses a lot (and that's really a lot) of images, and it won't work on old Windows (because of that GDI limitation).

    What I have on my mind: instead of having a lot of sepparate images for every sprite, I have one big BMP file with all the sprites drawn on it.

    The problem is how to draw only a specific region of that big BMP file to the screen. I tried doing that pixel by pixel, but it's just too slow.

    Any ideas?

    Regards
    Fabiano
    =============================
    <br />Fabiano Koich Miguel
    <br />fabianokm@hotmail.com
    <br />www.efkm.com/teenook
    <br />=============================

  2. #2

    One big image instead images list?

    Drawing only a portion from an image can be done like this:
    Code:
    DXDraw1.surface.Draw&#40;10,10,rect&#40;10,10,50,50&#41;,yourSurface,false&#41;;
    I've tried using large (800x600) images in the past as well. However, when using them in combination with a DXImagelist, it made my game go much much slower. So, the only way it works is when you don't use the DXimagelist, and load the images during runtime.

  3. #3

    One big image instead images list?

    As I said on GameDev, if your sprites are all the same size, you can use the PatternWidth and PatternHeight properties and use the PatternIndex parameter of the ImageListItem's draw function.
    [size=10px][ Join us in #pgd on irc.freenode.net ] [ Sign the Petition for a Software Patent Free Europe ][/size]

  4. #4

    One big image instead images list?

    Thanks for the suggestions, both of them were really useful.
    =============================
    <br />Fabiano Koich Miguel
    <br />fabianokm@hotmail.com
    <br />www.efkm.com/teenook
    <br />=============================

  5. #5

    One big image instead images list?

    How do you load a large image during runtime. :?

  6. #6

    One big image instead images list?

    [pascal]
    var
    BigImage: TDirectDrawSurface;
    begin
    BigImage := TDirectDrawSurface.Create(Form1.DXDraw1.DDraw);
    BigImage.LoadFromFile('C:\BigImage.bmp');
    end;
    [/pascal]

    That should do the trick,

  7. #7

    One big image instead images list?

    For some unknow and strange reason, when I use images larger than 3000 pixels, the Draw procedure only draws noise. So I split my image into 3 smaller images and created 3 surfaces. It's still much much faster than using the images list (I can see that difference in DXTimer1.FrameRate).
    =============================
    <br />Fabiano Koich Miguel
    <br />fabianokm@hotmail.com
    <br />www.efkm.com/teenook
    <br />=============================

  8. #8

    One big image instead images list?

    I guess you graphic card support textures up to 1024x1024 ... But more than 3000 px is really huge ...

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •