1
DotNet / Question about Input
« on: July 29, 2011, 10:39:46 am »
Hey Laurent
Did you manage to reproduce the behaviour ?
Did you manage to reproduce the behaviour ?
This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.
Imports SFML.Graphics
Imports SFML.Window
Public Class SFMLPanel
Inherits Panel
'the SFML window
Protected WithEvents RenderWindow As RenderWindow
''' <summary>
''' Constructor
''' </summary>
''' <remarks></remarks>
Public Sub New()
MyBase.New()
'init
Me.SetStyle(ControlStyles.UserPaint Or ControlStyles.AllPaintingInWmPaint Or ControlStyles.Opaque, True)
RenderWindow = New RenderWindow(Me.Handle)
End Sub
Protected Overrides Sub OnPaint(ByVal e As System.Windows.Forms.PaintEventArgs)
'clear
RenderWindow.Clear()
MyBase.OnPaint(e)
RenderWindow.DispatchEvents()
'render
RenderWindow.Display()
'next iteration
Application.DoEvents()
Me.Invalidate()
End Sub
Protected Overrides Sub OnResize(ByVal eventargs As System.EventArgs)
MyBase.OnResize(eventargs)
'update view
RenderWindow.SetView(New View(New FloatRect(0, 0, Me.Width, Me.Height)))
End Sub
Private Sub RenderWindow_MouseMoved(ByVal sender As Object, ByVal e As SFML.Window.MouseMoveEventArgs) _
Handles RenderWindow.MouseMoved
Debug.WriteLine("Mouse moved " + e.X.ToString + " ; " + e.Y.ToString)
End Sub
Private Sub RenderWindow_MouseButtonPressed(ByVal sender As Object, ByVal e As SFML.Window.MouseButtonEventArgs) _
Handles RenderWindow.MouseButtonPressed
Debug.WriteLine("Mouse clicked")
Me.Focus()
End Sub
End Class
Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim renderPanel As New SFMLPanel
SplitContainer1.Panel1.Controls.Add(renderPanel)
renderPanel.Dock = DockStyle.Fill
End Sub
End Class