gambas-source-code/app/examples/OpenGL/TunnelSDL/.src/MMain.module
Benoît Minisini a5f2cb1575 [FARM SERVER]
* NEW: Software screenshot can be deleted by the client.

[INTERPRETER]
* NEW: The little interpreter sleep is now done inside the watch file 
  descriptor read callback only. So no need to implement it in each
  component event loop.

[GB.SDL2]
* BUG: The SDL event loop now calls the interpreter event loop so that 
  timers and watched file descriptor are correctly handled.


git-svn-id: svn://localhost/gambas/trunk@6792 867c0c6c-44f3-4631-809d-bfa615b0a4ec
2015-01-02 03:44:30 +00:00

67 lines
1.1 KiB
Text

' Gambas module file
' Original author : Arnaud Storq
' Gambas Port : Fabien Bodard
Private Screen As Window
Public Sub Main()
Dim Texture As Image
Screen = New Window(True) As "Screen"
With Screen
.Resize(512, 512)
.Framerate = 120
.Resizable = True
.Show
End With
Texture = image.Load("texture.png")
CTunnel.tunnelInitialiser(Texture)
End
Public Sub Screen_Draw()
CTunnel.tunnelAfficher(GetTickCount())
Print Screen.FrameRate; " FPS\r";
End
Public Sub Screen_Close()
CTunnel.tunnelDetruire()
End
Public Sub Screen_Keypress()
If key.Code = key.f1 Then
Screen.FullScreen = Not Screen.FullScreen
Else If Key.Code = Key.Esc Then
Screen.Close
Endif
End
Private Sub GetTickCount() As Integer
Return CInt(Timer() * 1000)
End
Public Sub Screen_Resize()
Gl.Viewport(0, 0, Screen.Width, Screen.Height)
Gl.MatrixMode(Gl.PROJECTION)
Gl.LoadIdentity()
Gl.Frustum(-1.0, 1.0, - (Screen.Height / Screen.Width), (Screen.Height / Screen.Width), 5.0, 60.0)
Gl.MatrixMode(Gl.MODELVIEW)
Gl.LoadIdentity()
Gl.Translatef(0.0, 0.0, -40.0)
End