Jump to content

  • Log In with Google      Sign In   
  • Create Account

Banner advertising on our site currently available from just $5!

1. Learn about the promo. 2. Sign up for GDNet+. 3. Set up your advert!

WD Industries

Member Since 24 Apr 2009
Offline Last Active Jul 02 2012 09:38 PM

Topics I've Started

Help with C# and XNA Classes

01 July 2012 - 09:25 PM

Hi there!

I'm still a beginner at programming - I usually fumble my way through coding and debugging. I need some help passing my "Mouse Position" to a class (so the class can determine if the mouse is hovering over the button).

I need help understanding how classes work as well as passing information to them when you use methods.

Basically - what I have now is a class called MouseManager (tracks position and buttons clicked), a class called Buttons (I am trying to get the update method to determine if the mouse is over one of the buttons) and the main program.

Here are some code snippets -

From Buttons.cs:

internal void Update(GameTime gameTime, MouseState currentMousePosition)
// Determine if mouse is over the button.
// I need help with MouseState currentMousePosition - I think this is where the problem is...

From MosquitoAttack.cs:

buttonStart.Update(gameTime, currentMouseState);

I can provide all of the code if it would help (well, I added it as .txt files). I am currently getting the following error:
The best overloaded method match for 'MosquitoAttack.Buttons.Update' has some invalid arguments.
Cannot convert from 'MosquitoAttack.MouseManager.State' to 'Microsoft.Xna.Framework.Input.MouseState'


Detecting Mouse Button HELD - XNA

02 June 2012 - 12:37 PM

Hey GameDev,

I am currently working on a game (my first aside from TicTacToe), and I am trying to detect when the Mouse button has been held. My friend supplied me with MouseManager.cs which detects clicks as far as I can tell - I am trying to make it detect when the button has been held for a period of time.

I have attached the MouseManager. I believe I have to change it to make it detect holding the mouse. I have included changes I have made - but so far it hasn't worked with my code.


I seem to have solved the problem :) Now if only the rest of my code worked..

New Member & Some questions

24 April 2009 - 07:33 AM

Hey guys, I'm in the electrical engineering program at my university - but recently I've been wishing that I had choosen CMPE or CompSci. So - I figured I would act on that and start working on some independant games. Over the past month I've gone around this website and others and gotten some friends together with a general plan - and have scaled it back greatly ;p My background/experience: -Basics of C++ ; will be taking more C++ courses next semester - I am probably just a 'modular' programmer at this point (can pass some values in between modules); I don't really know OO. -Some Python experience. -Can make simple logic-based text-games. -For game design (w/ my friends) we have decided on C++/Python using the Panda3d engine - OpenGL (if neccesary), Blender and the IDE I use is Code::Blocks with MinGW compiler. I have some game concepts I would like to work on and have written a pretty good design document (based on website requirements etc...). I am currently working through some game design books (I have bought a lot including AI, graphics, basics, audio, etc...) The one I am currently 'doing' is progressively making more advanced games with it (haven't reached anything graphical yet). I have also gone through Greven's tetris tutorial - but it is too advanced for me at this stage - so I've put that on hold. So - should I keep on at my current pace? It sucks. I kind of want to just find a team on here and struggle through - but I know that would be tough for the team and I don't always want to be playing catch-up. What is recommended? Thanks! WD Industries