Skip to content

Commit

Permalink
dev
Browse files Browse the repository at this point in the history
  • Loading branch information
ollydev committed Feb 7, 2024
1 parent 355d8eb commit d2062fb
Show file tree
Hide file tree
Showing 17 changed files with 277 additions and 235 deletions.
12 changes: 12 additions & 0 deletions Examples/form.simba
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ var
List: TLazListBox;
Lbl: TLazLabel;
Panel: TLazPanel;
Img: TLazImage;
SimbaImg: TImage;
begin
Form := TLazForm.Create();
Form.SetCaption('Example form');
Expand All @@ -49,6 +51,16 @@ begin
Form.SetColor(Colors.DARK_GREY);
Form.SetBorderStyle(bsSingle); // Do not allow resizing

SimbaImg := TImage.CreateFromTarget([0,0,400,400]);

Img := TLazImage.Create(Form);
Img.SetParent(Form);
Img.SetBounds(400,200,200,200);
Img.SetStretch(True);
Img.GetPicture().SetBitmap(SimbaImg.ToLazBitmap());

SimbaImg.Free();

Button := TLazButton.Create(Form);
Button.SetParent(Form);
Button.SetAutoSize(True);
Expand Down
23 changes: 23 additions & 0 deletions Examples/image_drawtext.simba
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
var
myImage: TImage;
myBox: TBox;
begin
myImage := TImage.Create(500,1000);
myImage.Fill(Colors.DARK_GRAY);

myImage.SetFontAntialiasing(True);
myImage.SetFontSize(20);

myImage.DrawTextLines(TImage.FontNames, [10,10], Colors.BLACK);

myBox := [225,25,450,240];
myImage.DrawBox(myBox, Colors.RED);
myImage.DrawText(FormatDateTime('c', Now()), myBox, [ETextDrawAlignment.CENTER, ETextDrawAlignment.VERTICAL_CENTER], Colors.BLACK);

myImage.SetFontBold(True);
myImage.SetFontSize(50);
myImage.DrawText(IntToStr(Random(10000)), [225, 300], Colors.NAVY);

myImage.Show();
myImage.Free();
end.
3 changes: 2 additions & 1 deletion Source/Simba.lpi
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<TextDesc Value=""/>
</XPManifest>
<Icon Value="0"/>
<Resources Count="11">
<Resources Count="12">
<Resource_0 FileName="..\Examples\array.simba" Type="RCDATA" ResourceName="EXAMPLE_ARRAY"/>
<Resource_1 FileName="..\Examples\function.simba" Type="RCDATA" ResourceName="EXAMPLE_FUNCTION"/>
<Resource_2 FileName="..\Examples\loop.simba" Type="RCDATA" ResourceName="EXAMPLE_LOOP"/>
Expand All @@ -29,6 +29,7 @@
<Resource_8 FileName="..\Examples\json.simba" Type="RCDATA" ResourceName="EXAMPLE_JSON"/>
<Resource_9 FileName="..\Examples\form.simba" Type="RCDATA" ResourceName="EXAMPLE_FORM"/>
<Resource_10 FileName="..\Examples\irc.simba" Type="RCDATA" ResourceName="EXAMPLE_IRC"/>
<Resource_11 FileName="..\Examples\image_drawtext.simba" Type="RCDATA" ResourceName="EXAMPLE_DRAWTEXT"/>
</Resources>
</General>
<VersionInfo>
Expand Down
Binary file modified Source/Simba.res
Binary file not shown.
1 change: 1 addition & 0 deletions Source/forms/simba.openexampleform.pas
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,7 @@ procedure TSimbaOpenExampleForm.FormCreate(Sender: TObject);
AddNode('JSON', 'EXAMPLE_JSON' );
AddNode('Form', 'EXAMPLE_FORM' );
AddNode('IRC', 'EXAMPLE_IRC' );
AddNode('Draw Text', 'EXAMPLE_DRAWTEXT' );
end;

procedure TSimbaOpenExampleForm.DoTreeViewSelectionChanged(Sender: TObject);
Expand Down

0 comments on commit d2062fb

Please sign in to comment.