How about summing up the x_delta and y_delta from the on_mouse_motion and
then having the moveCamera called inside the update loop.

On Tue, Jun 7, 2011 at 12:57 AM, Duck <[email protected]> wrote:

> I removed it but that didn't made any difference. Perhaps it could be
> too slow though. I just ran it with cProfile and if you scroll the map
> around during the whole run, it seems you spend more then half the
> time in updateVisible(), each call taking about 0.07s!
> Perhaps I should:
> 1) - Buffer the input from on_mouse_drag so to move a couple more
> pixels each time and so minimize the need to call updateVisible().
> 2) - Take a good look at updateVisible and see if it can be speed up.
>
>
> On 7 jun, 09:07, Jonathan Hartley <[email protected]> wrote:
> > Some guesswork:
> >
> > If you're doing a batch.draw() (inside camera.render) on every on_draw
> > event, then I don't think you also need to call batch.draw() (inside
> > camera.moveScreen) in on_mouse_drag. I'd suggest deleting the call to
> > batch.draw() in moveScreen.
> >
> > Possibly this is making the on_mouse_drag handler take to long to
> > execute? So mouse_drag events were stacking up without chance to do
> > the on_draw events inbetween them? Or maybe this has nothing to do
> > with your problem.
> >
> > Speculatively yours,
> >
> >   Jonathan
> >
> > On Jun 6, 11:29 am, Duck <[email protected]> wrote:
> >
> >
> >
> > > I'm creating a framework for a grid based game and I'm trying to use
> > > the events to move the map around. This works fine with the keyboard
> > > events, but I'm having some trouble with on_mouse_drag. If I keep
> > > moving the mouse around fast enough, the fps counter freezes and the
> > > map doesn't move untill I stop the mouse. The mouse drag events are
> > > firing rapidly though. Are the events somehow blocking the screen from
> > > drawing again, or am I doing something totally wrong?
> >
> > > Code is posted on pastebin:http://pastebin.com/Mj9yCA7r
> >
> > > Also, if you see anything stupid, please tell me.
> >
> > > Thanks,
> > > Duck- Tekst uit oorspronkelijk bericht niet weergeven -
> >
> > - Tekst uit oorspronkelijk bericht weergeven -
>
> --
> You received this message because you are subscribed to the Google Groups
> "pyglet-users" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/pyglet-users?hl=en.
>
>


-- 
Incoherently,
Ricky Ng

-- 
You received this message because you are subscribed to the Google Groups 
"pyglet-users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/pyglet-users?hl=en.

Reply via email to