Results 1 to 15 of 15

Thread: DDraw, the Same Question, but MORE INFO!

  1. #1

    Thread Starter
    Good Ol' Platypus Sastraxi's Avatar
    Join Date
    Jan 2000
    Location
    Ontario, Canada
    Posts
    5,134
    This is indirectly about DDraw, but could you guys tell me why this classmodule won't work?
    Attached Files Attached Files
    All contents of the above post that aren't somebody elses are mine, not the property of some media corporation.
    (Just a heads-up)

  2. #2

    Thread Starter
    Good Ol' Platypus Sastraxi's Avatar
    Join Date
    Jan 2000
    Location
    Ontario, Canada
    Posts
    5,134
    (ESS stands for 'Enhanced StarField Screensaver') - I'm making a 'rival' of MS's own Screensaver, which, by the way, sucks.
    Attached Files Attached Files
    Last edited by Sastraxi; Apr 6th, 2001 at 06:18 PM.
    All contents of the above post that aren't somebody elses are mine, not the property of some media corporation.
    (Just a heads-up)

  3. #3

    Thread Starter
    Good Ol' Platypus Sastraxi's Avatar
    Join Date
    Jan 2000
    Location
    Ontario, Canada
    Posts
    5,134
    The code I posted shows some wierd matrix of green, white & black, then some blue. I don't exactly know how it made it....
    All contents of the above post that aren't somebody elses are mine, not the property of some media corporation.
    (Just a heads-up)

  4. #4
    Fanatic Member PsychoMark's Avatar
    Join Date
    Feb 2001
    Location
    Netherlands
    Posts
    540
    Just downloaded it, going to take a look now...
    Teaudirenopossum.Musasapientumfixaestinaure.
    (I can't hear you. There's a banana in my ear)

  5. #5
    Fanatic Member PsychoMark's Avatar
    Join Date
    Feb 2001
    Location
    Netherlands
    Posts
    540
    First of all, let me make clear that I'm not posting this to be a jerk in any way, just trying to help you ...

    Got some bad news and a couple of tips.

    First, the bad news, it didn't work. After a bit of messing around the only thing I could see were 5 dots slowly moving away from the top left corner changing into all sorts of colors, and suddenly it gave me an error (somewhere in the UpdStar sub, couldn't see the exact location since the whole screen was black )...

    Now for the tips (don't know if some things were to be removed and were just for testing, but going to post them anyways):

    • RaiseEvent
      I noticed you used RaiseEvent somewhere in the code, but didn't actually use it. RaiseEvent is slow! You might not notice it normally, but at 60 or 70 FPS it's really a nightmare. If you do want to raise some sort of event, you might want to take a look at the 'Implement' command, which is a lot faster...
    • FS.Initialize
      First thing I got when I started it was an error, you forgot to call FS.Initialize...
    • BltColorFill
      Clear the backbuffer before your next drawing cycle. Use something like:

      Code:
          With rScreen
              .Top = 0
              .Left = 0
              .Bottom = 600
              .Right = 800
          End With
          
          BB.BltColorFill rScreen, 0
    • Aaaargh! 1024x768!!
      Don't hard-code the resolution into the program unless you're absolutely sure it's supported (like 640x480x16 is a safe choice, but preferably let the user choose)...


    That's all I can think of right now . About the stars, I think there's a little problem in your calculations, although I'm not sure what it is exactly, still figuring out what you did. I hope it can be fixed, so I can finally get rid of the default starfield screensaver ...
    Teaudirenopossum.Musasapientumfixaestinaure.
    (I can't hear you. There's a banana in my ear)

  6. #6

    Thread Starter
    Good Ol' Platypus Sastraxi's Avatar
    Join Date
    Jan 2000
    Location
    Ontario, Canada
    Posts
    5,134
    Yeah. Well, I fixed the routine, I just had set the start x and y, and not the real x and y, so it had started from the middle. And it does 'bursts' of stars, which is easy for me to fix. I made one of these before and it worked like a charm, implementing a class mod. really took it down, eh?

    Anyways, I will fix the star bursting code, and maybe you could do something with it, I'll post the updated class module here.
    All contents of the above post that aren't somebody elses are mine, not the property of some media corporation.
    (Just a heads-up)

  7. #7

    Thread Starter
    Good Ol' Platypus Sastraxi's Avatar
    Join Date
    Jan 2000
    Location
    Ontario, Canada
    Posts
    5,134
    I was also just being a jerk because this prog. was just to test if it would work, then I would rewrite it (with the vital parts remaining) and newer, less hard-coded code.

    BTW. You must set the disp. mode in DDraw before you initialse it. And also, the only reason all of those other subroutines are available is because I put no private in them. This is how you use it:

    (for sake of coding lets say you have the cla-mod. in SF.)
    (and actually I'm going to take out the events cause I will never use them.)

    Code:
    SF.MaxStars = 50
    SF.ColourHigh = RGB(255,255,255) 'displayed when closest to you
    SF.ColourLow = RGB(0,0,0) 'displayed when created
    
    'set modes(display and coop. level)
    
    SF.Enabled = True ' this will also call initialise (in the new c-mod)
    When you want to blit a star, get it's X, Y, and Colour:

    Code:
    SF.GetStarData # '# = the number of the star you want to find info about
    Col = SF.StarColour
    X = SF.StarX
    Y = SF.StarY
    Put this code before BLT in the loop of DDraw prog:

    [/code]
    Do
    SF.Redraw
    BlitStars
    DoEvents
    Loop
    [/code]

    And that's how to use my Class Module, I actually wont "silence" the other subroutines as you may have use for them:

    Code:
    Sub SplitRGB(Colour, R, G, B)
       R = SF.GetR(Colour)
       G = SF.GetG(Colour)
       B = SF.GetB(Colour)
    End Sub
    All contents of the above post that aren't somebody elses are mine, not the property of some media corporation.
    (Just a heads-up)

  8. #8

    Thread Starter
    Good Ol' Platypus Sastraxi's Avatar
    Join Date
    Jan 2000
    Location
    Ontario, Canada
    Posts
    5,134
    Here is the Updated Classmodule, please see what you can do with it.

    I'm going to try to use it with SetPixelV, see if that actually works.
    Attached Files Attached Files
    All contents of the above post that aren't somebody elses are mine, not the property of some media corporation.
    (Just a heads-up)

  9. #9
    Fanatic Member PsychoMark's Avatar
    Join Date
    Feb 2001
    Location
    Netherlands
    Posts
    540
    That's more like it

    It runs, shows me some stars coming from the middle, but when they've traveled about half the screen, I get an overflow error on this line:

    Stars(C).R = GetR(mvarColourLow) * (255 - Stars(C).Stage) + GetR(mvarColourHigh) * (Stars(C).Stage) / 255

    The stars change colors too (green, blue), I don't know if that was supposed to be...

    If I figure out a solution, I'll let you know...
    Teaudirenopossum.Musasapientumfixaestinaure.
    (I can't hear you. There's a banana in my ear)

  10. #10
    Fanatic Member PsychoMark's Avatar
    Join Date
    Feb 2001
    Location
    Netherlands
    Posts
    540
    Oops, the changing colors were my fault, I accidentaly set the screen depth to 16 instead of 32
    Teaudirenopossum.Musasapientumfixaestinaure.
    (I can't hear you. There's a banana in my ear)

  11. #11

    Thread Starter
    Good Ol' Platypus Sastraxi's Avatar
    Join Date
    Jan 2000
    Location
    Ontario, Canada
    Posts
    5,134
    Yeah, I noticed that too. Why do you think it overflows at that point?

    Hmmm... It may have something to do with BEDMAS, or PPMDAS, whatever it is in America. It's order of operations anyway, I'm almost positive.
    All contents of the above post that aren't somebody elses are mine, not the property of some media corporation.
    (Just a heads-up)

  12. #12
    Fanatic Member PsychoMark's Avatar
    Join Date
    Feb 2001
    Location
    Netherlands
    Posts
    540
    Tried changing the line a little, changed Integer's to Long's, but it still gave the Overflow error...
    Teaudirenopossum.Musasapientumfixaestinaure.
    (I can't hear you. There's a banana in my ear)

  13. #13
    Fanatic Member PsychoMark's Avatar
    Join Date
    Feb 2001
    Location
    Netherlands
    Posts
    540
    Ok, that's it, no more mr nice guy, it's time for the ultimate revenge: F8
    Teaudirenopossum.Musasapientumfixaestinaure.
    (I can't hear you. There's a banana in my ear)

  14. #14
    Fanatic Member PsychoMark's Avatar
    Join Date
    Feb 2001
    Location
    Netherlands
    Posts
    540
    Ok, narrowed down the problem (after removing all the DD stuff, leaving only the calculations, and the nice debug screen available ):


    First, the Overflow error occured on this line:

    Stars(C).R = (GetR(mvarColourLow) * (255 - Stars(C).Stage) + GetR(mvarColourHigh) * (Stars(C).Stage)) / 255

    C was at that point (I think, but shouldn't matter much) 122, with the results of GetR 0 and 255 (first and second call) and Stars(C).Stage=129...

    So I commented the line and broke it in pieces, and replaced all the variables with the numbers, it looked like this:

    Stars(C).R = ((0 * 126) + (255 * 129)) / 255

    Still an error, so I tried this:

    Stars(C).R = 255 * 129


    And that's where the error occured. According to my calculator, the result is 32895...

    The weird thing is, I changed the Integer to Long before running this code, but it still raised the Overflow error, should it? As far as I know, even an Integer should be able to hold this value...

    Tried using CLng(), but didn't work either...
    Teaudirenopossum.Musasapientumfixaestinaure.
    (I can't hear you. There's a banana in my ear)

  15. #15
    Fanatic Member PsychoMark's Avatar
    Join Date
    Feb 2001
    Location
    Netherlands
    Posts
    540
    Don't ask me why, but X = 255 * 129 gives an Overflow, but X = 32895 doesn't...

    It's not a nice way to work things out, but I've changed the 255*129 to call a function 'Multiply', which multiplies the two numbers in a not so pretty way (a loop).

    Anyways, this fixes the overflow error, the stars show up, they go all the way, but the Multiply function is a little bit too slow to keep up (or any other calculations are, don't know exactly what is slowing it down), and it still doesn't look like stars to me...

    But here's my version, do whatever you like with it...

    Btw, I removed the Debug.Print in the StarField Initialize sub, because it took about 6 seconds extra time...


    My suggestion for the current starfield: use Shift+Del on the files and start over again.
    Teaudirenopossum.Musasapientumfixaestinaure.
    (I can't hear you. There's a banana in my ear)

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