OpenGL Sprite
OpenGL Sprite
OpenGL Sprite
Imports System.Runtime.InteropServices
Imports SFML.System
Imports SFML.Window
Imports SFML.Graphics
Imports OpenTK
Imports OpenTK.Graphics
Imports OpenTk.Graphics.OpenGL
Module OpenGL
''' <summary>
''' Entry point of application
''' </summary>
Sub Main()
' We get the position of the mouse cursor, so that we can move the box
accordingly
Dim x = Mouse.GetPosition(window).X * 200.0F / window.Size.X - 100.0F
Dim y = -Mouse.GetPosition(window).Y * 200.0F / window.Size.Y + 100.0F
End While
End Sub
''' <summary>
''' Function called when the window is closed
''' </summary>
Sub App_Closed(ByVal sender As Object, ByVal e As EventArgs) Handles
window.Closed
Dim window = CType(sender, RenderWindow)
window.Close()
End Sub
''' <summary>
''' Function called when a key is pressed
''' </summary>
Sub App_KeyPressed(ByVal sender As Object, ByVal e As KeyEventArgs) Handles
window.KeyPressed
Dim window = CType(sender, RenderWindow)
If e.Code = Keyboard.Key.Escape Then
window.Close()
End If
End Sub
''' <summary>
''' Function called when the window is resized
''' </summary>
Sub App_Resized(ByVal sender As Object, ByVal e As SizeEventArgs) Handles
window.Resized
GL.Viewport(0, 0, e.Width, e.Height)
End Sub
End Module