PDA

View Full Version : Weird problem #2



Rojekti
29-05-2007, 06:10 PM
What, oh what is this.. I had to reinstall my Windows XP and so everything else; Delphi too, and Asphyre there.. well, it worked well, but I seem to have problems with graphics.

So, I do remember to initialize the AsphyreDevice before using it. AsphyreTimer makes Dev.Render and Dev.Flip so the screen is black, untill..

I load images to AsphyreImages with this:


procedure Tform1.AddImage(img:string; where:TAsphyreImages; tolerance:integer);
var
sad:TBitmap;
wi,he:variant;
begin
sad := TBitmap.Create;
sad.LoadFromFile(img);
wi := sad.Width; he := sad.Height;
with where.Add do
begin
Quality := aqHigh;
AlphaLevel := alFull;
PatternSize:= Point(wi, he);
Size := Point(wi, he);
VisibleSize:= Point(wi, he);
LoadFromBitmap(sad, true, 0, tolerance);
Name := (extractfilename(img));
end;
end;



..and it throws error; right now the code where Access violation- error points is this (DXBase.pas):



function DXTexFormatAvail(Format: TD3DFormat; Usage: Cardinal): Boolean;
begin
Result:= Succeeded(Direct3D.CheckDeviceFormat(D3DADAPTER_DE FAULT,
D3DDEVTYPE_HAL, PresentParams.BackBufferFormat, Usage, D3DRTYPE_TEXTURE,
Format));
end;


What's the problem? I do everything right but.. :(

Robert Kosek
29-05-2007, 06:25 PM
Why are you loading from the disk instead of the ASDb image records? That lets you define sprite sheets over the rather brute-force methodology you're attempting right now.

You might not want to use the variants there for width and height, just assign them directly.

Rojekti
29-05-2007, 06:29 PM
Why are you loading from the disk instead of the ASDb image records? That lets you define sprite sheets over the rather brute-force methodology you're attempting right now.

Yep, this is already been discussed. I want to load images straight from disc; not records or those ASD-files; just plain images on disk, easy to be edited anytime by anyone.. well, it's truly welcomed if there is some better way than this, just want to load them from disc :)



You might not want to use the variants there for width and height, just assign them directly.

Yup, and there's no Sad.Free; but it'll work here in the forum; I bet everyone understands.

Rojekti
30-05-2007, 12:10 PM
Well isn't it funny. FIRST I loaded pictures, THEN I initialized the Device - and that's too late.

It now initializes the Device BEFORE loading images.

Problem solved, thanks anyway. This seems to be quite quiet place nowadays :) More members, don't let this forum die!

wodzu
30-05-2007, 06:07 PM
Glad to hear that you solved your problem. Do you still use Asphyre 3 ?

\\

wodzu
30-05-2007, 06:09 PM
Uhm..sorry for posting second post but I wanted to edit my post and I can't do this. Why is that? :(

Rojekti
30-05-2007, 07:35 PM
I noticed it too; seems to be that there's no possibility to edit own messages.. :(


..yes, I got it working. eXtreme 3, that's what I use since I have Delphi 7 which isn't supported by Asphyre 4.

Now I'm trying to get some kind of TextOut- procedure to function proberly.