Results 1 to 5 of 5

Thread: Setting backcolor of surface, also some other questi0ns

  1. #1

    Thread Starter
    Fanatic Member scr0p's Avatar
    Join Date
    Oct 2002
    Location
    VA
    Posts
    720

    Setting backcolor of surface, also some other questi0ns

    I have a sprite that plays when my form runs, in windowed mode, I do not want the form to be resizable but how would I make the picture box dimensions the same as the sprite (Lets say I dunno the sprites deminesions, I want the user to select one)

    How would I set a surface to be a solid color, instead of loading a 1 colored bitmap on to it?

    What exactly do "DDSD_CAPS Or DDSD_HEIGHT Or DDSD_WIDTH" do?

    How would I show the FPS on the users screen? using dx.DrawText()
    Last edited by scr0p; Mar 9th, 2003 at 10:29 AM.
    asdf

  2. #2
    Addicted Member Sonikku`'s Avatar
    Join Date
    Oct 2002
    Location
    NyC~
    Posts
    165
    make the form/picbox = the dimensions oF the sprite

    VB Code:
    1. piCBox.Height = ddsdSprite.lHeight
    2. piCBox.Width = ddsdSprite.lWidth

  3. #3
    Good Ol' Platypus Sastraxi's Avatar
    Join Date
    Jan 2000
    Location
    Ontario, Canada
    Posts
    5,134
    I suppose Sonikku is right, but remember that you also need to compensate for borders and scalemodes.

    Use the [surface].BltColorFill command.

    DDSD_CAPS, _WIDTH, and _HEIGHT specify what properties will affect the created surface. Width and Height mean to explicitly declare the width and height (in lWidth and lHeight), and _CAPS makes it look in lCaps.ddsCaps (It's been so long since I've done DDRAW, I forget).

    Every frame, take the time between now and the last drawn frame... 1000 divided by this is your framerate. You may want to average these values out over a course of a second, so the user can actually read the framerate. Then you can use the DrawText command. The last value should be FALSE so that a border is not drawn around the text, but if you want one by all means use it, this is just a warning
    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

    Thread Starter
    Fanatic Member scr0p's Avatar
    Join Date
    Oct 2002
    Location
    VA
    Posts
    720
    ooPs, I had that, It was giving the right height but I forgot that it was 1 big bitmap, haha it was like 3 times the width it was supposed to be, so I need to set the width manually :E
    asdf

  5. #5

    Thread Starter
    Fanatic Member scr0p's Avatar
    Join Date
    Oct 2002
    Location
    VA
    Posts
    720
    I got it, iLL divide the width by the # of frames ~



    In this code, What is the GoGo for? when the timer gets to that code, the same thing will happen whether GoGo is true or false, If it set to true at the end of the Init command.

    VB Code:
    1. If GoGo = True Then                          'If GoGo is true, then
    2.             CurFrame = CurFrame + 1                 'Add 1 to current frame
    3.                 If CurFrame > UBound(fRame) Then    'If Current frame exceeds the animation frames then reset back to 0 and set to false to start playing again
    4.                     CurFrame = 0
    5.                     GoGo = False
    6.                 End If
    7.         Else
    8.                 CurFrame = CurFrame - 1                'If its false then minus 1 from CurFrames
    9.                 If CurFrame < LBound(fRame) Then       'If the curentFrant # gets lower than ani frames, then reset to 0 and set to true to start going again
    10.                     CurFrame = 0
    11.                     GoGo = True
    12.                 End If
    13.         End If
    Last edited by scr0p; Mar 10th, 2003 at 02:44 PM.
    asdf

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