PDA

View Full Version : Plonking 800x600 background on screen



czar
09-11-2004, 08:55 AM
Hi all,

I am currently weening myself off DelphiX. It has served me for the 4-5 years and I am very comfortable with it. However, might be time to move on. I have chosen Asphyre becuase not only does it do the hardware stuff, but it also caters to software mode. However first hurdle.

In delphiX I tend to load in a picture of the screen (say single bitmap 800x600) and put that on the screen first and place sprites other bitmaps on top as required.

Now, when I try to load in such a large bitmap in asphyre I get the distinct impression that it doesn't like it. Greater than 256x256 seems to be a no no and 800x600 won't work and gets bumped up to 1024x768.

Question is, how do I go about doing this simple task? One obvious way would be split the background into multiple parts but that just seems silly.

So how do I get the same result as my old

dximagelist.items[0].draw(dxdraw.surface, 0, 0, 0);

Ta muchly

R

Huehnerschaender
09-11-2004, 09:24 PM
Hello,

I myself do it the 256*256 way.
I do this because I want to be compatible even with old 3D-cards, which do not support bigger textures.
You can also just expand your image to 1024*768 and then load it. But it is always a good idea to size the image power of 2 (16*16, 32*32 etc)
This is necessary because we are in 3D hardware mode, where graphic cards use textures which normally have to sized power of 2. You can also use 800*600 images, but your program will not run properly on every 3D card, especially not on older ones.

Now how to draw a tiled background?

I do it this way:

procedure TBackground.Draw(Delta : double);
var x,y : byte;
begin
for y := 0 to 2 do
for x := 0 to 3 do
MainForm.PD.Device.TextureMap(MainForm.Images1.Ima ge[fImages[x,y]],
pBounds4(256*x, 256*y, 256, 256),
cColor1(fColor),
tPattern(0),
effectDiffuse);//effectSrcAlpha);
end;

This is just a little snap of code of one of my basic classes, but it does nothing else than printing all 12 image snaps of a tiled 1024*768 background on screen.

This seems a little uncomfortable, but you will see a very big advantage in speed. I began my game with DelphiX. When adding more and more effects etc. I was finally able to display about 20-30 FPS.
With Asphyre I am now at 100 (all effect simultaniously on screen) - 450 just drawing all contents without particle effect currently on screen.

I think thats a great advantage against DelhiX...

Greetings,
Dirk

czar
10-11-2004, 10:10 PM
Thanks for that. I got that going.

I will put together a demo so that I can test the suitability of the computers we currently develop software for.