Private i As Integer Private o As Integer Private u As Integer Private OdLeva As Integer Private OdHora As Integer Private LzeRotovat As Boolean Private Okr As Okraj Private Hra As Boolean Private Indx As Integer Private IndxDalsi As Integer Private Pauza As Boolean Private Rada As Boolean Private Skore As Integer Private PRad As Integer Private Rychlost As Integer Private Matice() As String Private Jaky As Integer Private Sub Dolu_Timer() PresunDolu End Sub Private Sub Fil_KeyDown(KeyCode As Integer, Shift As Integer) Prikazy Chr(KeyCode) End Sub Private Sub Form_Load() Randomize Timer For o = 1 To 25 P(o).Picture = Poz.Picture Next LB1.Caption = "Opravdu si přejete" + Chr(13) + "tuto hru ukončit?" a_Iniciace MouseIcon = Menu.MouseIcon Prekresli End Sub ' Private Sub Prekresli() For i = 1 To 264 If P(i).Tag = "0" Then P(i).Picture = Poz.Picture Next End Sub ' ' Private Sub NactiNahodnyObjekt() With Edit.Tvar If Indx = -1 Then .ListIndex = Int(Rnd * (.ListCount)): IndxDalsi = .ListIndex Else _ .ListIndex = IndxDalsi End With If Edit.Za.Value = 1 Then LzeRotovat = False Else LzeRotovat = True NactiOkraj OdLeva = 4 OdHora = -Okr.Horni + 2 UkazTvar With Edit.Tvar Indx = IndxDalsi IndxDalsi = Int(Rnd * (.ListCount)) .ListIndex = IndxDalsi UkazDalsi .ListIndex = Indx End With End Sub ' ' Private Sub UkazTvar() Prekresli With Edit For i = 1 To 5 For o = 1 To 5 If .i((i - 1) * 5 + o).Picture = .Bar.Picture Then '1 P((OdHora - 2 + i) * 12 + OdLeva + o - 1).Picture = Bar.Picture End If Next Next End With End Sub ' ' Private Sub NactiOkraj() Edit.a_NactiOkraj Okr.Dolni = Edit.s Okr.Horni = Edit.H Okr.Levy = Edit.L Okr.Pravy = Edit.P End Sub ' ' Private Sub PresunDoleva() If Pauza = True Then Exit Sub If Okr.Levy = -OdLeva + 2 Then Exit Sub 'Kontrola kolize For i = Okr.Levy To Okr.Pravy For o = i To 25 Step 5 u = (o \ 5) + 1: If o Mod 5 = 0 Then u = u - 1 If Edit.i(o).Picture = Edit.Bar.Picture Then _ If P((u - 2 + OdHora) * 12 + OdLeva + i - 2).Tag = "1" Then Exit Sub Next Next ' OdLeva = OdLeva - 1 UkazTvar End Sub ' ' Private Sub PresunDoprava() If Pauza = True Then Exit Sub If Okr.Pravy = 13 - OdLeva Then Exit Sub 'Kontrola kolize For i = Okr.Pravy To Okr.Levy Step -1 For o = i To 25 Step 5 u = (o \ 5) + 1: If o Mod 5 = 0 Then u = u - 1 a = (u - 2 + OdHora) * 12 + OdLeva + i If Edit.i(o).Picture = Edit.Bar.Picture Then _ If P((u - 2 + OdHora) * 12 + OdLeva + i).Tag = "1" Then Exit Sub Next Next ' OdLeva = OdLeva + 1 UkazTvar End Sub ' ' Private Sub Rotuj(Smer As Integer) If Pauza = True Then Exit Sub If LzeRotovat = False Then Exit Sub Edit.RotujTvar Smer NactiOkraj If Okr.Levy < -OdLeva + 2 Then OdLeva = 2 - Okr.Levy If Okr.Pravy > 13 - OdLeva Then OdLeva = 13 - Okr.Pravy If OdHora < -Okr.Horni + 2 Then OdHora = -Okr.Horni + 2 UkazTvar End Sub ' ' Private Sub PresunDolu() If Pauza = True Then Exit Sub If OdHora = 23 - Okr.Dolni Then Ukotvi: Exit Sub 'Kontrola dosednutí For i = Okr.Dolni To Okr.Horni Step -1 For o = (i - 1) * 5 + 1 To (Okr.Dolni - 1) * 5 + 5 u = o Mod 5: If u = 0 Then u = 5 If Edit.i(o).Picture = Edit.Bar.Picture Then _ If P((OdHora + i - 1) * 12 + OdLeva + u - 1).Tag = "1" Then Ukotvi: Exit Sub Next Next ' OdHora = OdHora + 1 UkazTvar End Sub ' Private Sub Ukotvi() Dolu.Enabled = False With Edit For i = 1 To 5 For o = 1 To 5 If .i((i - 1) * 5 + o).Picture = .Bar.Picture Then P((OdHora - 2 + i) * 12 + OdLeva + o - 1).Picture = Bar2.Picture P((OdHora - 2 + i) * 12 + OdLeva + o - 1).Tag = "1" End If Next Next End With Skore = Skore + 10 'Kontrola řad u = 0 StZn: For o = 21 To 0 Step -1 Rada = True For i = o * 12 + 1 To o * 12 + 11 If P(i).Tag = "0" Then Rada = False: Exit For Next If Rada = True Then PosunDolu o: u = u + 1: GoTo StZn Next PRad = PRad + u If u <> 0 Then Skore = Skore + u * (100) + 5 ^ (u - 1) - 1 'Konec? For i = 1 To 12 If P(i).Tag = "1" Then KonecHry: Exit Sub Next ' If PRad Mod 10 = 20 And Rychlost < 9 Then 'Další úroveň Rychlost = Rychlost + 1 u = 0 For i = 1 To 264 If P(i).Tag = "1" Then u = u + 1 Next Skore = Skore + u * 3 NastavUroven End If Rad.Caption = PRad Skor.Caption = Skore NactiNahodnyObjekt Dolu.Enabled = True End Sub ' ' Public Sub NastavHru() Rychlost = Menu.Uroven NastavUroven For i = 1 To 264 If i <= 25 Then w(i).Picture = Poz.Picture P(i).Picture = Poz.Picture Next Edit.Ignoruj = True Edit.Schema.ListIndex = Menu.Schema.ListIndex Skore = 0 Skor.Caption = Skore PRad = 0 Rad.Caption = PRad With Menu.Stroj ReDim Matice(.Count - 1) For o = 0 To .Count - 1 Matice(o) = Menu.Stroj(o).Caption Next End With Stisk.Caption = "Stiskněte " & Menu.Klavesy(10).Caption If Menu.Klavesy(10).Caption = "< Prázdné >" Then Stisk.Caption = "Stiskněte " & Menu.Klavesy(11).Caption LL_MouseMove -1, 0, 0, 0, 0 Opak.Interval = Menu.Cit * 20 Show , Menu GM.Move (Width - GM.Width) \ 2, (Height - GM.Height) \ 2 End Sub ' ' Public Sub Start() If Stisk.Tag = "P" Then Exit Sub If Pauza = True Then HraPauza: Exit Sub If Hra = True Then Exit Sub Stisk.Caption = "" Indx = -1 Hra = True Pauza = False NactiNahodnyObjekt Dolu.Enabled = True End Sub ' ' Private Sub Ukonce() If Hra = False Or Stisk.Tag = "P" Then Kn.Visible = False Hra = False Pauza = False Dolu.Enabled = False Edit.Ignoruj = False S9.Visible = True Nejl.Nacti Menu.Schema.Text, Skore, PRad Unload Me Exit Sub End If Dolu.Enabled = False If Pauza = True Then Tag = "P" Pauza = True Kn.Move 3358, 3960 S9.Visible = False Kn.Visible = True End Sub ' ' Private Sub ZrusKonec() If Tag <> "P" Then Pauza = False Dolu.Enabled = True End If Kn.Visible = False S9.Visible = True End Sub ' ' Private Sub KonecHry() Kn.Visible = False Hra = False Pauza = False Dolu.Enabled = False Edit.Ignoruj = False S9.Visible = True Rad.Caption = PRad Skor.Caption = Skore Stisk.Caption = "Stiskněte (" & Menu.Klavesy(15).Caption & ")" If Menu.Klavesy(15).Caption = "< Prázdné >" Then Stisk.Caption = "Stiskněte (" & Menu.Klavesy(14).Caption & ")" Stisk.Tag = "P" End Sub ' ' Private Sub HraPauza() If Pauza = True Then Pauza = False Else Pauza = True If Pauza = False Then Dolu.Enabled = True Else Dolu.Enabled = False If Pauza = True Then Stisk.Caption = "Pauza (" & Menu.Klavesy(12).Caption & ")" If Menu.Klavesy(12).Caption = "< Prázdné >" Then Stisk.Caption = "Pauza (" & Menu.Klavesy(13).Caption & ")" End If If Pauza = False Then Stisk.Caption = "" End Sub ' ' ' Private Sub PosunDolu(X As Integer) For o = X To 1 Step -1 Rada = True For i = o * 12 + 1 To o * 12 + 11 P(i).Tag = P(i - 12).Tag P(i).Picture = P(i - 12).Picture Next Next End Sub ' Private Sub UkazDalsi() With Edit For o = 1 To 25 If .i(o).Picture = .Bar.Picture Then w(o).Picture = Bar.Picture Else w(o).Picture = Poz.Picture Next End With End Sub ' ' Private Sub NastavUroven() Dolu.Interval = 500 - (Rychlost * 55) Urvn.Caption = Rychlost End Sub ' ' ' Private Sub Prikazy(R As String) Select Case R Case Matice(0), Matice(1): PresunDoleva Case Matice(2), Matice(3): PresunDoprava Case Matice(4), Matice(5): PresunDolu Case Matice(6), Matice(7): Rotuj 1 Case Matice(8), Matice(9): Rotuj 0 Case Matice(10), Matice(11): Start Case Matice(12), Matice(13): HraPauza Case Matice(14), Matice(15): Ukonce End Select End Sub Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single) LL_MouseMove -1, 0, 0, 0, 0 End Sub Private Sub GM_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single) LL_MouseMove -1, 0, 0, 0, 0 End Sub Private Sub Kn_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single) LL_MouseMove -1, 0, 0, 0, 0 End Sub Private Sub LL_Click(Index As Integer) Select Case Index Case 5: Menu.ZvukClick: KonecHry Case 6: Menu.ZvukClick: ZrusKonec End Select End Sub Private Sub LL_MouseMove(Index As Integer, Button As Integer, Shift As Integer, X As Single, Y As Single) If Index = Jaky Then Exit Sub For i = 0 To LL.Count - 1 If LL(i).Tag = "" Then LL(i).ForeColor = &H808000 Next If Index <> -1 Then LL(Index).ForeColor = &HC0C000 Jaky = Index Select Case Index Case -1: Opak.Enabled = False Case 0: Opak.Tag = "L": Opak.Enabled = True Case 1: Opak.Tag = "P": Opak.Enabled = True Case 2: Opak.Tag = "D": Opak.Enabled = True Case 3: Opak.Tag = "+": Opak.Enabled = True Case 4: Opak.Tag = "-": Opak.Enabled = True Case 5 To 6: Menu.ZvukOver End Select End Sub Private Sub Opak_Timer() If Hra = False Then Exit Sub Select Case Opak.Tag Case "L": PresunDoleva Case "P": PresunDoprava Case "D": PresunDolu Case "++++": Opak.Tag = "+": Exit Sub Case "----": Opak.Tag = "-": Exit Sub Case "+++": Opak.Tag = "++++": Exit Sub Case "---": Opak.Tag = "----": Exit Sub Case "++": Opak.Tag = "+++": Exit Sub Case "--": Opak.Tag = "---": Exit Sub Case "+": Opak.Tag = "++": Rotuj 1 Case "-": Opak.Tag = "--": Rotuj 0 End Select End Sub Private Sub w_MouseMove(Index As Integer, Button As Integer, Shift As Integer, X As Single, Y As Single) LL_MouseMove -1, 0, 0, 0, 0 End Sub Private Sub P_MouseMove(Index As Integer, Button As Integer, Shift As Integer, X As Single, Y As Single) LL_MouseMove -1, 0, 0, 0, 0 End Sub Private I As Integer Private o As Integer Private SM(0 To 1) As String * 50 Private Ret As String ' Public Type Okraj Pravy As Integer Levy As Integer Horni As Integer Dolni As Integer End Type ' Private Ok As Okraj Public Sub a_Iniciace() SM(0) = "05101520250409141924030813182302071217220106111621" SM(1) = "21161106012217120702231813080324191409042520151005" End Sub 'Rotace matice 5x5 Public Function a_Funkce_Rotuj(Retezec As String, Smer As Integer) As String Ret = "" For I = 1 To 25 Ret = Ret & Mid(Retezec, Val(Mid(SM(Smer), I * 2 - 1, 2)), 1) Next a_Funkce_Rotuj = Ret End Function 'ZjiÜtýnÝ okraj¨ objektu Public Function a_NactiOkraje(Retezec As String) As Okraj Ok.Dolni = 0: Ok.Horni = 0: Ok.Levy = 0: Ok.Pravy = 0 For o = 1 To 5 For I = o To 25 Step 5 'Pravy & Levy If Mid(Retezec, I, 1) = "1" Then If Ok.Levy = 0 Then Ok.Levy = o If o > Ok.Pravy Then Ok.Pravy = o End If Next For I = ((o - 1) * 5) + 1 To ((o - 1) * 5) + 5 ' Horni & Dolni If Mid(Retezec, I, 1) = "1" Then If Ok.Horni = 0 Then Ok.Horni = o If o > Ok.Dolni Then Ok.Dolni = o End If Next Next a_NactiOkraje = Ok End Function Private Jaky As Integer Private i As Integer Private Smer As Integer Public Uroven As Integer Private Zvuk As Boolean Private ZvukError As Boolean Private Radek As Integer Private EditKlavesa As Boolean Private Strng As String Public Cit As Integer Private Sub Fil_KeyDown(KeyCode As Integer, Shift As Integer) If EditKlavesa = True Then Select Case KeyCode Case 1: Strng = " " Case 65 To 90: Strng = Chr(KeyCode) Case 8: Strng = "Backspace" Case 9: Strng = "Tabelátor" Case 13: Strng = "Enter" Case 19: Strng = "Pause" Case 20: Strng = "Caps Lock" Case 27: Strng = "Escape" Case 32: Strng = "Mezerník" Case 33: Strng = "Page Up" Case 34: Strng = "Page Down" Case 35: Strng = "End" Case 36: Strng = "Home" Case 37: Strng = "Šipka doleva" Case 38: Strng = "Šipka nahoru" Case 39: Strng = "Šipka doprava" Case 40: Strng = "Šipka dolů" Case 45: Strng = "Insert" Case 46: Strng = "Delete" Case 48 To 57: Strng = KeyCode - 48 Case 93: Strng = "Tl. myši" Case 96 To 105: Strng = "Číslice " & KeyCode - 96 Case 106: Strng = "Operátor *" Case 107: Strng = "Operátor +" Case 109: Strng = "Operátor -" Case 110: Strng = "Delete" Case 111: Strng = "Operátor /" Case 112 To 123: Strng = "F" & KeyCode - 111 Case 144: Strng = "Num Lock" Case 145: Strng = "Scroll Lock" Case 186: Strng = "!" Case 187: Strng = "Operátor =" Case 188: Strng = "<" Case 189: Strng = "-" Case 190: Strng = ">" Case 191: Strng = "Operátor ˇ" Case 192: Strng = ";" Case 219: Strng = "[" Case 220: Strng = "Operátor \" Case 221: Strng = "]" Case 222: Strng = Chr(34) End Select Klavesy(Radek).Caption = Strng If KeyCode = 1 Then Exit Sub Stroj(Radek).Caption = Chr(KeyCode): Strng = "" If Smer <> 22 Then Otestuj: UlozKlavesy EditKlavesa = False End If End Sub Private Sub Form_Load() Load Edit Radek = -1 'Nastavení kláves - #řádku NactiKlavesy With Edit For i = 0 To .Schema.ListCount - 1 .Schema.ListIndex = i Schema.AddItem .Schema.Text Next End With Jaky = -1 Open App.Path + "\Config.cg" For Input As #1 Input #1, Zvuk, i, Uroven, Cit Close #1 Schema.Tag = i - 1 PrepniSchema L_Click 5 + Uroven If Zvuk = True Then NastavZvk 26 Else NastavZvk 27 L_Click Cit + 28 NactiZvuk Rekl.Caption = "Naprogramoval: Jan Dvořák" & Chr(13) & _ "E - mail: dvorkaman@centrum.cz" Show Menu1.Move (Width - Menu1.Width) \ 2, (Height - Menu1.Height) \ 2 + Screen.TwipsPerPixelY * 10 Ln1.X2 = Width: Ln2.X2 = Width Ln1.Y1 = Menu1.Top + Screen.TwipsPerPixelY * 50 Ln1.Y2 = Ln1.Y1 Ln2.Y1 = Menu1.Top + Menu1.Height - Screen.TwipsPerPixelY * 50 Ln2.Y2 = Ln2.Y1 Rekl.Move 0, Height - Screen.TwipsPerPixelY * 10 - Rekl.Height End Sub Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single) L_MouseMove -1, 0, 0, 0, 0 End Sub Private Sub Jmeno_MouseMove(Index As Integer, Button As Integer, Shift As Integer, X As Single, Y As Single) If Radek = Index Then Exit Sub Radek = Index L_MouseMove -1, 0, 0, 0, 0 ZvukOver If Index <= 9 Then OS.Top = Jmeno(Index).Top L(18).Top = Jmeno(Index).Top L(19).Top = Jmeno(Index).Top Exit Sub End If L(20).Top = Jmeno(Index).Top L(21).Top = Jmeno(Index).Top Os2.Top = Jmeno(Index).Top End Sub Private Sub Klavesy_MouseMove(Index As Integer, Button As Integer, Shift As Integer, X As Single, Y As Single) Jmeno_MouseMove Index, 0, 0, 0, 0 End Sub Private Sub Knc_Timer() If Knc.Tag = "A" Then If Ln1.X1 > Menu1.Left Then Knc.Tag = "B" Knc.Interval = 1000 Exit Sub End If Ln1.X1 = Ln1.X1 + Width \ 80 Ln1.X2 = Ln1.X2 - Width \ 80 Ln2.X1 = Ln1.X1 Ln2.X2 = Ln1.X2 End If If Knc.Tag = "B" Then Ln1.Visible = False: Ln2.Visible = False Knc.Interval = 10 Knc.Tag = "C" Exit Sub End If If Knc.Tag = "C" Then If Menu1.Top > Height Then End Menu1.Top = Menu1.Top + Height \ 160 End If End Sub Private Sub L_Click(Index As Integer) Select Case Index Case 0: Gmenu2 1 Case 2: GMenu6 1 Case 1: Gmenu3 1 Case 3: UkonciAUloz ' Case 4: Gmenu2 2 Case 5: Load Hra: Hra.NastavHru Case 6 To 14: NastavUroven Index Case 15: PrepniSchema Case 16: Edit.Schema.ListIndex = Schema.ListIndex: Edit.UkazMe Case 34: Nejl.Nacti Schema.Text, -1, -1 ' Case 17: Gmenu3 2 Case 22: Gmenu5 Case 23: Gmenu4 Case 26 To 27: NastavZvk Index Case 29 To 33: NastavCitlovost Index ' Case 18, 21: ZmenKlavesy Radek Case 19, 20: OdstranKlavesy Radek Case 24: Menu4.Visible = False Case 25: Menu5.Visible = False ' Case 28: GMenu6 2 End Select ZvukClick End Sub Private Sub L_MouseMove(Index As Integer, Button As Integer, Shift As Integer, X As Single, Y As Single) If Index = Jaky Then Exit Sub If Index <> -1 Then ZvukOver For i = 0 To L.Count - 1 If L(i).Tag = "" Then L(i).ForeColor = &H808000 Next If Index <> -1 Then L(Index).ForeColor = &HC0C000 Jaky = Index End Sub Private Sub Menu1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single) L_MouseMove -1, 0, 0, 0, 0 End Sub Private Sub Menu2_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single) L_MouseMove -1, 0, 0, 0, 0 End Sub Private Sub Gmenu2(X As Integer) Smer = X If X = 2 Then Menu2.Visible = False: Menu2.Enabled = False If X = 1 Then Menu1.Enabled = False TM2.Enabled = True End Sub Private Sub Gmenu3(X As Integer) Smer = X If X = 2 Then Menu3.Visible = False: Menu3.Enabled = False If X = 1 Then Menu1.Enabled = False TM3.Enabled = True End Sub Private Sub Gmenu4() Menu4.Move (Width - Menu4.Width) \ 2, Menu3.Top Jmeno_MouseMove 10, 0, 0, 0, 0 Menu4.Visible = True End Sub Private Sub Gmenu5() Menu5.Move (Width - Menu5.Width) \ 2, Menu3.Top Jmeno_MouseMove 1, 0, 0, 0, 0 Menu5.Visible = True End Sub Private Sub GMenu6(X As Integer) Smer = X If X = 2 Then Menu6.Visible = False: Menu6.Enabled = False If X = 1 Then Menu1.Enabled = False TM6.Enabled = True End Sub Private Sub Menu3_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single) L_MouseMove -1, 0, 0, 0, 0 End Sub Private Sub Menu4_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single) L_MouseMove -1, 0, 0, 0, 0 End Sub Private Sub Menu5_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single) L_MouseMove -1, 0, 0, 0, 0 End Sub Private Sub TM2_Timer() If Smer = 1 Then Menu1.Left = Menu1.Left - Menu2.Width \ 70 If Menu1.Left + (Screen.TwipsPerPixelX * 10 + Menu1.Width + Menu2.Width) \ 2 < Width \ 2 Then TM2.Enabled = False Menu2.Move Screen.TwipsPerPixelX * 10 + Menu1.Left + Menu1.Width, Menu1.Top Menu2.Visible = True Menu2.Enabled = True End If End If If Smer = 2 Then Menu1.Left = Menu1.Left + Menu2.Width \ 70 If Menu1.Left >= (Width - Menu1.Width) \ 2 Then TM2.Enabled = False Menu1.Left = (Width - Menu1.Width) \ 2 Menu1.Enabled = True End If End If End Sub Private Sub NastavUroven(X As Integer) For i = 6 To 14 L(i).Tag = "" Next L(X).Tag = 0 Jaky = -1 L_MouseMove X, 0, 0, 0, 0 Uroven = X - 5 End Sub Private Sub NastavCitlovost(X As Integer) For i = 29 To 33 L(i).Tag = "" Next L(X).Tag = 0 Jaky = -1 L_MouseMove X, 0, 0, 0, 0 Cit = X - 28 End Sub Private Sub NastavZvk(X As Integer) For i = 26 To 27 L(i).Tag = "" Next L(X).Tag = 0 Jaky = -1 If X = 26 Then Zvuk = True Else Zvuk = False L_MouseMove X, 0, 0, 0, 0 End Sub Public Sub PrepniSchema() i = Schema.Tag i = i + 1: If i = Schema.ListCount Then i = 0 Schema.Tag = i Schema.ListIndex = i L(15).Caption = "< " & Schema.Text & " >" End Sub Public Sub ZvukOver() If ZvukError = True Or mp1.CurrentPosition = -1 Then Exit Sub If Zvuk = True Then mp1.CurrentPosition = 0: mp1.Play End Sub Public Sub ZvukClick() If ZvukError = True Or mp2.CurrentPosition = -1 Then Exit Sub If Zvuk = True Then mp2.CurrentPosition = 0: mp2.Play End Sub Public Sub NactiZvuk() On Error GoTo p mp1.FileName = App.Path + "\zvmyov.viv": mp1.Stop mp2.FileName = App.Path + "\zvmycl.viv": mp2.Stop Exit Sub p: ZvukError = True End Sub Private Sub TM3_Timer() If Smer = 1 Then Menu1.Left = Menu1.Left - Menu3.Width \ 70 If Menu1.Left + (Screen.TwipsPerPixelX * 10 + Menu1.Width + Menu3.Width) \ 2 < Width \ 2 Then TM3.Enabled = False Menu3.Move Screen.TwipsPerPixelX * 10 + Menu1.Left + Menu1.Width, Menu1.Top Menu3.Visible = True Menu3.Enabled = True End If End If If Smer = 2 Then Menu1.Left = Menu1.Left + Menu3.Width \ 70 If Menu1.Left >= (Width - Menu1.Width) \ 2 Then TM3.Enabled = False Menu1.Left = (Width - Menu1.Width) \ 2 Menu1.Enabled = True End If End If End Sub Private Sub UlozKlavesy() Dim z As String: z = "" For i = 0 To Stroj.Count - 1 z = z + Stroj(i).Caption + "<>" Next Open App.Path + "\Config.cfg" For Output As #1 Print #1, z Close #1 End Sub Private Sub ZmenKlavesy(X As Integer) EditKlavesa = True End Sub Private Sub OdstranKlavesy(X As Integer) Stroj(Radek).Caption = "--" Klavesy(Radek).Caption = "< Prázdné >" UlozKlavesy End Sub Private Sub Otestuj() a = Stroj.Count - 1 For i = 0 To Stroj.Count - 1 If i <> Radek Then If Stroj(Radek).Caption = Stroj(i).Caption Then Klavesy(i).Caption = "< Prázdné >" Stroj(i).Caption = "-" Exit For End If End If Next End Sub Private Sub NactiKlavesy() Dim o As Integer: o = 0 Dim s As String, z As String * 2, q As String Open App.Path + "\Config.cfg" For Input As #1 Input #1, s Close #1 p: For i = 1 To Len(s) - 1 z = Mid(s, i, 2) If z = "<>" Then Radek = o q = Left(s, i - 1) Stroj(o).Caption = q If q = "--" Then Klavesy(o) = "< Prázdné >" If q <> "--" Then EditKlavesa = True Smer = 22 Fil_KeyDown Asc(Right(q, 1)), Val(Left(q, 1)) End If s = Right(s, Len(s) - i - 1) o = o + 1 GoTo p End If Next Smer = -1 End Sub Private Sub UkonciAUloz() Menu1.Enabled = False Open App.Path + "\Config.cg" For Output As #1 Write #1, Zvuk, Schema.ListIndex, Uroven, Cit Close #1 Knc.Enabled = True End Sub Private Sub TM6_Timer() If Smer = 1 Then Menu1.Left = Menu1.Left - Menu6.Width \ 70 If Menu1.Left + (Screen.TwipsPerPixelX * 10 + Menu1.Width + Menu6.Width) \ 2 < Width \ 2 Then TM6.Enabled = False Menu6.Move Screen.TwipsPerPixelX * 10 + Menu1.Left + Menu1.Width, Menu1.Top Menu6.Visible = True Menu6.Enabled = True End If End If If Smer = 2 Then Menu1.Left = Menu1.Left + Menu6.Width \ 70 If Menu1.Left >= (Width - Menu1.Width) \ 2 Then TM6.Enabled = False Menu1.Left = (Width - Menu1.Width) \ 2 Menu1.Enabled = True End If End If End Sub Private I As Integer Private z As String Private Jaky As Integer Public Sub Nacti(X As String, Bodu, Rad) If Hra.Visible = True Then Hra.Hide Show , Menu Fr.Move (Width - Fr.Width) \ 2, (Height - Fr.Height) \ 2 Jaky = 0: LL_MouseMove -1, 0, 0, 0, 0 z = "" Dim z0 As String Open App.Path & "\" & X & ".hsc" For Input As #1 Do Line Input #1, z0 z = z & z0 Loop Until EOF(1) Close #1 Dim q As Byte: q = 0 Dim e As Byte: e = 0 Dim Pozice As Byte: Pozice = 10 P: For I = 1 To Len(z) If Mid(z, I, 5) = "/&_&/" Then z0 = Left(z, I - 1) z = Right(z, Len(z) - I - 4) If q = 0 Then L(e).Caption = z0 If q = 1 Then K(2 * e).Caption = z0 If q = 2 Then K(2 * e + 1).Caption = z0 q = q + 1 If q = 3 Then q = 0: e = e + 1 GoTo P End If Next For I = 9 To 0 Step -1 If Bodu > Val(K(2 * I).Caption) Then Pozice = I If Bodu = Val(K(2 * I).Caption) Then If Rad >= Val(K(2 * I + 1).Caption) Then Pozice = I Else Pozice = I + 1 End If Next If Pozice < 10 Then 'Posun pozic K(Pozice * 2).ForeColor = &HC0C000 K(Pozice * 2 + 1).ForeColor = &HC0C000 L(Pozice).ForeColor = &HC0C000 For I = 9 To Pozice + 1 Step -1 L(I).Caption = L(I - 1).Caption K(I * 2).Caption = K(I * 2 - 2).Caption K(I * 2 + 1).Caption = K(I * 2 - 1).Caption Next K(Pozice * 2).Caption = Bodu K(Pozice * 2 + 1).Caption = Rad L(Pozice).Caption = "" BX.Input_Box 0, Fr.Left + L(Pozice).Left, Fr.Top + L(Pozice).Top If BX.Text = "" Then L(Pozice).Caption = "< Neznßmř >" Else _ L(Pozice).Caption = BX.Text 'Ulo×enÝ z0 = "" For I = 0 To 9 z0 = z0 & L(I).Caption & "/&_&/" & K(I * 2).Caption & "/&_&/" & K(I * 2 + 1).Caption & "/&_&/" Next Open App.Path & "\" & X & ".hsc" For Output As #1 Print #1, z0 Close #1 End If End Sub Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single) LL_MouseMove -1, 0, 0, 0, 0 End Sub Private Sub K_MouseMove(Index As Integer, Button As Integer, Shift As Integer, X As Single, Y As Single) LL_MouseMove -1, 0, 0, 0, 0 End Sub Private Sub L_MouseMove(Index As Integer, Button As Integer, Shift As Integer, X As Single, Y As Single) LL_MouseMove -1, 0, 0, 0, 0 End Sub Private Sub LL_Click(Index As Integer) If Index = 0 Then Unload Me: Hide: Menu.Show 0: Exit Sub End Sub Private Sub LL_MouseMove(Index As Integer, Button As Integer, Shift As Integer, X As Single, Y As Single) If Index = Jaky Then Exit Sub For I = 0 To LL.Count - 1 LL(I).ForeColor = &H808000 Next If Index <> -1 Then LL(Index).ForeColor = &HC0C000 Jaky = Index End Sub Private o As Integer Private Okr As Okraj Private z As String Private Nac As Boolean Public Ignoruj As Boolean Public L As Integer, P As Integer, H As Integer, s As Integer Private Jaky As Integer Private Sub Form_Load() Fil.Path = App.Path For o = 0 To Fil.ListCount - 1 Fil.ListIndex = o Schema.AddItem Left(Fil.FileName, Len(Fil.FileName) - 4) Next Schema.ListIndex = 0 MouseIcon = Menu.MouseIcon End Sub Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single) LL_MouseMove -1, 0, 0, 0, 0 End Sub Private Sub I_Click(Index As Integer) If Index = 0 Then GoTo pp If Index = -1 Then GoTo pp0 If Ignoruj = True Then Exit Sub If I(Index).Picture = Poz.Picture Then I(Index).Picture = Bar.Picture Else I(Index).Picture = Poz.Picture pp0: If I(1).Picture = Poz.Picture Then If Za.Value = 1 Then z = "2" Else z = "0" End If If I(1).Picture = Bar.Picture Then If Za.Value = 1 Then z = "3" Else z = "1" End If For o = 2 To 25 If I(o).Picture = Poz.Picture Then z = z & "0" Else z = z & "1" Next GTvar.RemoveItem Tvar.ListIndex GTvar.AddItem z, Tvar.ListIndex pp: z = "" For o = 1 To 25 If I(o).Picture = Poz.Picture Then z = z & "0" Else z = z & "1" Next Okr = a_NactiOkraje(z) If Okr.Levy = 0 Then Info.Caption = "0 x 0": Exit Sub Info.Caption = Okr.Pravy - Okr.Levy + 1 & " x " & Okr.Dolni - Okr.Horni + 1 End Sub Private Sub LL_Click(Index As Integer) Select Case Index Case 0: Zavri Case 1: TNovy Case 2: TOdstr Case 3: SOdstr Case 4: SNovy Case 5: PrepniSchema Case 6: PrepniTvar Case 7: NastavR 7: If Nac = False Then Za.Value = 1 Case 8: NastavR 8: If Nac = False Then Za.Value = 0 End Select If Visible = True Then Menu.ZvukClick End Sub Private Sub LL_MouseMove(Index As Integer, Button As Integer, Shift As Integer, X As Single, Y As Single) If Index = Jaky Then Exit Sub If Index <> -1 And Visible = True Then Menu.ZvukOver For o = 0 To LL.Count - 1 If LL(o).Tag <> "A" Then LL(o).ForeColor = &H808000 Next If Index <> -1 Then LL(Index).ForeColor = &HC0C000 Jaky = Index End Sub Private Sub Schema_Click() If Schema.Tag <> "" Then UlozTema GTvar.Clear: Tvar.Clear Open App.Path & "\" & Schema.Text & ".sch" For Input As #1 Input #1, z Close #1 For o = 1 To Len(z) Step 25 GTvar.AddItem Mid(z, o, 25) Tvar.AddItem "Tvar " & Tvar.ListCount + 1 Next z = "" Tvar.ListIndex = 0 Schema.Tag = Schema.Text LL(5).Caption = "< " & Schema.Text & " >" LL(5).Tag = Schema.ListIndex End Sub Private Sub SNovy() BX.Input_Box 1, 0, 0 If BX.Text = "" Then Exit Sub z = BX.Text If z = "" Then Exit Sub Dim u As String: u = "" Open App.Path & "\" & z & ".sch" For Output As #1 Print #1, String(25, "0") Close #1 For o = 1 To 10 u = u & "< Prázdné >/&_&/0/&_&/0/&_&/" Next Open App.Path & "\" & z & ".hsc" For Output As #1 Print #1, u Close #1 Schema.AddItem z Schema.ListIndex = Schema.ListCount - 1 End Sub Private Sub SOdstr() q = MsgBox("Opravdu chcete toto schéma odstranit?", vbQuestion + vbYesNo) If q = vbYes Then If Schema.ListCount = 1 Then MsgBox ("Nelze odstranit všechna schémata!"): Exit Sub Kill App.Path & "\" & Schema.Text & ".sch" Kill App.Path & "\" & Schema.Text & ".hsc" Schema.Tag = "" Schema.RemoveItem Schema.ListIndex Schema.ListIndex = 0 End If End Sub Private Sub TNovy() Tvar.AddItem "Tvar " & Tvar.ListCount + 1 GTvar.AddItem String(25, "0") Tvar.ListIndex = Tvar.ListCount - 1 End Sub Private Sub TOdstr() If Tvar.ListCount = 1 Then Exit Sub GTvar.RemoveItem Tvar.ListIndex Schema_Click Tvar.ListIndex = 0 End Sub Private Sub Tvar_Click() GTvar.ListIndex = Tvar.ListIndex NactiTvar GTvar.Text I_Click 0 LL(6).Caption = "< " & Tvar.Text & " >" LL(6).Tag = Tvar.ListIndex End Sub ' Private Sub NactiTvar(X As String) Nac = True If Left(X, 1) > "1" Then Za.Value = 1 Else Za.Value = 0 If Za.Value = 0 Then LL_Click 8 Else LL_Click 7 For o = 1 To 25 If Mid(X, o, 1) = "0" Or Mid(X, o, 1) = "2" Then I(o).Picture = Poz.Picture Else I(o).Picture = Bar.Picture Next Nac = False End Sub ' ' Private Sub UlozTema() z = "" For o = 0 To GTvar.ListCount - 1 GTvar.ListIndex = o z = z & GTvar.Text Next Open App.Path & "\" & Schema.Tag & ".sch" For Output As #1 Print #1, z Close #1 z = "" End Sub ' ' Public Sub a_NactiOkraj() L = Okr.Levy P = Okr.Pravy s = Okr.Dolni H = Okr.Horni End Sub ' ' Public Sub RotujTvar(Smer As Integer) z = "" For o = 1 To 25 If I(o).Picture = Poz.Picture Then z = z & "0" Else z = z & "1" Next z = a_Funkce_Rotuj(z, Smer) For o = 1 To 25 If Mid(z, o, 1) = "0" Then I(o).Picture = Poz.Picture Else I(o).Picture = Bar.Picture Next I_Click 0 End Sub Private Sub Za_Click() If Nac = False Then I_Click -1 End Sub Private Sub Zavri() Menu.Schema.Clear L = Schema.ListIndex For P = 0 To Schema.ListCount - 1 Schema.ListIndex = P Menu.Schema.AddItem Schema.Text Next Menu.Schema.Tag = L - 1 Menu.PrepniSchema UlozTema Hide Menu.Show End Sub Public Sub UkazMe() Jaky = 0 LL_MouseMove -1, 0, 0, 0, 0 Show , Menu Move (Menu.Width - Width) \ 2, (Menu.Height - Height) \ 2 + Screen.TwipsPerPixelY * 10 Mn.Move (Width - Mn.Width) \ 2, (Height - Mn.Height) \ 2 Ln1.X2 = Width: Ln2.X2 = Width Ln1.Y1 = Menu.Ln1.Y1 - Top: Ln1.Y2 = Ln1.Y1 Ln2.Y1 = Menu.Ln2.Y1 - Top: Ln2.Y2 = Ln2.Y1 End Sub Private Sub PrepniSchema() o = LL(5).Tag o = o + 1: If o = Schema.ListCount Then o = 0 LL(5).Tag = o Schema.ListIndex = o End Sub Private Sub PrepniTvar() o = LL(6).Tag o = o + 1: If o = Tvar.ListCount Then o = 0 LL(6).Tag = o Tvar.ListIndex = o End Sub Private Sub NastavR(X As Integer) For o = 7 To 8 LL(o).Tag = "" Next LL(X).Tag = "A" Jaky = -1 LL_MouseMove X, 0, 0, 0, 0 End Sub