The Daily Click ::. Forums ::. Klik Coding Help ::. Click and drag mouse scrolling
 

Post Reply  Post Oekaki 
 

Posted By Message

vetmora120



Registered
  07/01/2010
Points
  273
7th November, 2012 at 07/11/2012 11:28:49 -

Hi all,

Having some difficulty getting this to work. I'm trying to create a click and drag scrolling system using the mouse. Where you simply click and hold the mouse, and the screen moves opposite to where you move it. Similar to most touch phone applications I guess.

 
n/a

nivram



Registered
  20/07/2006
Points
  171
7th November, 2012 at 07/11/2012 12:22:26 -

Drag Screen Example
Author: nekomura
Genre: Example
Extensions Needed: none
Description:
A much sought after example. This one does a perfect job
Instructions:
Use the Left Mouse Button to drag the screen.

Link:
http://castles-of-britain.com/mmfexamples-c.htm

Marv

 
458 MMF2 & CTF 2.5 examples and games

http://www.castles-of-britain.com/mmf2examples.htm

vetmora120



Registered
  07/01/2010
Points
  273
7th November, 2012 at 07/11/2012 21:29:22 -

Aha, thanks Nivram. How did I miss this one? I searched your website a couple of times...

Thanks again, it's perfect!

EDIT:

Hang on, it's not quite perfect. It seems to stuff up if I make the frame size any bigger... Any idea why this is?

Edited by vetmora120

 
n/a

Sketchy

Cornwall UK

Registered
  06/11/2004
Points
  1970

VIP MemberWeekly Picture Me This Round 43 Winner!Weekly Picture Me This Round 47 WinnerPicture Me This Round 49 Winner!
8th November, 2012 at 08/11/2012 00:14:15 -

+ User clicks with left button
-> Set DragX to XMouse
-> Set DragY to YMouse

+ Repeat while left mouse-button is down
-> Center display at X = ((X Left Frame+X Right Frame)/2)+(DragX-XMouse)
-> Center display at Y = ((Y Top Frame+Y Bottom Frame)/2)+(DragY-YMouse)

(credit to RedEnchilada for coming up with that)

 
n/a

nivram



Registered
  20/07/2006
Points
  171
8th November, 2012 at 08/11/2012 00:25:37 -

Nice formula. Do I know RedEnchilada?

Thanks,

Marv

 
458 MMF2 & CTF 2.5 examples and games

http://www.castles-of-britain.com/mmf2examples.htm

Sketchy

Cornwall UK

Registered
  06/11/2004
Points
  1970

VIP MemberWeekly Picture Me This Round 43 Winner!Weekly Picture Me This Round 47 WinnerPicture Me This Round 49 Winner!
8th November, 2012 at 08/11/2012 01:32:17 -

Don't know. Apparently (s)he was formerly known as "RedEchidna", if that means anything to you. To be honest, I can't keep track of all the people on here and what they do (especially all the Andys).

 
n/a

vetmora120



Registered
  07/01/2010
Points
  273
8th November, 2012 at 08/11/2012 08:30:30 -

Thanks Sketchy for your infinite usefulness.

Works perfectly with very minimal coding.

 
n/a

Assault Andy

Administrator
I make other people create vaporware

Registered
  29/07/2002
Points
  5686

Game of the Week WinnerVIP Member360 OwnerGOTM JUNE - 2009 - WINNER!GOTM FEB - 2010 - WINNER!	I donated an open source project
29th November, 2012 at 29/11/2012 08:20:48 -


Originally Posted by Sketchy
Don't know. Apparently (s)he was formerly known as "RedEchidna", if that means anything to you. To be honest, I can't keep track of all the people on here and what they do (especially all the Andys).



Like me! There are a fair few Andys aren't there?

 
Creator of Faerie Solitaire:
http://www.create-games.com/download.asp?id=7792
Also creator of ZDay20 and Dungeon Dash.
http://www.Jigxor.com
http://twitter.com/JigxorAndy

Sketchy

Cornwall UK

Registered
  06/11/2004
Points
  1970

VIP MemberWeekly Picture Me This Round 43 Winner!Weekly Picture Me This Round 47 WinnerPicture Me This Round 49 Winner!
29th November, 2012 at 29/11/2012 20:15:03 -

Yeah, like you. And AndyUK. That might even be all of them, but it's still enough to confuse me...

 
n/a

Chris Burrows



Registered
  14/09/2002
Points
  2396

GOTW WINNER OCT. 2011
5th December, 2012 at 05/12/2012 14:55:16 -

I get Urbanmonk confused with the Andys.

 
n/a
   

Post Reply



 



Advertisement

Worth A Click