I know you must be sick of people having trouble with events, but..
I'm trying to handle the MouseWheelMoved event but I cannot get it to fire.
Definitions and such:
private RenderWindow SFMLWindow
; private bool FormOpen
= true; private BaseObject baseObj
= new BaseObject
(); private Grid grid
; public static Vector2f Offset
= new Vector2f
(150,
20); public static float Scale
= 1; private Event mainEvent
= new Event(); private void Form1_Load
(object sender, EventArgs e
) { SFMLWindow
= new RenderWindow
(this.Handle); SFMLWindow
.Size = new Vector2u
((uint)ClientSize
.Width,
(uint)ClientSize
.Height); SFMLWindow
.MouseWheelMoved += new EventHandler
<MouseWheelEventArgs
>(window_MouseWheelMoved
); baseObj
.Load("Sprites/Base.png"); grid
= new Grid
(SFMLWindow
); MainLoop
(); } Loop:
private void MainLoop
() { while (FormOpen
) { Application
.DoEvents(); SFMLWindow
.DispatchEvents(); SFMLWindow
.Clear(SFML
.Graphics.Color.Black); Input
.Update(); grid
= new Grid
(SFMLWindow
);//TODO: Move stuff from constructor to Update(). MWheelInput
(); //Draw baseObj
.Draw(SFMLWindow
); grid
.Draw(SFMLWindow
); // SFMLWindow
.Display(); } } How I tried to handle the event:
private void window_MouseWheelMoved(object sender, MouseWheelEventArgs e)
{
//Tried this first.
Console.WriteLine("roll");
}
private void MWheelInput()
{
if (mainEvent.Type == EventType.MouseWheelMoved)
{
Console.WriteLine("roll");
}
}
Neither seem to work, it's probably something stupid. Any help would be much appreciated.