|
-
May 5th, 2001, 12:16 AM
#1
surface properties
I use the following code to create a surface from a file:
Code:
Public imgDesc As DDSURFACEDESC2 'image surface description
'in a sub
imgDesc.lFlags = DDSD_CAPS
imgDesc.ddsCaps.lCaps = DDSCAPS_OFFSCREENPLAIN
Set imgBuffer = DDraw.CreateSurfaceFromFile(FileName, imgDesc)
'change the size of the picture box so it is the same size as the picture
picMain.Width = picMain.ScaleX(imgDesc.lWidth, vbPixels, vbTwips)
picMain.Height = picMain.ScaleY(imgDesc.lHeight, vbPixels, vbTwips)
'then the blitting is done
The code works fine the first time round. However when I run it the second time in the life time of the program (with a different file), the dimensions of imgDesc (lwidth and lheight) don't seem to change at all...they remain in the same dimensions as the first picture loaded. I'm probably missing something to reset the surface or something similar, but I have no idea what it is!
-
May 5th, 2001, 06:58 AM
#2
transcendental analytic
imgdesc should be nulled before next use, simplest would be to declare it procedure scope in the sub where the surface is loaded.
Use  
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
-
May 5th, 2001, 07:12 AM
#3
Do you mean just imgDesc = Null?
I'm getting this when it runs:
Only UDTs defined in public object modules can be coerced to or from a variant or passed to late-bound functions
If it means anything, the code I use is in a class module. Declaring it in one procedure isn't really an option in my case.
-
May 5th, 2001, 08:31 AM
#4
transcendental analytic
No i meant that you should have a blank UDT, all values 0 that is. You can do this by declaring an unused ddsurfacedesc2 and assign imgDesc it.
Null is a value you can only assign variants.
Use  
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
-
May 5th, 2001, 06:54 PM
#5
cool stuff, thanks kedaman!
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
|