Changeset 43 for trunk/Forms
- Timestamp:
- Apr 19, 2019, 11:25:56 AM (6 years ago)
- Location:
- trunk/Forms
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Forms/UMainForm.pas
r42 r43 141 141 Application.OnDeactivate := FormDeactivate; 142 142 Randomize; 143 DoubleBuffered := True;143 DoubleBuffered := False; 144 144 Engine := TEngine.Create; 145 145 Engine.Bitmap := Image1.Picture.Bitmap; 146 CoolTranslator1.Language := CoolTranslator1.Languages.SearchByCode('cs'); 146 147 LoadConfig; 147 148 Engine.NewGame; 148 149 Engine.Active := True; 149 150 Image1Resize(Self); 150 151 151 Image1.ControlStyle := Image1.ControlStyle + [csOpaque]; 152 152 end; … … 236 236 begin 237 237 PersistentForm.Load(Self); 238 CoolTranslator1.Language := CoolTranslator1.Languages.SearchByCode('cs');239 238 end; 240 239 -
trunk/Forms/UNewGameForm.lfm
r39 r43 1 1 object NewGameForm: TNewGameForm 2 2 Left = 579 3 Height = 5423 Height = 650 4 4 Top = 226 5 Width = 8465 Width = 1015 6 6 Caption = 'New game' 7 ClientHeight = 5428 ClientWidth = 8469 DesignTimePPI = 1 207 ClientHeight = 650 8 ClientWidth = 1015 9 DesignTimePPI = 144 10 10 OnCreate = FormCreate 11 11 OnDestroy = FormDestroy … … 13 13 LCLVersion = '2.0.0.4' 14 14 object ButtonStart: TButton 15 Left = 74016 Height = 3 117 Top = 50018 Width = 9415 Left = 888 16 Height = 37 17 Top = 600 18 Width = 113 19 19 Anchors = [akRight, akBottom] 20 20 Caption = 'Start' … … 24 24 end 25 25 object ButtonCancel: TButton 26 Left = 63027 Height = 3 128 Top = 50029 Width = 9426 Left = 756 27 Height = 37 28 Top = 600 29 Width = 113 30 30 Anchors = [akRight, akBottom] 31 31 Caption = 'Cancel' … … 35 35 end 36 36 object Label1: TLabel 37 Left = 1 038 Height = 2 037 Left = 12 38 Height = 26 39 39 Top = 0 40 Width = 4940 Width = 66 41 41 Caption = 'Players:' 42 42 ParentColor = False … … 44 44 end 45 45 object ListView1: TListView 46 Left = 1 047 Height = 46048 Top = 3 049 Width = 36846 Left = 12 47 Height = 552 48 Top = 36 49 Width = 442 50 50 Anchors = [akTop, akLeft, akBottom] 51 51 Checkboxes = True … … 53 53 item 54 54 Caption = 'Name' 55 Width = 18855 Width = 226 56 56 end 57 57 item 58 58 Caption = 'Color' 59 Width = 6259 Width = 74 60 60 end 61 61 item 62 62 Caption = 'Controls' 63 Width = 18963 Width = 227 64 64 end> 65 65 OwnerData = True … … 70 70 ViewStyle = vsReport 71 71 OnChange = ListView1Change 72 OnCustomDrawSubItem = ListView1CustomDrawSubItem 72 73 OnData = ListView1Data 73 74 OnSelectItem = ListView1SelectItem 74 75 end 75 76 object ColorButton1: TColorButton 76 Left = 63077 Height = 3 178 Top = 8079 Width = 9477 Left = 756 78 Height = 37 79 Top = 96 80 Width = 113 80 81 BorderWidth = 2 81 82 ButtonColorSize = 16 … … 85 86 end 86 87 object Label2: TLabel 87 Left = 50088 Height = 2 089 Top = 8490 Width = 3991 Caption = 'Color :'88 Left = 600 89 Height = 26 90 Top = 101 91 Width = 65 92 Caption = 'Color 1:' 92 93 ParentColor = False 93 94 ParentFont = False 94 95 end 95 96 object GroupBox1: TGroupBox 96 Left = 49097 Height = 3 3098 Top = 1 3099 Width = 34097 Left = 588 98 Height = 368 99 Top = 184 100 Width = 408 100 101 Caption = 'Control keys' 101 ClientHeight = 3 05102 ClientWidth = 336102 ClientHeight = 341 103 ClientWidth = 406 103 104 ParentFont = False 104 105 TabOrder = 3 105 106 object EditUp: TEdit 106 Left = 1 08107 Height = 28107 Left = 130 108 Height = 43 108 109 Top = 2 109 Width = 1 00110 Width = 120 110 111 OnChange = EditUpChange 111 112 OnKeyDown = EditUpKeyDown … … 114 115 end 115 116 object Label3: TLabel 116 Left = 8117 Height = 2 0118 Top = 1 2119 Width = 2 2117 Left = 10 118 Height = 26 119 Top = 14 120 Width = 29 120 121 Caption = 'Up:' 121 122 ParentColor = False … … 123 124 end 124 125 object Label4: TLabel 125 Left = 8126 Height = 2 0127 Top = 52128 Width = 42126 Left = 10 127 Height = 26 128 Top = 62 129 Width = 54 129 130 Caption = 'Down:' 130 131 ParentColor = False … … 132 133 end 133 134 object EditDown: TEdit 134 Left = 1 08135 Height = 28136 Top = 4 0137 Width = 1 00135 Left = 130 136 Height = 43 137 Top = 48 138 Width = 120 138 139 OnChange = EditDownChange 139 140 OnKeyDown = EditDownKeyDown … … 142 143 end 143 144 object Label5: TLabel 144 Left = 8145 Height = 2 0146 Top = 92147 Width = 28145 Left = 10 146 Height = 26 147 Top = 110 148 Width = 37 148 149 Caption = 'Left:' 149 150 ParentColor = False … … 151 152 end 152 153 object EditLeft: TEdit 153 Left = 1 08154 Height = 28155 Top = 82156 Width = 1 00154 Left = 130 155 Height = 43 156 Top = 98 157 Width = 120 157 158 OnChange = EditLeftChange 158 159 OnKeyDown = EditLeftKeyDown … … 161 162 end 162 163 object Label6: TLabel 163 Left = 8164 Height = 2 0165 Top = 1 32166 Width = 38164 Left = 10 165 Height = 26 166 Top = 158 167 Width = 50 167 168 Caption = 'Right:' 168 169 ParentColor = False … … 170 171 end 171 172 object EditRight: TEdit 172 Left = 1 08173 Height = 28174 Top = 1 22175 Width = 1 00173 Left = 130 174 Height = 43 175 Top = 146 176 Width = 120 176 177 OnChange = EditRightChange 177 178 OnKeyDown = EditRightKeyDown … … 180 181 end 181 182 object Label7: TLabel 182 Left = 8183 Height = 2 0184 Top = 172185 Width = 42183 Left = 10 184 Height = 26 185 Top = 206 186 Width = 55 186 187 Caption = 'Shoot:' 187 188 ParentColor = False … … 189 190 end 190 191 object EditShoot: TEdit 191 Left = 1 08192 Height = 28193 Top = 1 62194 Width = 1 00192 Left = 130 193 Height = 43 194 Top = 194 195 Width = 120 195 196 OnChange = EditShootChange 196 197 OnKeyDown = EditShootKeyDown … … 200 201 end 201 202 object EditName: TEdit 203 Left = 720 204 Height = 43 205 Top = 36 206 Width = 264 207 OnChange = EditNameChange 208 ParentFont = False 209 TabOrder = 4 210 end 211 object Label8: TLabel 202 212 Left = 600 203 Height = 28 204 Top = 30 205 Width = 220 206 OnChange = EditNameChange 207 ParentFont = False 208 TabOrder = 4 209 end 210 object Label8: TLabel 211 Left = 500 212 Height = 20 213 Top = 40 214 Width = 43 213 Height = 26 214 Top = 48 215 Width = 56 215 216 Caption = 'Name:' 216 217 ParentColor = False 217 218 ParentFont = False 218 219 end 220 object Label9: TLabel 221 Left = 600 222 Height = 26 223 Top = 141 224 Width = 65 225 Caption = 'Color 2:' 226 ParentColor = False 227 ParentFont = False 228 end 229 object ColorButton2: TColorButton 230 Left = 756 231 Height = 37 232 Top = 136 233 Width = 113 234 BorderWidth = 2 235 ButtonColorSize = 16 236 ButtonColor = clBlack 237 OnColorChanged = ColorButton2ColorChanged 238 ParentFont = False 239 end 219 240 end -
trunk/Forms/UNewGameForm.lrj
r39 r43 7 7 {"hash":4875106,"name":"tnewgameform.listview1.columns[1].caption","sourcebytes":[67,111,108,111,114],"value":"Color"}, 8 8 {"hash":106664595,"name":"tnewgameform.listview1.columns[2].caption","sourcebytes":[67,111,110,116,114,111,108,115],"value":"Controls"}, 9 {"hash": 78001754,"name":"tnewgameform.label2.caption","sourcebytes":[67,111,108,111,114,58],"value":"Color:"},9 {"hash":104220650,"name":"tnewgameform.label2.caption","sourcebytes":[67,111,108,111,114,32,49,58],"value":"Color 1:"}, 10 10 {"hash":21055635,"name":"tnewgameform.groupbox1.caption","sourcebytes":[67,111,110,116,114,111,108,32,107,101,121,115],"value":"Control keys"}, 11 11 {"hash":23610,"name":"tnewgameform.label3.caption","sourcebytes":[85,112,58],"value":"Up:"}, … … 14 14 {"hash":93314938,"name":"tnewgameform.label6.caption","sourcebytes":[82,105,103,104,116,58],"value":"Right:"}, 15 15 {"hash":94332538,"name":"tnewgameform.label7.caption","sourcebytes":[83,104,111,111,116,58],"value":"Shoot:"}, 16 {"hash":5538698,"name":"tnewgameform.label8.caption","sourcebytes":[78,97,109,101,58],"value":"Name:"} 16 {"hash":5538698,"name":"tnewgameform.label8.caption","sourcebytes":[78,97,109,101,58],"value":"Name:"}, 17 {"hash":104220666,"name":"tnewgameform.label9.caption","sourcebytes":[67,111,108,111,114,32,50,58],"value":"Color 2:"} 17 18 ]} -
trunk/Forms/UNewGameForm.pas
r41 r43 17 17 ButtonCancel: TButton; 18 18 ColorButton1: TColorButton; 19 ColorButton2: TColorButton; 19 20 EditUp: TEdit; 20 21 EditDown: TEdit; … … 32 33 Label7: TLabel; 33 34 Label8: TLabel; 35 Label9: TLabel; 34 36 ListView1: TListView; 35 37 procedure ColorButton1ColorChanged(Sender: TObject); 38 procedure ColorButton2ColorChanged(Sender: TObject); 36 39 procedure EditDownChange(Sender: TObject); 37 40 procedure EditDownKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState … … 54 57 procedure ListView1Change(Sender: TObject; Item: TListItem; 55 58 Change: TItemChange); 59 procedure ListView1CustomDrawSubItem(Sender: TCustomListView; 60 Item: TListItem; SubItem: Integer; State: TCustomDrawState; 61 var DefaultDraw: Boolean); 56 62 procedure ListView1Data(Sender: TObject; Item: TListItem); 57 63 procedure ListView1SelectItem(Sender: TObject; Item: TListItem; … … 61 67 procedure ReloadList; 62 68 public 69 procedure UpdateInterface; 63 70 procedure LoadData(Engine: TEngine); 64 71 procedure SaveData(Engine: TEngine); … … 73 80 {$R *.lfm} 74 81 82 uses 83 UMainForm; 84 75 85 { TNewGameForm } 76 86 … … 80 90 if Change = ctState then 81 91 TPlayer(Item.Data).Enabled := Item.Checked; 92 end; 93 94 procedure TNewGameForm.ListView1CustomDrawSubItem(Sender: TCustomListView; 95 Item: TListItem; SubItem: Integer; State: TCustomDrawState; 96 var DefaultDraw: Boolean); 97 begin 98 if SubItem = 1 then 99 with ListView1.Canvas do begin 100 Brush.Color := TPlayer(Item.Data).Color1; 101 Brush.Style := bsSolid; 102 FillRect(Item.DisplayRectSubItem(1, drBounds)); 103 end; 82 104 end; 83 105 … … 87 109 with TPlayer(Players[Item.Index]) do begin 88 110 Item.Caption := Name; 89 Item.SubItems.Add( IntToHex(Color, 6));111 Item.SubItems.Add(''); 90 112 Item.SubItems.Add(''); 91 113 Item.Checked := Enabled; … … 100 122 with TPlayer(Item.Data) do begin 101 123 EditName.Text := Name; 102 ColorButton1.ButtonColor := Color; 124 ColorButton1.ButtonColor := Color1; 125 ColorButton2.ButtonColor := Color2; 103 126 EditDown.Text := IntToStr(Keys.Down); 104 127 EditUp.Text := IntToStr(Keys.Up); … … 107 130 EditShoot.Text := IntToStr(Keys.Shoot); 108 131 end; 132 UpdateInterface; 109 133 end; 110 134 … … 115 139 end; 116 140 141 procedure TNewGameForm.UpdateInterface; 142 begin 143 EditUp.Enabled := Assigned(ListView1.Selected); 144 EditDown.Enabled := Assigned(ListView1.Selected); 145 EditLeft.Enabled := Assigned(ListView1.Selected); 146 EditRight.Enabled := Assigned(ListView1.Selected); 147 EditShoot.Enabled := Assigned(ListView1.Selected); 148 EditName.Enabled := Assigned(ListView1.Selected); 149 ColorButton1.Enabled := Assigned(ListView1.Selected); 150 ColorButton2.Enabled := Assigned(ListView1.Selected); 151 end; 152 117 153 procedure TNewGameForm.LoadData(Engine: TEngine); 118 154 begin … … 129 165 if Assigned(ListView1.Selected) then 130 166 with TPlayer(ListView1.Selected.Data) do begin 131 Color := ColorButton1.ButtonColor; 167 Color1 := ColorButton1.ButtonColor; 168 ReloadList; 169 end; 170 end; 171 172 procedure TNewGameForm.ColorButton2ColorChanged(Sender: TObject); 173 begin 174 if Assigned(ListView1.Selected) then 175 with TPlayer(ListView1.Selected.Data) do begin 176 Color2 := ColorButton2.ButtonColor; 132 177 ReloadList; 133 178 end; … … 230 275 procedure TNewGameForm.FormCreate(Sender: TObject); 231 276 begin 232 Players := TPlayers.Create 277 MainForm.CoolTranslator1.TranslateComponentRecursive(Self); 278 Players := TPlayers.Create; 233 279 end; 234 280 … … 241 287 begin 242 288 ReloadList; 289 UpdateInterface; 243 290 end; 244 291
Note:
See TracChangeset
for help on using the changeset viewer.