examples: Games: improve i18n
This commit is contained in:
parent
af356974f4
commit
a030b6a0ba
11 changed files with 76 additions and 75 deletions
|
@ -16,3 +16,4 @@ Address=benoit@localhost
|
|||
License=General Public Licence
|
||||
Packager=1
|
||||
GambasVersion=3.7
|
||||
Translate=1
|
||||
|
|
|
@ -113,15 +113,15 @@ Public Sub Window_Draw()
|
|||
If (scroll = 320) Then speed = -2
|
||||
If (scroll = -960) Then speed = 2
|
||||
scrollb = scroll
|
||||
If (scrollb < - 640) Then scrollb = - 640
|
||||
If (scrollb < -640) Then scrollb = -640
|
||||
If (scrollb > 0) Then scrollb = 0
|
||||
If (scroll1 = - 640) Then scroll1 = 0
|
||||
If (scroll2 = - 640) Then scroll2 = 0
|
||||
If (scroll3 < - 640) Then scroll3 = scroll3 + 640
|
||||
If (scroll4 < - 640) Then scroll4 = scroll4 + 640
|
||||
If (scroll5 < - 640) Then scroll5 = scroll5 + 1280
|
||||
If (scroll5b < - 640) Then scroll5b = scroll5b + 1280
|
||||
If (scroll6 < - 640) Then scroll6 = scroll6 + 640
|
||||
If (scroll1 = -640) Then scroll1 = 0
|
||||
If (scroll2 = -640) Then scroll2 = 0
|
||||
If (scroll3 < -640) Then scroll3 = scroll3 + 640
|
||||
If (scroll4 < -640) Then scroll4 = scroll4 + 640
|
||||
If (scroll5 < -640) Then scroll5 = scroll5 + 1280
|
||||
If (scroll5b < -640) Then scroll5b = scroll5b + 1280
|
||||
If (scroll6 < -640) Then scroll6 = scroll6 + 640
|
||||
|
||||
#If False
|
||||
|
||||
|
@ -187,11 +187,11 @@ PRINT_TEXT:
|
|||
|
||||
Y = 10
|
||||
Draw.Font.Size = Font.DefaultHeight * 2
|
||||
Y = DrawText($hWindow.Framerate & " FPS", 10, Y)
|
||||
Y = DrawText($hWindow.Framerate & " " & "FPS", 10, Y)
|
||||
Draw.Font.Size = Font.DefaultHeight
|
||||
Y = DrawText("[F1] Toggle fullscreen", 10, Y)
|
||||
Y = DrawText("[F5] Take screenshot to ~/BeastScroll.png", 10, Y)
|
||||
Y = DrawText("[ESC] Quit", 10, Y)
|
||||
Y = DrawText("[F1] " & ("Toggle fullscreen"), 10, Y)
|
||||
Y = DrawText("[F5] " & ("Take screenshot to ~/BeastScroll.png"), 10, Y)
|
||||
Y = DrawText("[ESC] " & ("Quit"), 10, Y)
|
||||
|
||||
End
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@ Public Sub Form_Open()
|
|||
Me.Center
|
||||
|
||||
lblInfo.Text =
|
||||
"<u><font size=\"6\"><b>DeepSpace " & Application.Version & "</b></font></u><br>"
|
||||
("<u><font size=\"6\"><b>DeepSpace ") & Application.Version & ("</b></font></u><br>"
|
||||
"A vector engine written in Gambas.<br><br>Contact <font color=\"#0000FF\">subjugator@gmail.com</font> with questions.<br>"
|
||||
"Copyright (C) 2004, Michael Isaac. All rights reserved."
|
||||
"Copyright (C) 2004, Michael Isaac. All rights reserved.")
|
||||
End
|
||||
|
|
|
@ -325,9 +325,9 @@ Public Sub MainLoop()
|
|||
Draw.Foreground = Color.Red
|
||||
|
||||
Draw.Font.Bold = True
|
||||
Draw.Text("Object Count: " & Obj.Count, 1, 0)
|
||||
Draw.Text("Bullet Count: " & Bullet.Count, 1, Draw.Font.Height * 1)
|
||||
Draw.Text("FPS : " & FPS_COUNT, 1, Draw.Font.Height * 2)
|
||||
Draw.Text(("Object Count:") & " " & Obj.Count, 1, 0)
|
||||
Draw.Text(("Bullet Count:") & " " & Bullet.Count, 1, Draw.Font.Height * 1)
|
||||
Draw.Text(("FPS") & " : " & FPS_COUNT, 1, Draw.Font.Height * 2)
|
||||
|
||||
Draw.End()
|
||||
End
|
||||
|
|
|
@ -39,7 +39,7 @@ Public Sub Form_Open()
|
|||
|
||||
For iInd = 1 To GameBoard.NUM_LEVELS
|
||||
hMenu = New Menu(mnuLevel) As "mnuLevel"
|
||||
hMenu.Text = Subst("Level &1", iInd)
|
||||
hMenu.Text = Subst(("Level &1"), iInd)
|
||||
hMenu.Tag = iInd
|
||||
Next
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
# Gambas Form File 3.0
|
||||
|
||||
{ Form Form
|
||||
MoveScaled(0,0,42,16)
|
||||
MoveScaled(0,0,99,83)
|
||||
Icon = Picture["icon.png"]
|
||||
Resizable = False
|
||||
{ MnuGame Menu
|
||||
|
|
|
@ -69,7 +69,7 @@ End
|
|||
|
||||
Public Sub Slider1_Change()
|
||||
|
||||
lblDelay.Caption = ("Evolution Delay: ") & Str(slider1.Value) & "ms"
|
||||
lblDelay.Caption = ("Evolution Delay: ") & Str(slider1.Value) & ("ms")
|
||||
tmrEvolution.Delay = slider1.Value
|
||||
|
||||
End
|
||||
|
|
|
@ -9,12 +9,12 @@
|
|||
MoveScaled(1,1,29,23)
|
||||
Border = Border.Plain
|
||||
{ Label3 Label
|
||||
MoveScaled(1,1,16,4)
|
||||
MoveScaled(1,1,19,4)
|
||||
Font = Font["Bold,+2"]
|
||||
Text = ("GameOfLife")
|
||||
}
|
||||
{ Label7 Label
|
||||
MoveScaled(1,4,18,4)
|
||||
MoveScaled(1,4,19,4)
|
||||
Text = ("The Game of Life")
|
||||
Alignment = Align.Left
|
||||
}
|
||||
|
@ -55,7 +55,7 @@
|
|||
Text = ("Start Evolution")
|
||||
}
|
||||
{ lblDelay TextLabel
|
||||
MoveScaled(1,40,25,4)
|
||||
MoveScaled(1,39,29,6)
|
||||
Text = ("Evolution Delay: 20ms")
|
||||
}
|
||||
{ TabStrip1 TabStrip
|
||||
|
@ -64,54 +64,54 @@
|
|||
Index = 0
|
||||
Text = ("Survival")
|
||||
{ chkEight CheckBox
|
||||
MoveScaled(2,36,20,3)
|
||||
MoveScaled(2,36,25,3)
|
||||
Text = ("8 Neighbours")
|
||||
Tristate = True
|
||||
Value = CheckBox.True
|
||||
}
|
||||
{ chkSeven CheckBox
|
||||
MoveScaled(2,33,20,3)
|
||||
MoveScaled(2,33,25,3)
|
||||
Text = ("7 Neighbours")
|
||||
Tristate = True
|
||||
Value = CheckBox.True
|
||||
}
|
||||
{ chkSix CheckBox
|
||||
MoveScaled(2,30,20,3)
|
||||
MoveScaled(2,30,25,3)
|
||||
Text = ("6 Neighbours")
|
||||
Tristate = True
|
||||
Value = CheckBox.True
|
||||
}
|
||||
{ chkFive CheckBox
|
||||
MoveScaled(2,27,20,3)
|
||||
MoveScaled(2,27,25,3)
|
||||
Text = ("5 Neighbours")
|
||||
Tristate = True
|
||||
Value = CheckBox.True
|
||||
}
|
||||
{ chkFour CheckBox
|
||||
MoveScaled(2,24,20,3)
|
||||
MoveScaled(2,24,25,3)
|
||||
Text = ("4 Neighbours")
|
||||
Tristate = True
|
||||
Value = CheckBox.True
|
||||
}
|
||||
{ chkThree CheckBox
|
||||
MoveScaled(2,21,20,3)
|
||||
MoveScaled(2,21,25,3)
|
||||
Text = ("3 Neighbours")
|
||||
Tristate = True
|
||||
}
|
||||
{ chkTwo CheckBox
|
||||
MoveScaled(2,18,20,3)
|
||||
MoveScaled(2,18,25,3)
|
||||
Text = ("2 Neighbours")
|
||||
Tristate = True
|
||||
Value = CheckBox.None
|
||||
}
|
||||
{ chkOne CheckBox
|
||||
MoveScaled(2,15,20,3)
|
||||
MoveScaled(2,15,25,3)
|
||||
Text = ("1 Neighbour")
|
||||
Tristate = True
|
||||
Value = CheckBox.True
|
||||
}
|
||||
{ chkZero CheckBox
|
||||
MoveScaled(2,12,20,3)
|
||||
MoveScaled(2,12,25,3)
|
||||
Text = ("0 Neighbour")
|
||||
Tristate = True
|
||||
Value = CheckBox.True
|
||||
|
@ -142,19 +142,19 @@
|
|||
Alignment = Align.Right
|
||||
}
|
||||
{ chkBorder CheckBox
|
||||
MoveScaled(1,36,24,4)
|
||||
MoveScaled(1,36,26,4)
|
||||
Text = ("Draw cell borders")
|
||||
}
|
||||
{ chkSmall CheckBox
|
||||
MoveScaled(1,24,24,4)
|
||||
MoveScaled(1,24,26,4)
|
||||
Text = ("Small generation")
|
||||
}
|
||||
{ chkSymetryV CheckBox
|
||||
MoveScaled(1,32,24,4)
|
||||
MoveScaled(1,32,26,4)
|
||||
Text = ("Vertical symmetry")
|
||||
}
|
||||
{ chkSymetryH CheckBox
|
||||
MoveScaled(1,28,24,4)
|
||||
MoveScaled(1,28,26,4)
|
||||
Text = ("Horizontal symmetry")
|
||||
}
|
||||
Index = 0
|
||||
|
|
|
@ -43,7 +43,7 @@ Public Sub Form_Open()
|
|||
UpdateScoreBoard
|
||||
Play("start.wav")
|
||||
|
||||
Me.Text = "Snake v1.0"
|
||||
Me.Text = ("Snake") & " v1.0"
|
||||
hPictHead = Picture.Load("head.png")
|
||||
' ME.Icon = hPictHead 'The same as head icon but in a standard size
|
||||
|
||||
|
@ -58,7 +58,7 @@ Public Sub Form_Open()
|
|||
Draw.text(("Snake"), (dwg.clientW - Draw.TextWidth("Snake")) / 2 - i, (dwg.Height + Draw.TextHeight("Snake")) / 2 - i - 50)
|
||||
Next
|
||||
Draw.Font.Size = 18
|
||||
Draw.Text("ver 1.0 by: Ahmad Kamal", (dwg.clientW - Draw.TextWidth("ver 1.0 by: Ahmad Kamal")) / 2, 100)
|
||||
Draw.Text(("ver 1.0 by: Ahmad Kamal"), (dwg.clientW - Draw.TextWidth(("ver 1.0 by: Ahmad Kamal"))) / 2, 100)
|
||||
Draw.End
|
||||
|
||||
hPictHead = Picture.Load("head.png") 'Load images
|
||||
|
@ -118,7 +118,7 @@ Public Sub TmrEngine_Timer()
|
|||
hPictHeadRotated = hPictHead.Image.Rotate(Pi / 2).Picture
|
||||
Case "down"
|
||||
Ypos[0] = Ypos[0] + 20
|
||||
hPictHeadRotated = hPictHead.Image.Rotate(- Pi / 2).Picture
|
||||
hPictHeadRotated = hPictHead.Image.Rotate(-Pi / 2).Picture
|
||||
End Select
|
||||
|
||||
|
||||
|
@ -265,14 +265,14 @@ End
|
|||
|
||||
Public Sub MenuPause_Click()
|
||||
|
||||
If (MenuPause.Caption = "&Pause" And (TmrEngine.Enabled = True)) Then
|
||||
If (MenuPause.Caption = ("&Pause") And (TmrEngine.Enabled = True)) Then
|
||||
TmrEngine.Enabled = False
|
||||
TimerApple.Enabled = False
|
||||
MenuPause.Caption = "Un&Pause"
|
||||
Else If (MenuPause.Caption = "Un&Pause" And (TmrEngine.Enabled = False)) Then
|
||||
MenuPause.Caption = ("Un&Pause")
|
||||
Else If (MenuPause.Caption = ("Un&Pause") And (TmrEngine.Enabled = False)) Then
|
||||
TmrEngine.Enabled = True
|
||||
TimerApple.Enabled = True
|
||||
MenuPause.Caption = "&Pause"
|
||||
MenuPause.Caption = ("&Pause")
|
||||
End If
|
||||
|
||||
End
|
||||
|
@ -287,7 +287,7 @@ Public Sub MenuGrandMa_Click()
|
|||
|
||||
TmrEngine.delay = 200
|
||||
TimerApple.delay = 8000
|
||||
Speed = "GrandMa"
|
||||
Speed = ("GrandMa")
|
||||
|
||||
End
|
||||
|
||||
|
@ -296,7 +296,7 @@ Public Sub MenuCool_Click()
|
|||
|
||||
TmrEngine.delay = 150
|
||||
TimerApple.delay = 5000
|
||||
Speed = "Cool"
|
||||
Speed = ("Cool")
|
||||
|
||||
End
|
||||
|
||||
|
@ -305,7 +305,7 @@ Public Sub MenuSpeedFreak_Click()
|
|||
|
||||
TmrEngine.delay = 100
|
||||
TimerApple.delay = 2500
|
||||
Speed = "Speed Freak"
|
||||
Speed = ("Speed Freak")
|
||||
|
||||
End
|
||||
|
||||
|
@ -363,8 +363,8 @@ End
|
|||
Public Sub UpdateSpeed()
|
||||
|
||||
If MenuAutoAdvanceSpeed.checked Then
|
||||
If (Score > 19 And Speed = "GrandMa") Then MenuCool_Click
|
||||
If (Score > 79 And Speed = "Cool") Then MenuSpeedFreak_Click 'Let's kill ur snake :)
|
||||
If (Score > 19 And Speed = ("GrandMa")) Then MenuCool_Click
|
||||
If (Score > 79 And Speed = ("Cool")) Then MenuSpeedFreak_Click 'Let's kill ur snake :)
|
||||
End If
|
||||
|
||||
End
|
||||
|
@ -402,7 +402,7 @@ Public Sub MenuAbout_Click()
|
|||
|
||||
Dim About As String
|
||||
|
||||
About = "Snake v1.0\nBy: Ahmad Kamal <eng_ak@Link.Net>\nWritten for Gambas http://gambas.sf.net"
|
||||
About = ("Snake v1.0\nBy: Ahmad Kamal <eng_ak@Link.Net>\nWritten for Gambas http://gambas.sf.net")
|
||||
Message(About)
|
||||
|
||||
End
|
||||
|
|
|
@ -1,27 +1,27 @@
|
|||
' Gambas class file
|
||||
|
||||
PUBLIC SUB cmdCancel_Click()
|
||||
Public Sub cmdCancel_Click()
|
||||
|
||||
FBoardSelect.Close
|
||||
|
||||
END
|
||||
End
|
||||
|
||||
PUBLIC SUB Form_Show()
|
||||
Public Sub Form_Show()
|
||||
|
||||
DIM i AS Byte
|
||||
Dim i As Byte
|
||||
|
||||
' Fill in the combo box text section
|
||||
cboLayout.Text = Global.boarddesign[Global.selectedlayout].Name
|
||||
|
||||
' Fill in the combo box dropdown section
|
||||
FOR i = 0 TO Global.boarddesign.Count - 1
|
||||
For i = 0 To Global.boarddesign.Count - 1
|
||||
cboLayout.Add(Global.boarddesign[i].Name)
|
||||
NEXT
|
||||
Next
|
||||
|
||||
END
|
||||
End
|
||||
|
||||
|
||||
PUBLIC SUB cmdOK_Click()
|
||||
Public Sub cmdOK_Click()
|
||||
|
||||
' Set board layout index
|
||||
Global.selectedlayout = cboLayout.Index
|
||||
|
@ -32,4 +32,4 @@ PUBLIC SUB cmdOK_Click()
|
|||
' Close this window
|
||||
FBoardSelect.Close
|
||||
|
||||
END
|
||||
End
|
||||
|
|
|
@ -1,30 +1,30 @@
|
|||
' Gambas module file
|
||||
|
||||
PUBLIC SUB make_boards()
|
||||
Public Sub make_boards()
|
||||
|
||||
DIM i AS Byte
|
||||
DIM j AS Byte
|
||||
Dim i As Byte
|
||||
Dim j As Byte
|
||||
|
||||
' Create the board design objects
|
||||
|
||||
Global.boarddesign.Resize(2)
|
||||
|
||||
FOR i = 0 TO Global.boarddesign.Count - 1
|
||||
Global.boarddesign[i] = NEW CBoardDesign
|
||||
FOR j = 1 TO 7
|
||||
For i = 0 To Global.boarddesign.Count - 1
|
||||
Global.boarddesign[i] = New CBoardDesign
|
||||
For j = 1 To 7
|
||||
Global.boarddesign[i].Row.Add(0)
|
||||
Global.boarddesign[i].Placed.Add(0)
|
||||
NEXT
|
||||
NEXT
|
||||
Next
|
||||
Next
|
||||
|
||||
END
|
||||
End
|
||||
|
||||
PUBLIC SUB fill_boards()
|
||||
Public Sub fill_boards()
|
||||
|
||||
' Fill the board design Array
|
||||
|
||||
WITH Global.boarddesign[0]
|
||||
.Name = "Original"
|
||||
With Global.boarddesign[0]
|
||||
.Name = ("Original")
|
||||
|
||||
.Row[0] = 28
|
||||
.Row[1] = 28
|
||||
|
@ -43,10 +43,10 @@ PUBLIC SUB fill_boards()
|
|||
.Placed[6] = 28
|
||||
|
||||
.Finish = 28
|
||||
END WITH
|
||||
End With
|
||||
|
||||
WITH Global.boarddesign[1]
|
||||
.Name = "Plus"
|
||||
With Global.boarddesign[1]
|
||||
.Name = ("Plus")
|
||||
|
||||
.Row[0] = 28
|
||||
.Row[1] = 28
|
||||
|
@ -65,5 +65,5 @@ PUBLIC SUB fill_boards()
|
|||
.Placed[6] = 0
|
||||
|
||||
.Finish = 28
|
||||
END WITH
|
||||
END
|
||||
End With
|
||||
End
|
||||
|
|
Loading…
Reference in a new issue