PDA

Click to See Complete Forum and Search --> : Colors in DirectX7


LostShade
Feb 14th, 2000, 08:45 PM
Hello,

I Have a great little game I have been tinkering with for a few years now. the
graphics in it though. run by VB and a little API have a tendancy to be rather slow
with occasional flickers when working with the background and transparency.

About 3 days ago I learned Dx7 offered VB support, got a copy of it and have
been saturating myself in it. To date I have had increadable results. I have
managed to redo my graphics engine so that Dx7 handles it completely and it
works well at about 180 fps Except one problem I cant seem to find an answer
too.

I am using Bitmaps save in 24bits, I am quite certain my screen mode is set to
16bits and the images apear to convert into 8bit!

'Screen settings
Call ddraw.SetCooperativeLevel(Me.hWnd, DDSCL_FULLSCREEN Or
DDSCL_ALLOWMODEX Or DDSCL_EXCLUSIVE)
ddraw.SetDisplayMode 1024, 768, 16, 0, DDSDM_DEFAULT

'Primary Surface
dPrim.lFlags = DDSD_CAPS
dPrim.ddsCaps.lCaps = DDSCAPS_PRIMARYSURFACE
Set primary = ddraw.CreateSurface(dPrim)

'Clipper
Set ddClipper = ddraw.CreateClipper(0)
ddClipper.SetHWnd Picture1.hWnd
primary.SetClipper ddClipper

'backbuffer
dBack.lFlags = DDSD_CAPS Or DDSD_HEIGHT Or DDSD_WIDTH
dBack.ddsCaps.lCaps = DDSCAPS_OFFSCREENPLAIN Or
DDSCAPS_SYSTEMMEMORY
dBack.lWidth = Picture1.Width
dBack.lHeight = Picture1.Height
Set backbuffer = ddraw.CreateSurface(dBack)
backbuffer.SetFontTransparency True
backbuffer.SetForeColor vbGreen

'Example of where Im storeing images
Dim key As DDCOLORKEY
key.low = 0
key.high = 0
dGround(xx).lFlags = DDSD_CAPS
dGround(xx).ddsCaps.lCaps = DDSCAPS_OFFSCREENPLAIN
Set Ground(xx) = ddraw.CreateSurfaceFromFile(App.Path + "\data\Floors\" +
floorfiles(xx) + ".bmp", dGround(xx))
Ground(xx).SetColorKey DDCKEY_SRCBLT, key

I belive I understand all the code here fully I just dont know what I missing...
Perhaps, If there is a simple solution Im missing, you could offer me a bit of
assistance.

Thank you,
LostShade

LostShade
Feb 15th, 2000, 03:36 AM
Ever feal like an idiot? :)

After massive testing and experimenting... I found an answer... for anyone who would care not to make the same mistake here is what I did...

I drew my images with my screen settings on 32bit true color. I saved as a 24bit BMP... so it DOES load a 16 bit image from it. just far from the 24-32bit image I thought I created...<smacks forhead> Somehow I just selected all the wrong colors

anyhow anyone drawing some art I might suggest changing your screen settings to match the final programs results... saves a bit of frustration

Dope~~~ <cringe>
LostShade

KENNNY
Feb 15th, 2000, 04:09 AM
lol :)
the code looks fine though :p

------------------
cintel rules :p
www.cintelsoftware.co.uk