Skip to main content
gamedev.net
🔒 Locked

Conversion Error

Started by Greycrow Mar 29, 2009 at 9:50 PM 1 replies 900+ views
Original Post
Greycrow
Greycrow
I'm using a mix of "System.Windows.Forms" and "Microsoft.Xna.Framework" and I'm trying to build a mouse selectable menu. This code statement looks for the mouse pointer inside of a menu item rectangle. if (Menu.startRect.Contains(Cursor.Position)) but I get the error Cannot convert type 'System.Drawing.Point' to 'Microsoft.Xna.Framework.Point' Is there an easy way to solve this? Thanks Grey
MJP
MJP
Sure.

if (Menu.startRect.Contains(new Microsoft.Xna.Framework.Point(Cursor.Position.X, Cursor.Position.Y)))
Greycrow
Greycrow
That worked great thanks!

I needed to change it a bit because I was in windowed mode.
I needed to get the window position on the screen and account for
the title bar.

Just in case anyone else needs to do this here it is:

if (Menu.itemRect.Contains(new Microsoft.Xna.Framework.Point (Cursor.Position.X - gameForm.Location.X, Cursor.Position.Y - gameForm.Location.Y - TitleBarHeight)))

Grey

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.