Skip to content

Commit

Permalink
Added options form
Browse files Browse the repository at this point in the history
  • Loading branch information
dimsa committed Oct 11, 2015
1 parent 6f5fab5 commit da00f25
Show file tree
Hide file tree
Showing 8 changed files with 211 additions and 20 deletions.
4 changes: 2 additions & 2 deletions ShadowEngineDemo.dproj
Original file line number Diff line number Diff line change
Expand Up @@ -1157,12 +1157,12 @@
<Operation>1</Operation>
</Platform>
</DeployClass>
<ProjectRoot Platform="Win64" Name="$(PROJECTNAME)"/>
<ProjectRoot Platform="iOSSimulator" Name="$(PROJECTNAME).app"/>
<ProjectRoot Platform="Android" Name="$(PROJECTNAME)"/>
<ProjectRoot Platform="Win32" Name="$(PROJECTNAME)"/>
<ProjectRoot Platform="iOSDevice64" Name="$(PROJECTNAME).app"/>
<ProjectRoot Platform="Win64" Name="$(PROJECTNAME)"/>
<ProjectRoot Platform="OSX32" Name="$(PROJECTNAME).app"/>
<ProjectRoot Platform="iOSSimulator" Name="$(PROJECTNAME).app"/>
<ProjectRoot Platform="iOSDevice32" Name="$(PROJECTNAME).app"/>
</Deployment>
<Platforms>
Expand Down
56 changes: 43 additions & 13 deletions SpriteShapeBuilder/SSBMainForm.fmx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ object SSBForm: TSSBForm
Left = 0
Top = 0
Caption = 'Form1'
ClientHeight = 480
ClientHeight = 549
ClientWidth = 640
FormFactor.Width = 320
FormFactor.Height = 480
Expand All @@ -12,9 +12,9 @@ object SSBForm: TSSBForm
object MenuPanel: TPanel
Align = MostLeft
Size.Width = 117.791412353515600000
Size.Height = 480.000030517578100000
Size.Height = 549.000000000000000000
Size.PlatformDefault = False
TabOrder = 5
TabOrder = 6
object SelectImage: TImage
MultiResBitmap = <
item
Expand Down Expand Up @@ -50,6 +50,16 @@ object SSBForm: TSSBForm
XRadius = 3.000000000000000000
YRadius = 3.000000000000000000
end
object Label1: TLabel
Position.X = 8.000000000000000000
Position.Y = 320.000000000000000000
Size.Width = 98.000000000000000000
Size.Height = 97.000000000000000000
Size.PlatformDefault = False
Text =
'Double Click on Element to Edit and Double Click to Poly Point t' +
'o add New'
end
end
object AddPolyBtn: TCornerButton
Position.X = 8.000000000000000000
Expand All @@ -58,7 +68,7 @@ object SSBForm: TSSBForm
Size.Width = 97.000000000000000000
Size.Height = 33.000000000000000000
Size.PlatformDefault = False
TabOrder = 3
TabOrder = 4
Text = 'Add Poly'
XRadius = 3.000000000000000000
YRadius = 3.000000000000000000
Expand All @@ -70,7 +80,7 @@ object SSBForm: TSSBForm
Size.Width = 97.000000000000000000
Size.Height = 33.000000000000000000
Size.PlatformDefault = False
TabOrder = 4
TabOrder = 5
Text = 'Add Circle'
XRadius = 3.000000000000000000
YRadius = 3.000000000000000000
Expand All @@ -82,28 +92,29 @@ object SSBForm: TSSBForm
Size.Width = 97.000000000000000000
Size.Height = 33.000000000000000000
Size.PlatformDefault = False
TabOrder = 2
TabOrder = 3
Text = 'Delete Shape'
XRadius = 3.000000000000000000
YRadius = 3.000000000000000000
end
object SaveProjectBtn: TCornerButton
Anchors = [akLeft, akBottom]
Position.X = 8.000000000000000000
Position.Y = 440.000000000000000000
Position.Y = 509.000000000000000000
Sides = [Top, Left, Bottom, Right]
Size.Width = 97.000000000000000000
Size.Height = 33.000000000000000000
Size.PlatformDefault = False
TabOrder = 1
TabOrder = 2
Text = 'Save Project'
XRadius = 3.000000000000000000
YRadius = 3.000000000000000000
OnClick = SaveProjectBtnClick
end
object LoadProjectBtn: TCornerButton
Anchors = [akLeft, akBottom]
Position.X = 8.000000000000000000
Position.Y = 399.000000000000000000
Position.Y = 468.000000000000000000
Sides = [Top, Left, Bottom, Right]
Size.Width = 97.000000000000000000
Size.Height = 33.000000000000000000
Expand All @@ -112,18 +123,37 @@ object SSBForm: TSSBForm
Text = 'Load Project'
XRadius = 3.000000000000000000
YRadius = 3.000000000000000000
OnClick = LoadProjectBtnClick
end
object MainPanel: TPanel
Align = MostLeft
Anchors = [akLeft, akTop, akRight, akBottom]
Position.X = 117.791412353515600000
Size.Width = 523.000000000000000000
Size.Height = 480.000000000000000000
Size.Height = 549.000000000000000000
Size.PlatformDefault = False
TabOrder = 6
TabOrder = 7
end
object OpenDialog: TOpenDialog
Left = 126
Top = 8
Left = 150
Top = 16
end
object SaveForEngineBtn: TCornerButton
Anchors = [akLeft, akBottom]
Position.X = 8.000000000000000000
Position.Y = 428.000000000000000000
Sides = [Top, Left, Bottom, Right]
Size.Width = 97.000000000000000000
Size.Height = 33.000000000000000000
Size.PlatformDefault = False
TabOrder = 1
Text = 'Save for Engine'
XRadius = 3.000000000000000000
YRadius = 3.000000000000000000
OnClick = SaveForEngineBtnClick
end
object SaveDialog: TSaveDialog
Left = 198
Top = 16
end
end
27 changes: 24 additions & 3 deletions SpriteShapeBuilder/SSBMainForm.pas
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,14 @@ TSSBForm = class(TForm)
MenuPanel: TPanel;
MainPanel: TPanel;
OpenDialog: TOpenDialog;
Label1: TLabel;
SaveForEngineBtn: TCornerButton;
SaveDialog: TSaveDialog;
procedure AddImageBtnClick(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure SaveProjectBtnClick(Sender: TObject);
procedure LoadProjectBtnClick(Sender: TObject);
procedure SaveForEngineBtnClick(Sender: TObject);
private
SSB: TSpriteShapeBuilder;
{ Private declarations }
Expand All @@ -39,10 +45,7 @@ implementation
procedure TSSBForm.AddImageBtnClick(Sender: TObject);
begin
if OpenDialog.Execute then
begin
SSB.AddElement(OpenDialog.FileName);
end;

end;

procedure TSSBForm.FormCreate(Sender: TObject);
Expand All @@ -51,4 +54,22 @@ procedure TSSBForm.FormCreate(Sender: TObject);
SSB.Init(Self);
end;

procedure TSSBForm.LoadProjectBtnClick(Sender: TObject);
begin
if OpenDialog.Execute then
SSB.LoadProject(OpenDialog.FileName);
end;

procedure TSSBForm.SaveForEngineBtnClick(Sender: TObject);
begin
if SaveDialog.Execute then
SSB.SaveForEngine(SaveDialog.FileName);
end;

procedure TSSBForm.SaveProjectBtnClick(Sender: TObject);
begin
if SaveDialog.Execute then
SSB.SaveProject(SaveDialog.FileName);
end;

end.
88 changes: 88 additions & 0 deletions SpriteShapeBuilder/SSBOptionsForm.fmx
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
object OptionsForm: TOptionsForm
Left = 0
Top = 0
Caption = 'Options'
ClientHeight = 366
ClientWidth = 341
FormFactor.Width = 320
FormFactor.Height = 480
FormFactor.Devices = [Desktop]
DesignerMasterStyle = 0
object ElementsPointGrd: TStringGrid
Anchors = [akLeft, akTop, akRight, akBottom]
Position.X = 8.000000000000000000
Position.Y = 120.000000000000000000
Size.Width = 321.000000000000000000
Size.Height = 193.000000000000000000
Size.PlatformDefault = False
TabOrder = 0
RowCount = 100
RowHeight = 21.000000000000000000
Viewport.Width = 317.000000000000000000
Viewport.Height = 168.000000000000000000
end
object ElementNameEdt: TEdit
Touch.InteractiveGestures = [LongTap, DoubleTap]
Anchors = [akLeft, akTop, akRight]
TabOrder = 2
Position.X = 8.000000000000000000
Position.Y = 24.000000000000000000
Size.Width = 323.000000000000000000
Size.Height = 22.000000000000000000
Size.PlatformDefault = False
end
object ElementPointsLbl: TLabel
Position.X = 8.000000000000000000
Position.Y = 104.000000000000000000
Text = 'ElementNameLbl'
end
object ElementPathEdt: TEdit
Touch.InteractiveGestures = [LongTap, DoubleTap]
Anchors = [akLeft, akTop, akRight]
TabOrder = 1
Position.X = 8.000000000000000000
Position.Y = 72.000000000000000000
Size.Width = 323.000000000000000000
Size.Height = 22.000000000000000000
Size.PlatformDefault = False
end
object ElementPathLbl: TLabel
Anchors = [akLeft, akTop, akRight]
Position.X = 8.000000000000000000
Position.Y = 56.000000000000000000
Size.Width = 328.000000000000000000
Size.Height = 17.000000000000000000
Size.PlatformDefault = False
Text = 'Path to Element Picture'
end
object ApplyBtn: TButton
Anchors = [akRight, akBottom]
Position.X = 248.000000000000000000
Position.Y = 327.000000000000000000
Size.Width = 80.000000000000000000
Size.Height = 25.000000000000000000
Size.PlatformDefault = False
TabOrder = 6
Text = 'Apply'
end
object CancelBtn: TButton
Anchors = [akRight, akBottom]
Position.X = 160.000000000000000000
Position.Y = 327.000000000000000000
Size.Width = 80.000000000000000000
Size.Height = 25.000000000000000000
Size.PlatformDefault = False
TabOrder = 5
Text = 'Cancel'
OnClick = CancelBtnClick
end
object ElementNameLbl: TLabel
Anchors = [akLeft, akTop, akRight]
Position.X = 8.000000000000000000
Position.Y = 8.000000000000000000
Size.Width = 328.000000000000000000
Size.Height = 17.000000000000000000
Size.PlatformDefault = False
Text = 'Element Name'
end
end
39 changes: 39 additions & 0 deletions SpriteShapeBuilder/SSBOptionsForm.pas
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
unit SSBOptionsForm;

interface

uses
System.SysUtils, System.Types, System.UITypes, System.Classes, System.Variants,
FMX.Types, FMX.Controls, FMX.Forms, FMX.Graphics, FMX.Dialogs, System.Rtti,
FMX.StdCtrls, FMX.Controls.Presentation, FMX.Edit, FMX.Layouts, FMX.Grid;

type
TOptionsForm = class(TForm)
ElementsPointGrd: TStringGrid;
ElementNameEdt: TEdit;
ElementPointsLbl: TLabel;
ElementPathEdt: TEdit;
ElementPathLbl: TLabel;
ApplyBtn: TButton;
CancelBtn: TButton;
ElementNameLbl: TLabel;
procedure CancelBtnClick(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;

var
OptionsForm: TOptionsForm;

implementation

{$R *.fmx}

procedure TOptionsForm.CancelBtnClick(Sender: TObject);
begin
Close;
end;

end.
4 changes: 3 additions & 1 deletion SpriteShapeBuilder/SpriteShapeBuilder.dpr
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,14 @@ uses
uIntersectorClasses in 'Intersector\uIntersectorClasses.pas',
uIntersectorMethods in 'Intersector\uIntersectorMethods.pas',
uNewFigure in 'Intersector\uNewFigure.pas',
uSSBFigure in 'uSSBFigure.pas';
uSSBFigure in 'uSSBFigure.pas',
SSBOptionsForm in 'SSBOptionsForm.pas' {OptionsForm};

{$R *.res}

begin
Application.Initialize;
Application.CreateForm(TSSBForm, SSBForm);
Application.CreateForm(TOptionsForm, OptionsForm);
Application.Run;
end.
6 changes: 5 additions & 1 deletion SpriteShapeBuilder/SpriteShapeBuilder.dproj
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,10 @@
<DCCReference Include="Intersector\uIntersectorMethods.pas"/>
<DCCReference Include="Intersector\uNewFigure.pas"/>
<DCCReference Include="uSSBFigure.pas"/>
<DCCReference Include="SSBOptionsForm.pas">
<Form>OptionsForm</Form>
<FormType>fmx</FormType>
</DCCReference>
<BuildConfiguration Include="Release">
<Key>Cfg_2</Key>
<CfgParent>Base</CfgParent>
Expand Down Expand Up @@ -700,9 +704,9 @@
<ProjectRoot Platform="Android" Name="$(PROJECTNAME)"/>
<ProjectRoot Platform="Win32" Name="$(PROJECTNAME)"/>
<ProjectRoot Platform="iOSDevice64" Name="$(PROJECTNAME).app"/>
<ProjectRoot Platform="Win64" Name="$(PROJECTNAME)"/>
<ProjectRoot Platform="OSX32" Name="$(PROJECTNAME).app"/>
<ProjectRoot Platform="iOSSimulator" Name="$(PROJECTNAME).app"/>
<ProjectRoot Platform="Win64" Name="$(PROJECTNAME)"/>
</Deployment>
<Platforms>
<Platform value="Android">True</Platform>
Expand Down
7 changes: 7 additions & 0 deletions SpriteShapeBuilder/uSpriteShapeBuilder.pas
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ TSpriteShapeBuilder = class(TInterfacedObject, ISerializable)
procedure DoDelete(ASender: TObject);
procedure DoSaveProject(ASender: TObject);
procedure DoLoadProject(ASender: TObject);

procedure DoZoom(Sender: TObject; Shift: TShiftState;
WheelDelta: Integer; var Handled: Boolean);
procedure DoMouseDown(Sender: TObject; Button: TMouseButton;
Expand All @@ -44,6 +45,7 @@ TSpriteShapeBuilder = class(TInterfacedObject, ISerializable)
procedure AddElement(const AElement: TSSBElement); overload;
procedure LoadProject(const AFileName: string);
procedure SaveProject(const AFileName: string);
procedure SaveForEngine(const AFileName: string);
constructor Create;
procedure Init(const AProgForm: TForm);
destructor Destroy; override;
Expand Down Expand Up @@ -317,6 +319,11 @@ procedure TSpriteShapeBuilder.LoadProject(const AFileName: string);
vList.Free;
end;

procedure TSpriteShapeBuilder.SaveForEngine(const AFileName: string);
begin

end;

procedure TSpriteShapeBuilder.SaveProject(const AFileName: string);
var
vList: TStringList;
Expand Down

0 comments on commit da00f25

Please sign in to comment.