|
-
Mar 9th, 2003, 10:26 AM
#1
Thread Starter
Fanatic Member
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
-
Mar 9th, 2003, 05:54 PM
#2
Addicted Member
make the form/picbox = the dimensions oF the sprite
VB Code:
piCBox.Height = ddsdSprite.lHeight
piCBox.Width = ddsdSprite.lWidth
-
Mar 9th, 2003, 11:06 PM
#3
Good Ol' Platypus
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)
-
Mar 10th, 2003, 01:09 PM
#4
Thread Starter
Fanatic Member
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
-
Mar 10th, 2003, 01:12 PM
#5
Thread Starter
Fanatic Member
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:
If GoGo = True Then 'If GoGo is true, then
CurFrame = CurFrame + 1 'Add 1 to current frame
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
CurFrame = 0
GoGo = False
End If
Else
CurFrame = CurFrame - 1 'If its false then minus 1 from CurFrames
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
CurFrame = 0
GoGo = True
End If
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|