Welcome, Guest. Please login or register. Did you miss your activation email?

Show Posts

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.


Messages - Merad

Pages: [1]
1
DotNet / Re: Mouse wheel events not firing
« on: March 24, 2015, 08:55:29 pm »
Ok, I found the solution, in case anyone else runs into this.  Windows only sends mouse wheel events to the control that has focus, but Panel is not a focusable control by default.  There doesn't seem to be a way to easily change this, so I added the following in my Form's ctor to force the panel to focus when the mouse hovers over it

drawingPanel.MouseHover += (sender, args) => drawingPanel.Focus();

2
DotNet / Re: Mouse wheel events not firing
« on: March 24, 2015, 08:10:24 pm »
I just checked, and the event does fire correctly when I allow SFML to create the window.  So presumably the problem is with mouse events being forwarded from the winforms panel to the renderwindow.  Any ideas?

3
DotNet / Mouse wheel events not firing
« on: March 24, 2015, 07:09:05 pm »
I'm using the .NET bindings in a C# winforms app, and actually drawing onto a panel.  Mouse clicked events work fine, but scroll events never fire.

My setup code is simply

// windowHandle is the handle of the panel we're drawing to
m_renderWindow = new RenderWindow(windowHandle,
  new ContextSettings { AntialiasingLevel = 8 });
m_renderWindow.Resized += (sender, args) => UpdateViewSize();
m_renderWindow.MouseWheelMoved +=
  (sender, args) => Log.Info("mouse scrolled");
m_renderWindow.MouseButtonPressed +=
  (sender, args) => Log.Info("mouse clicked");

My main loop calls both System.Windows.Forms.Application.DoEvents() and m_renderWindow.DispatchEvents().  And as I said, clicks work fine...

4
Graphics / Re: Text is very blurry
« on: February 18, 2015, 10:56:17 pm »
What you could do is make sure that you draw the font 1:1.

I think I am already doing that?

My RenderWindows are drawing onto WinForms panels, so the main windows and the overview are separate RenderWindows.  All I do is set the size of the overview's view on creation and resize:

private void OverviewWindowOnResized(object sender, SizeEventArgs e)
{
  var ratio = (float)e.Height / e.Width;
  m_overviewView.Size =  new Vector2f(m_track.Dimensions.X, m_track.Dimensions.X * ratio);
}

And then the drawing:
m_overviewWindow.SetView(m_overviewView);
m_overviewWindow.Clear(Color.White);
m_track.DrawOverview(m_overviewWindow);
m_population.DrawOverview(m_overviewWindow);
m_overviewWindow.Display();
 

5
Graphics / Text is very blurry
« on: February 18, 2015, 09:48:11 pm »
Pic: https://dl.dropboxusercontent.com/u/24553495/gc.png

The text I'm talking about is insize the Overview panel, the labels by each vertical line.  This screenshot was taken with the text set to arial font, default rendering style, and character size 8.  I'm guessing this might be because the view used for that window is rather large (it's showing the entire track, which is several hundred meters long), but what can I do to fix it?

Edit: I'm using SFML.net with C# if that makes a difference.

Pages: [1]