draw faster

This is a discussion on draw faster within the Game Programming forums, part of the General Programming Boards category; In my space invaders clone I have a scrolling background with a 10x10 area with aliens that are 32x32px and ...

  1. #1
    Registered User
    Join Date
    Aug 2001
    Posts
    380

    draw faster

    In my space invaders clone I have a scrolling background with a 10x10 area with aliens that are 32x32px and its slow. Any suggestions on how to get smoother or faster drawing?
    Don't you dare hit me on the head, you know I'm not normal.
    A Stooge Site
    Green Frog Software

  2. #2
    Pursuing knowledge confuted's Avatar
    Join Date
    Jun 2002
    Posts
    1,916
    What API?
    Away.

  3. #3
    Registered User
    Join Date
    Aug 2001
    Posts
    380
    Its with the Windows API. I'll post the source tomorrow.
    Don't you dare hit me on the head, you know I'm not normal.
    A Stooge Site
    Green Frog Software

  4. #4
    Registered User
    Join Date
    Aug 2001
    Posts
    380
    Here's the source.

    [edit]
    removed uneccessary files.
    Attached Files Attached Files
    Last edited by lambs4; 08-28-2003 at 10:37 AM.
    Don't you dare hit me on the head, you know I'm not normal.
    A Stooge Site
    Green Frog Software

  5. #5
    mov.w #$1337,D0 Jeremy G's Avatar
    Join Date
    Nov 2001
    Posts
    704
    That source you posted is all kinds of %%%%-ed up. It wont compile in msvc++ 6.0 = Probably the main reason its missing spaceinv.h

    I tried the exe = it runs fast enough on my machine - what are you running a commador 64?

    Heres what you might try for a tiny boost:
    on all your graphic related functions that get called a lot during a loop (draw bullet - draw sprite) declare them as inline: ie.
    Code:
    inline void drawbullet();
    inline int drawSprite();
    Further should you think it neccesary - rip off the setPixel() function (I think the function is in the .lib - so youll have to hop on the microsoft newsgroup (free) and ask for the setPixel() function source thats how i got it) copy and paste that bad boy and change it to an inline function too!

    That would take a bit of work of course.

    Remember by making the deffinition inline you effectively Inflate your programs size - as the function's source gets copied exactly into the spot it was called - rather then having the function in some memory area - and branching off to that area when ever needed - its all throughout your program code.
    c++->visualc++->directx->opengl->c++;
    (it should be realized my posts are all in a light hearted manner. And should not be taken offense to.)

  6. #6
    Registered User
    Join Date
    Aug 2001
    Posts
    380
    Yes, I'm running this on a commodore 64.

    You don't need spaceinv.h and the source I provided compiles fine using Dev-C++ and Borland.
    Don't you dare hit me on the head, you know I'm not normal.
    A Stooge Site
    Green Frog Software

  7. #7
    & the hat of GPL slaying Thantos's Avatar
    Join Date
    Sep 2001
    Posts
    5,681
    Runs fine on my machine. Only thing is that it won't go to level 2

  8. #8
    Registered User
    Join Date
    Mar 2002
    Posts
    249
    Runs fine on my machine.
    Well, there are a few things wrong with your code:

    1) It does not work.
    2) It does not work.
    3) It does not work.

    Hope this helps.

  9. #9
    Pursuing knowledge confuted's Avatar
    Join Date
    Jun 2002
    Posts
    1,916
    Originally posted by Thantos
    Runs fine on my machine.
    It would be cool to add the horizontal velocity of the ship at the time a bullet is released to the bullet, though. So when you're moving sideways, your bullet "drifts"
    Away.

  10. #10
    carry on JaWiB's Avatar
    Join Date
    Feb 2003
    Location
    Seattle, WA
    Posts
    1,972
    Also you might want to delay the firing time between bullets. As it is, you can just hold down the firing button and there's no way you can miss.
    "Think not but that I know these things; or think
    I know them not: not therefore am I short
    Of knowing what I ought."
    -John Milton, Paradise Regained (1671)

    "Work hard and it might happen."
    -XSquared

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Which is the better way to draw?
    By g4j31a5 in forum Game Programming
    Replies: 16
    Last Post: 01-22-2007, 11:56 PM
  2. draw function HELP!!!
    By sunoflight77 in forum C++ Programming
    Replies: 1
    Last Post: 05-11-2005, 12:28 AM
  3. ray casting
    By lambs4 in forum Game Programming
    Replies: 62
    Last Post: 01-09-2003, 06:57 PM
  4. Draw Shapes.
    By Unregistered in forum C Programming
    Replies: 1
    Last Post: 08-19-2002, 10:22 AM
  5. Transparent Draw Question
    By GodLike in forum Windows Programming
    Replies: 5
    Last Post: 05-07-2002, 07:56 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21