Results 1 to 8 of 8

Thread: Please advice on my DirectX programming

  1. #1

    Thread Starter
    Fanatic Member 007shahid's Avatar
    Join Date
    Feb 2001
    Posts
    562

    Post Please advice on my DirectX programming

    I have made a small project using DirectX. It uses Direct Draw to blt frames from a bitmap based on the input keys. I just want you guys to check my source code and tell me if it is programmed in an optimized form or I can still make improvements.
    One major improvement would be memory management. Every time I run the program my memory page size increases by about 42mb. How do I remove the memory allocated for my program

    The compressed size of the bitmap even in GIF format was 163 kb, so I had to split the file in 2 attachments due to the limitations of this site.
    THE TIME/WEATHER IS
    Don't know how to use APIs or have problem with them,
    Download API-Guide & API-Viewer from http://www.allapi.net

  2. #2

    Thread Starter
    Fanatic Member 007shahid's Avatar
    Join Date
    Feb 2001
    Posts
    562

    Exclamation The second half of the sprite bitmap

    Here is the second half of the sprite bitmap. Open actionpic0.bmp from the previous zip file. Increase the height attribute to 980pxl.
    Paste the bitmap in actionpic1.zip to the new area and Save as 'actionpic.bmp' in project directory. Sorry for the inconvenience.

    actionpic0.bmp + actionpic1.bmp = actionpic.bmp (In App.Path)
    THE TIME/WEATHER IS
    Don't know how to use APIs or have problem with them,
    Download API-Guide & API-Viewer from http://www.allapi.net

  3. #3
    Frenzied Member Jotaf98's Avatar
    Join Date
    Jun 2000
    Location
    I'm not gonna give you my IP address! Ok... Portugal, South-Western Europe, 3rd rock from the sun (our star is easy to find, a 47 Ursae Majoris in the Milky Way :p )
    Posts
    1,457

    Talking Solved

    Yeah, that's right: I spent 15 minutes debugging someone else's code

    Anyway, your code is fine, except that you're setting the width and height of the image, which is not needed if you don't use the width/height caps. The problem is that your image is too big for the graphics card - I tried a smaller image and it worked fine
    So remove those empty spaces in the image if you really wanna use it
    Code:
    Temp = Me.GetIQ()
    'Error 9: Overflow
    'DON'T PANIC! :eek:

    To learn how to use realistic effects in your games like fire, rain, snow and magic effects, read my article on particles systems here.


    Jotaf's Theories!
    "Cats land on their feet. Toast lands peanut butter side down. A cat with toast strapped to its back will hover above the ground in a state of quantum indecision."

  4. #4
    Frenzied Member Jotaf98's Avatar
    Join Date
    Jun 2000
    Location
    I'm not gonna give you my IP address! Ok... Portugal, South-Western Europe, 3rd rock from the sun (our star is easy to find, a 47 Ursae Majoris in the Milky Way :p )
    Posts
    1,457
    Btw, you also forgot to set the color key for the sprites
    Code:
    Temp = Me.GetIQ()
    'Error 9: Overflow
    'DON'T PANIC! :eek:

    To learn how to use realistic effects in your games like fire, rain, snow and magic effects, read my article on particles systems here.


    Jotaf's Theories!
    "Cats land on their feet. Toast lands peanut butter side down. A cat with toast strapped to its back will hover above the ground in a state of quantum indecision."

  5. #5

    Thread Starter
    Fanatic Member 007shahid's Avatar
    Join Date
    Feb 2001
    Posts
    562

    Wink

    Thanks.
    Anyway what about the memory page size problem. Can I remove the virtual memory allocated for it.
    And about the setting the Color Key, I found a link in vbexplorer.com about make sprite have transparent background. But It linked me to an article on setting 16-Bit Colors.
    Can you please give me the Syntax for setting the color key for transparent background.
    THE TIME/WEATHER IS
    Don't know how to use APIs or have problem with them,
    Download API-Guide & API-Viewer from http://www.allapi.net

  6. #6

    Thread Starter
    Fanatic Member 007shahid's Avatar
    Join Date
    Feb 2001
    Posts
    562
    OK no problem on Setting Color Key to make a color transparent. I found the answer from some of your other posts in this matter.
    THE TIME/WEATHER IS
    Don't know how to use APIs or have problem with them,
    Download API-Guide & API-Viewer from http://www.allapi.net

  7. #7
    Frenzied Member Jotaf98's Avatar
    Join Date
    Jun 2000
    Location
    I'm not gonna give you my IP address! Ok... Portugal, South-Western Europe, 3rd rock from the sun (our star is easy to find, a 47 Ursae Majoris in the Milky Way :p )
    Posts
    1,457
    To make the surface smaller you just have to remove the spaces around the frames, Paintbrush is enough to do that, you don't need PSP or something
    Code:
    Temp = Me.GetIQ()
    'Error 9: Overflow
    'DON'T PANIC! :eek:

    To learn how to use realistic effects in your games like fire, rain, snow and magic effects, read my article on particles systems here.


    Jotaf's Theories!
    "Cats land on their feet. Toast lands peanut butter side down. A cat with toast strapped to its back will hover above the ground in a state of quantum indecision."

  8. #8
    Good Ol' Platypus Sastraxi's Avatar
    Join Date
    Jan 2000
    Location
    Ontario, Canada
    Posts
    5,134
    If the image is too large to fit in Video Memory (as yours was) it's stored in the slow system memory (the swap file). Using a smaller image helped, as Jotaf said. It let your computer store the image in actual video memory instead of virtual memory.
    All contents of the above post that aren't somebody elses are mine, not the property of some media corporation.
    (Just a heads-up)

Posting Permissions

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



Click Here to Expand Forum to Full Width