gambas-source-code/app/examples/OpenGL/NeHeTutorialShell/.src/FMain.class

64 lines
1.8 KiB
Text

' Gambas class file
Private $sExec As String
Private $aTutorial As String[][] = [
["Example1", ("1 - Setting Up An OpenGL Window")],
["Example2", ("2 - Your First Polygon")],
["Example3", ("3 - Adding Color")],
["Example4", ("4 - Rotation")],
["Example5", ("5 - 3D Shapes")],
["Example6", ("6 - Texture Mapping")],
["Example7", ("7 - Texture Filters, Lighting & Keyboard Control")],
["Example8", ("8 - Blending")],
["Example9", ("9 - Moving Bitmaps In 3D Space")],
["Example10", ("10 - Loading And Moving Through A 3D World")],
["Example11", ("11 - Flag Effect (Waving Texture)")],
["Example16", ("16 - Cool Looking Fog")],
["Example19", ("19 - Particle Engine")],
["Example25", ("25 - Morphing & Loading Objects From A File")],
["Example42", ("42 - Multiple Viewports")]]
Public Sub Form_Open()
Dim aTutorial As String[]
For Each aTutorial In $aTutorial
cmbTutorial.Add(aTutorial[1])
Next
cmbTutorial_Click
End
Public Sub btnRun_Click()
Dim sOutput As String
If Not $sExec Then
Shell "rm -rf /tmp/NeHeTutorial" Wait
Shell "cp -R " & Shell$(System.Path &/ "share/gambas3/examples/OpenGL/NeHeTutorial") & " /tmp/NeHeTutorial" Wait
Shell "cd /tmp/NeHeTutorial && gbc3 -agt && gba3" To sOutput
$sExec = "/tmp/NeHeTutorial/NeHeTutorial.gambas"
If Not Exist($sExec) Then
Message.Error(("Unable to compile the NeHeTurotial example inside the <tt>/tmp</tt> directory."))
$sExec = ""
Return
Endif
Endif
Exec [$sExec, $aTutorial[cmbTutorial.Index][0], $aTutorial[cmbTutorial.Index][1]]
End
Public Sub btnQuit_Click()
Me.Close
End
Public Sub cmbTutorial_Click()
txtCode.Text = File.Load(System.Path &/ "share/gambas3/examples/OpenGL/NeHeTutorial" &/ ".src" &/ $aTutorial[cmbTutorial.Index][0] & ".module")
txtCode.Pos = 0
End