|
||
|
|||||||
| XNA Tutorials and support for game development using Microsoft's XNA Game Studio framework. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 (permalink) | |
|
Forum Expert
|
I have an XNA Game Window loaded into a Windows Form and would like to know how I can create some sort of...mouse bounds?
right now, when i check for mouse coordinates it checks the entire form, but i only want it to check when on the xna window and only in the xna window. how do i accomplish this?
__________________
Quote:
|
|
|
|
|
|
|
#2 (permalink) | |
|
ConnectUO Creator
Join Date: Jan 2004
Location: In your mom
Age: 27
Posts: 4,760
|
Quote:
Code:
if(mouseState.X > 0 && mouseState.Y > 0 &&
mouseState.X < GraphicsDevice.PresentationParameters.BackBufferWidth &&
mouseState.Y < GraphicsDevice.PresentationParameters.BackBufferHeight)
{
//Mouse is inside the game window.
}
__________________
Jeff Boulanger ConnectUO - Core Developer Want to help make ConnectUO better? Click here to submit your ideas/requests Use your talent to compete against other community members in RunUO hosted coding competitions If you know XNA (even if its just a little) or are a good artist(2d or 3d) and are interested in making games for a hobby send me a pm or drop by #xna in irc.runuo.com. I'm looking to put together a small game development team. Please do not pm me for support. If you are having issues please post in the appropriate forum. Thanks for your continued support of both ConnectUO and RunUO |
|
|
|
|
|
|
#3 (permalink) | |
|
Forum Expert
|
Well we have an XNA Graphical Device window inside a windows form, but a game class is never actually defined. We have a class that calls IServices, IGraphicalDevice something-or-another. I don't have the code in front of me right now. I was thinking to myself last night though, I should make it a game window. Apparently I may have been right.
We also need to check the X,Y of the mouse so that we can keep the 48x48 tile attached to the exact mouse location; right now its got a weird offset. Ideas?
__________________
Quote:
|
|
|
|
|
|
|
#4 (permalink) | |
|
ConnectUO Creator
Join Date: Jan 2004
Location: In your mom
Age: 27
Posts: 4,760
|
Quote:
Code:
MouseState mouseState = Mouse.GetState(); int x = mouseState.X; int y = mouseState.Y;
__________________
Jeff Boulanger ConnectUO - Core Developer Want to help make ConnectUO better? Click here to submit your ideas/requests Use your talent to compete against other community members in RunUO hosted coding competitions If you know XNA (even if its just a little) or are a good artist(2d or 3d) and are interested in making games for a hobby send me a pm or drop by #xna in irc.runuo.com. I'm looking to put together a small game development team. Please do not pm me for support. If you are having issues please post in the appropriate forum. Thanks for your continued support of both ConnectUO and RunUO |
|
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|