1
0
mirror of https://github.com/moparisthebest/Simba synced 2024-12-23 07:48:50 -05:00

GetDebugImage now ported to PS, thanks to Wizzups leet Bitmap.FromRawImage :D

git-svn-id: http://www.villavu.com/repositories/merlijn/mufasa@340 3f818213-9676-44b0-a9b4-5e4c4e03d09d
This commit is contained in:
Raymond 2009-12-25 23:56:25 +00:00
parent 6e0136acfc
commit 49b18d677a
6 changed files with 297 additions and 282 deletions

View File

@ -44,9 +44,10 @@ type
public
DispSize : TPoint;
ToDrawBmp: TMufasaBitmap;//The bitmap we should draw!
GetDbgBmp : TMufasaBitmap;
procedure BlackDebugImage;
procedure DrawBitmap;
procedure GetDebugImage(out bmp : TMufasaBitmap);
procedure GetDebugImage;
procedure ShowDebugImgForm; //Uses the global var for w/h
{ public declarations }
end;
@ -99,12 +100,9 @@ begin
Bitmap.Free;
end;
procedure TDebugImgForm.GetDebugImage(out bmp: TMufasaBitmap);
procedure TDebugImgForm.GetDebugImage;
begin;
DrawImage.Picture.SaveToFile(MainDir + DS + 'stupidwayofdoingthis.bmp');
bmp := TMufasaBitmap.Create;
bmp.LoadFromFile(MainDir + DS + 'stupidwayofdoingthis.bmp');
DeleteFile(MainDir + DS + 'stupidwayofdoingthis.bmp');
GetDbgBmp.LoadFromRawImage(DrawImage.Picture.Bitmap.RawImage);
end;
procedure TDebugImgForm.ShowDebugImgForm;

View File

@ -123,6 +123,11 @@ procedure TFunctionListFrame.FunctionListMouseDown(Sender: TObject;
var
N: TTreeNode;
begin
if InCodeCompletion then
begin;
Writeln('Not yet implemented');
exit;
end;
N := Self.FunctionList.GetNodeAt(x, y);
if(N = nil)then
begin

View File

@ -456,6 +456,8 @@ begin
DbgImgInfo.ShowForm := @DebugImgForm.ShowDebugImgForm;
DbgImgInfo.ToDrawBitmap:= @DebugImgForm.ToDrawBmp;
DbgImgInfo.DrawBitmap:= @DebugImgForm.DrawBitmap;
DbgImgInfo.GetDebugBitmap:= @DebugImgForm.GetDbgBmp;
DbgImgInfo.GetBitmap:= @DebugImgForm.GetDebugImage;
ScriptThread.SetDbgImg(DbgImgInfo);
ScriptThread.OnError:=@ErrorThread;

View File

@ -110,6 +110,13 @@ begin;
CurrThread.Synchronize(CurrThread.DebugImg.DrawBitmap);
end;
function GetDebugBitmap : integer;
begin;
result := CurrThread.Client.MBitmaps.CreateBMP(0,0);
CurrThread.DebugImg.GetDebugBitmap^ := CurrThread.Client.MBitmaps.Bmp[result];
CurrThread.Synchronize(CurrThread.DebugImg.GetBitmap);
end;
procedure TerminateScript;
begin;
CurrThread.PSScript.Stop;

View File

@ -91,6 +91,7 @@ AddFunction(@HakunaMatata,'procedure HakunaMatata;');
AddFunction(@TerminateScript,'procedure TerminateScript;');
AddFunction(@DisplayDebugImgWindow,'procedure DisplayDebugImgWindow(w,h : integer);');
AddFunction(@DrawBitmapDebugImg,'procedure DrawBitmapDebugImg(bmp : integer);');
AddFunction(@GetDebugBitmap,'function GetDebugBitmap : integer;');
AddFunction(@Random,'function Random(Int : integer): integer;');

View File

@ -47,6 +47,8 @@ type
ShowForm : procedure of object;
ToDrawBitmap : ^TMufasaBitmap;
DrawBitmap : procedure of object;
GetDebugBitmap : ^TMufasaBitmap;
GetBitmap : procedure of object;
end;
PSyncInfo = ^TSyncInfo;
TErrorType = (errRuntime,errCompile);