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

View File

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

View File

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

View File

@ -110,6 +110,13 @@ begin;
CurrThread.Synchronize(CurrThread.DebugImg.DrawBitmap); CurrThread.Synchronize(CurrThread.DebugImg.DrawBitmap);
end; 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; procedure TerminateScript;
begin; begin;
CurrThread.PSScript.Stop; CurrThread.PSScript.Stop;

View File

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

View File

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