📄 frmeditor.frm
字号:
ScaleWidth = 555
TabIndex = 26
Top = 3840
Width = 615
End
Begin VB.PictureBox tile
Height = 615
Index = 20
Left = 720
Picture = "frmEditor.frx":3B664
ScaleHeight = 555
ScaleWidth = 555
TabIndex = 25
Top = 3240
Width = 615
End
Begin VB.PictureBox tile
Height = 615
Index = 21
Left = 120
Picture = "frmEditor.frx":3C966
ScaleHeight = 555
ScaleWidth = 555
TabIndex = 24
Top = 3840
Width = 615
End
Begin VB.PictureBox tile
Height = 615
Index = 19
Left = 120
Picture = "frmEditor.frx":3DC68
ScaleHeight = 555
ScaleWidth = 555
TabIndex = 23
Top = 3240
Width = 615
End
Begin VB.PictureBox tile
Height = 615
Index = 18
Left = 720
Picture = "frmEditor.frx":3EF6A
ScaleHeight = 555
ScaleWidth = 555
TabIndex = 22
Top = 2640
Width = 615
End
Begin VB.PictureBox tile
Height = 615
Index = 17
Left = 120
Picture = "frmEditor.frx":4026C
ScaleHeight = 555
ScaleWidth = 555
TabIndex = 20
Top = 2640
Width = 615
End
Begin VB.PictureBox tile
Height = 615
Index = 16
Left = 720
Picture = "frmEditor.frx":4156E
ScaleHeight = 555
ScaleWidth = 555
TabIndex = 21
Top = 2040
Width = 615
End
Begin VB.PictureBox tile
Height = 615
Index = 15
Left = 120
Picture = "frmEditor.frx":42870
ScaleHeight = 555
ScaleWidth = 555
TabIndex = 19
Top = 2040
Width = 615
End
Begin VB.PictureBox tile
Height = 615
Index = 14
Left = 720
Picture = "frmEditor.frx":43B72
ScaleHeight = 555
ScaleWidth = 555
TabIndex = 17
Top = 1440
Width = 615
End
Begin VB.PictureBox tile
Height = 615
Index = 13
Left = 120
Picture = "frmEditor.frx":44E74
ScaleHeight = 555
ScaleWidth = 555
TabIndex = 14
Top = 1440
Width = 615
End
Begin VB.PictureBox tile
Height = 615
Index = 12
Left = 720
Picture = "frmEditor.frx":46176
ScaleHeight = 555
ScaleWidth = 555
TabIndex = 15
Top = 840
Width = 615
End
Begin VB.PictureBox tile
Height = 615
Index = 11
Left = 120
Picture = "frmEditor.frx":47478
ScaleHeight = 555
ScaleWidth = 555
TabIndex = 12
Top = 840
Width = 615
End
Begin VB.PictureBox tile
Height = 615
Index = 29
Left = 1320
Picture = "frmEditor.frx":4877A
ScaleHeight = 555
ScaleWidth = 555
TabIndex = 18
Top = 240
Width = 615
End
Begin VB.PictureBox tile
Height = 615
Index = 10
Left = 720
Picture = "frmEditor.frx":49A7C
ScaleHeight = 555
ScaleWidth = 555
TabIndex = 16
Top = 240
Width = 615
End
Begin VB.PictureBox tile
Height = 615
Index = 9
Left = 120
Picture = "frmEditor.frx":4AD7E
ScaleHeight = 555
ScaleWidth = 555
TabIndex = 13
Top = 240
Width = 615
End
End
Begin VB.Image imgTile
Appearance = 0 'Flat
Height = 600
Index = 0
Left = 3000
Tag = "N"
Top = 0
Width = 600
End
End
Attribute VB_Name = "frmEditor"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub cmdLoad_Click()
mapnumber = InputBox("Enter the map number in X and Y coorinate form. E.G. 'x1y0' would be the map directly left of the first map.")
If mapnumber = "" Then Exit Sub
For t = 0 To 224
imgTile(t).Picture = picBlank.Picture
Next t
Open App.Path & "\" & mapnumber & ".map" For Input As #1
For t = 0 To 224
Input #1, texture, walk
If IsNumeric(texture) = True Then
imgTile(t).Picture = tile(texture).Picture
imgTile(t).Tag = texture
End If
Next t
Close #1
End Sub
Private Sub cmdRandom_Click()
Randomize
If tiletype.Text = "Grass" Then
If MsgBox("CAUTION: This will erase all work you have done so far on this map! Press OK to continue.", vbYesNo) = vbYes Then
For t = 0 To 224
t2 = Int(9 * Rnd)
imgTile(t).Picture = tile(t2).Picture
imgTile(t).Tag = tile(t2).Tag
Next t
End If
End If
If tiletype.Text = "Water" Then
If MsgBox("CAUTION: This will erase all work you have done so far on this map! Press OK to continue.", vbYesNo) = vbYes Then
For t = 0 To 224
imgTile(t).Picture = tile(34).Picture
imgTile(t).Tag = tile(34).Tag
Next t
End If
End If
End Sub
Private Sub cmdSave_Click()
mapnumber = InputBox("Enter the map number in X and Y coorinate form. E.G. 'x1y0' would be the map directly left of the first map.")
Open App.Path & "\" & mapnumber & ".map" For Output As #1
For t = 0 To 224
block = imgTile(t).Tag
If imgTile(t).Tag >= 51 Then
walk = 0
Else
walk = 1
End If
Print #1, block & "," & walk
Next t
Close #1
mademaps.Refresh
MsgBox "Map saved."
End Sub
Private Sub Form_DblClick()
End
End Sub
Private Sub Form_Load()
tiletype.AddItem "Grass"
tiletype.AddItem "Dirt"
tiletype.AddItem "Snow"
tiletype.AddItem "Water"
For t = 0 To 63
tile(t).Tag = t
Next t
mademaps.Path = App.Path
End Sub
Private Sub Form_Resize()
imgTile(0).Move frmEditor.ScaleWidth - imgTile(0).Width * 15, 0
For t = 1 To 15 * 15 - 1
Load imgTile(t)
imgTile(t).Visible = True
If t Mod 15 <> 0 Then
imgTile(t).Move imgTile(t - 1).Left + imgTile(t - 1).Width, imgTile(t - 1).Top
Else
imgTile(t).Move imgTile(0).Left, imgTile(t - 1).Top + imgTile(t - 1).Height
End If
Next t
For t = 0 To 15
Line (imgTile(t).Left, 0)-(imgTile(t).Left, frmEditor.ScaleHeight), QBColor(8)
Next t
For t = 0 To 225 Step 10
Line (imgTile(0).Left, imgTile(t).Top)-(frmEditor.ScaleWidth, imgTile(t).Top), QBColor(8)
Next t
End Sub
Private Sub imgTile_MouseDown(Index As Integer, Button As Integer, Shift As Integer, X As Single, Y As Single)
Randomize
imgTile(Index).Picture = selected.Picture
imgTile(Index).Tag = selected.Tag
If tiletype = "Grass" And chkRandom.Value = 1 Then
t = Int(9 * Rnd)
selected.Picture = tile(t).Picture
selected.Tag = tile(t).Tag
End If
End Sub
Private Sub mademaps_DblClick()
For t = 0 To 224
imgTile(t).Picture = picBlank.Picture
Next t
Open App.Path & "\" & mademaps.filename For Input As #1
For t = 0 To 224
Input #1, texture, walk
If IsNumeric(texture) = True Then
imgTile(t).Picture = tile(texture).Picture
imgTile(t).Tag = texture
End If
Next t
Close #1
End Sub
Private Sub tile_Click(Index As Integer)
selected.Picture = tile(Index).Picture
selected.Tag = tile(Index).Tag
End Sub
Private Sub tiletype_Click()
If tiletype.Text = "Grass" Then
frmGrass.Visible = True
frmDirt.Visible = False
frmSnow.Visible = False
frmWater.Visible = False
cmdRandom.Enabled = True
chkRandom.Enabled = True
cmdRandom.Caption = "Random"
End If
If tiletype.Text = "Dirt" Then
frmGrass.Visible = False
frmDirt.Visible = True
frmSnow.Visible = False
frmWater.Visible = False
cmdRandom.Enabled = False
chkRandom.Enabled = False
End If
If tiletype.Text = "Snow" Then
frmGrass.Visible = False
frmDirt.Visible = False
frmSnow.Visible = True
frmWater.Visible = False
cmdRandom.Enabled = False
chkRandom.Enabled = False
End If
If tiletype.Text = "Water" Then
frmGrass.Visible = False
frmDirt.Visible = False
frmSnow.Visible = False
frmWater.Visible = True
cmdRandom.Enabled = True
chkRandom.Enabled = False
cmdRandom.Caption = "Fill"
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -