Changeset 43
- Timestamp:
- Apr 19, 2019, 11:25:56 AM (6 years ago)
- Location:
- trunk
- Files:
-
- 7 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 -
trunk/Languages/Tunneler.cs.po
r41 r43 10 10 "Content-Transfer-Encoding: 8bit\n" 11 11 "Language: cs\n" 12 "X-Generator: Poedit 2. 2\n"12 "X-Generator: Poedit 2.1.1\n" 13 13 14 14 #: tdebugform.caption 15 #, fuzzy16 15 msgctxt "tdebugform.caption" 17 16 msgid "Debug" … … 85 84 86 85 #: tnewgameform.label2.caption 87 msgid "Color :"88 msgstr "Barva :"86 msgid "Color 1:" 87 msgstr "Barva 1:" 89 88 90 89 #: tnewgameform.label3.caption … … 112 111 msgstr "Jméno:" 113 112 113 #: tnewgameform.label9.caption 114 msgid "Color 2:" 115 msgstr "Barva 2:" 116 114 117 #: tnewgameform.listview1.columns[0].caption 115 118 msgid "Name" … … 132 135 msgid "%0:s of %1:s" 133 136 msgstr "%0:s z %1:s" 134 -
trunk/Languages/Tunneler.po
r39 r43 73 73 74 74 #: tnewgameform.label2.caption 75 msgid "Color :"75 msgid "Color 1:" 76 76 msgstr "" 77 77 … … 100 100 msgstr "" 101 101 102 #: tnewgameform.label9.caption 103 msgid "Color 2:" 104 msgstr "" 105 102 106 #: tnewgameform.listview1.columns[0].caption 103 107 msgid "Name" -
trunk/UCore.pas
r42 r43 106 106 function DigProc(Item1, Item2: Byte): Byte; 107 107 public 108 Color: TColor; 108 Color1: TColor; 109 Color2: TColor; 109 110 Id: Integer; 110 111 Enabled: Boolean; … … 222 223 FDrawThread: TDrawThread; 223 224 FSystemThread: TSystemThread; 224 IntfImage: TLazIntfImage;225 225 ClearBackground: Boolean; 226 226 procedure InitDigMasks; … … 341 341 var 342 342 I: Integer; 343 begin 344 Clear; 345 Count := Config.GetValue(DOMString(Path + '/Count'), 0); 343 NewCount: Integer; 344 begin 345 NewCount := Config.GetValue(DOMString(Path + '/Count'), 0); 346 while Count > NewCount do Delete(Count - 1); 347 while Count < NewCount do Add(TPlayer.Create); 346 348 for I := 0 to Count - 1 do begin 347 349 Items[I] := TPlayer.Create; … … 1285 1287 Id := Source.Id; 1286 1288 Keys := Source.Keys; 1287 Color := Source.Color; 1289 Color1 := Source.Color1; 1290 Color2 := Source.Color2; 1288 1291 Energy := Source.Energy; 1289 1292 Shield := Source.Shield; … … 1298 1301 begin 1299 1302 with Config do begin 1300 Self.Name := string(GetValue(DOMString(Path + '/Name'), '')); 1301 Color := GetValue(DOMString(Path + '/Color'), 0); 1302 Enabled := GetValue(DOMString(Path + '/Enabled'), False); 1303 Keys.Left := GetValue(DOMString(Path + '/Keys/Left'), 0); 1304 Keys.Right := GetValue(DOMString(Path + '/Keys/Right'), 0); 1305 Keys.Down := GetValue(DOMString(Path + '/Keys/Down'), 0); 1306 Keys.Up := GetValue(DOMString(Path + '/Keys/Up'), 0); 1307 Keys.Shoot := GetValue(DOMString(Path + '/Keys/Shoot'), 0); 1303 Self.Name := string(GetValue(DOMString(Path + '/Name'), UnicodeString(Name))); 1304 Color1 := GetValue(DOMString(Path + '/Color1'), Color1); 1305 Color2 := GetValue(DOMString(Path + '/Color2'), Color2); 1306 Enabled := GetValue(DOMString(Path + '/Enabled'), Enabled); 1307 Keys.Left := GetValue(DOMString(Path + '/Keys/Left'), Keys.Left); 1308 Keys.Right := GetValue(DOMString(Path + '/Keys/Right'), Keys.Right); 1309 Keys.Down := GetValue(DOMString(Path + '/Keys/Down'), Keys.Down); 1310 Keys.Up := GetValue(DOMString(Path + '/Keys/Up'), Keys.Up); 1311 Keys.Shoot := GetValue(DOMString(Path + '/Keys/Shoot'), Keys.Shoot); 1308 1312 end; 1309 1313 InitTanks; … … 1314 1318 with Config do begin 1315 1319 SetValue(DOMString(Path + '/Name'), DOMString(Self.Name)); 1316 SetValue(DOMString(Path + '/Color'), Color); 1320 SetValue(DOMString(Path + '/Color1'), Color1); 1321 SetValue(DOMString(Path + '/Color2'), Color2); 1317 1322 SetValue(DOMString(Path + '/Enabled'), Enabled); 1318 1323 SetValue(DOMString(Path + '/Keys/Left'), Keys.Left); … … 1569 1574 Keys.Up := 87; 1570 1575 Keys.Shoot := 69; 1576 Color1 := $00ff00; 1577 Color2 := $00a000; 1571 1578 Enabled := True; 1572 1579 end; … … 1577 1584 Keys.Up := 38; 1578 1585 Keys.Shoot := 17; 1586 Color1 := $ff2c2c; 1587 Color2 := $b60000; 1579 1588 Enabled := True; 1580 1589 end; … … 1585 1594 Keys.Up := 80; 1586 1595 Keys.Shoot := 191; 1596 Color1 := $0000ff; 1597 Color2 := $0000a0; 1587 1598 end; 1588 1599 with PlayerPool.AddNew do begin … … 1592 1603 Keys.Up := 104; 1593 1604 Keys.Shoot := 105; 1605 Color1 := $ff2cff; 1606 Color2 := $b600b6; 1594 1607 end; 1595 1608 with PlayerPool.AddNew do begin … … 1599 1612 Keys.Up := 0; 1600 1613 Keys.Shoot := 0; 1614 Color1 := $ffff2c; 1615 Color2 := $b6b600; 1601 1616 end; 1602 1617 with PlayerPool.AddNew do begin … … 1606 1621 Keys.Up := 0; 1607 1622 Keys.Shoot := 0; 1623 Color1 := $2cffff; 1624 Color2 := $00b6b6; 1608 1625 end; 1609 1626 with PlayerPool.AddNew do begin … … 1613 1630 Keys.Up := 0; 1614 1631 Keys.Shoot := 0; 1632 Color1 := $008cff; 1633 Color2 := $002da0; 1615 1634 end; 1616 1635 with PlayerPool.AddNew do begin … … 1620 1639 Keys.Up := 0; 1621 1640 Keys.Shoot := 0; 1641 Color1 := $d0d0d0; 1642 Color2 := $707070; 1622 1643 end; 1623 1644 for I := 0 to PlayerPool.Count - 1 do … … 1644 1665 Players.Add(NewPlayer); 1645 1666 Score := 0; 1667 World.Matters[Integer(miPlayer1Home) + I * 4].Color := Color1; 1668 World.Matters[Integer(miPlayer1TankBody) + I * 4].Color := Color1; 1669 World.Matters[Integer(miPlayer1TankBody2) + I * 4].Color := Color2; 1646 1670 end; 1647 1671 end; … … 1701 1725 FBitmapLower := TBitmapTColor.Create; 1702 1726 FBitmapLock := TCriticalSection.Create; 1703 IntfImage := TLazIntfImage.Create(1, 1);1704 1727 PlayerPool := TPlayers.Create; 1705 1728 PlayerPool.Engine := Self; … … 1729 1752 FreeAndNil(FBitmapLower); 1730 1753 FreeAndNil(FBitmapLock); 1731 FreeAndNil(IntfImage);1732 1754 FreeAndNil(PlayerPool); 1733 1755 FreeAndNil(Players); … … 1765 1787 try 1766 1788 Lock.Acquire; 1767 if ClearBackground then FBitmapLower.FillAll(clNavy);1789 //if ClearBackground then FBitmapLower.FillAll(clNavy); 1768 1790 for I := 0 to Players.Count - 1 do begin 1769 1791 TPlayer(Players[I]).Paint;
Note:
See TracChangeset
for help on using the changeset viewer.