XNA Creators Club Online
community forums
Page 1 of 1 (7 items)
Sort Posts: Previous Next

MouseMove

Last post 04-21-2008 3:32 AM by Soundbomber. 6 replies.
  • 04-17-2008 4:30 AM

    MouseMove

    I am writing a 3D object viewer in managed directx (VB.NET). The viewer only needs refreshing when user input moves the camera view position, so I am not using a loop to refresh the viewer but the MouseMove event handler (which also handles the camera position). The problem with this (I think!) is that far more refreshes are occuring than neccessary, i.e. every time the mouse move event is fired. This leads to occasional flickers when rapid mouse movement is handled.

    How do I get around this?

    If it looks like crap,
    and smells like crap,
    and tastes like crap,
    It's probably crap.
  • 04-17-2008 10:10 PM In reply to

    Re: MouseMove

    This flickering might be caused by deleting the background before rendering the next frame. This is the default behaviour of every control. You should try to change it by handling the onEraseaground event.

  • 04-18-2008 3:44 AM In reply to

    Re: MouseMove

    My control doesn't have such an event!
    If it looks like crap,
    and smells like crap,
    and tastes like crap,
    It's probably crap.
  • 04-20-2008 1:06 AM In reply to

    Re: MouseMove

    You could add somekind of timing value, if a certain amount of time has passed render else forget about it. 30 odd frames a second or whatever suits your fancy.
  • 04-20-2008 2:12 AM In reply to

    Re: MouseMove

    Answer
    I would just hook into the Application.Idle event and let it render over and over. Unless you are targetting lower-end machines you can usually get away with this without any real performance issues.
  • 04-20-2008 9:47 AM In reply to

    Re: MouseMove

    Answer
    That's the method i like using. You can always query for mouse coordinates and update as required.
  • 04-21-2008 3:32 AM In reply to

    Re: MouseMove

    OK, thanks for the suggestions.
    If it looks like crap,
    and smells like crap,
    and tastes like crap,
    It's probably crap.
Page 1 of 1 (7 items) Previous Next