Quantcast
Channel: Community | MonoGame - Latest topics
Viewing all articles
Browse latest Browse all 6821

MonoGame Mouse.GetState() not getting position

$
0
0

@George_Leslie wrote:

Hi All,

I am relatively new to MonoGame but I player around with XNA quite a lot back in the day.

I am trying to port an old project of mine. This project was a 2D game engine (nowhere near complete) that included a windows forms based tile map editor.

The issue that I am currently having is when using Monogame Game class embedded within a windows form.

In order to achieve this, I am setting the draw surface to a PictureBox as follows:

void graphics_PreparingDeviceSettings(object sender,
PreparingDeviceSettingsEventArgs e)
{

e.GraphicsDeviceInformation.PresentationParameters.DeviceWindowHandle = drawSurface;

}

where drawSurface is a PictureBox's IntPtr handle.

The issue comes in when I am trying to get the MouseState in the Update loop.

MouseState ms = Mouse.GetState();

I have also tried MouseState ms = Mouse.GetState(this.Window);

I am unsure why but ms.X and ms.Y are never updated.

Any help would be greatly appreciated.

P.S. This project was created using the Windows monogame project type.

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 6821

Trending Articles