The Daily Click ::. Forums ::. Klik Coding Help ::. Scroling when window maximized
 

Post Reply  Post Oekaki 
 

Posted By Message

Avantar1975



Registered
  01/12/2011
Points
  39
21st January, 2013 at 21/01/2013 20:33:47 -

I hope someone can help me:

I am making an application with large images/maps. For the app to work on any resolution, I use the window control object and resize the frame hight/width to the client hight/width.

For scroling to work, the frame needs to be larger than the window/play are size, but I can't seem to do any scroling when making use of the window control object. I have tried WinScrollObject too.

Ideal would be to actually grab the map and drag it around with the mouse - similar to google maps, but even if I can just use the arrow keys it would be fine.

Any help would be greatly appreciated.

 
n/a

s-m-r

Slow-Motion Riot

Registered
  04/06/2006
Points
  1078

Candle
21st January, 2013 at 21/01/2013 21:32:22 -

I don't think you need to use any Extension Objects for this.

Just create an Active Object named something like "Camera Object" and always center the frame on it. When the cursor keys are used or when the mouse is clicked, have the Camera Object move accordingly.


IF Always
THEN Center frame position on [Camera Object] at 0,0



Then for keyboard controls, try this:


IF Repeat while Right Arrow is pressed
THEN Set X Position of Camera Object to XPos Camera Object + 5 (or whatever number you choose to make a smooth enough scrolling effect)



Do the same thing for all four directions, adjusting the X Position and Y Positions for the directions you would like to move the screen.

For mouse controls, try something like this:



IF Left Mouse Button is clicked
AND Always
THEN Set X Position of Camera Object to XMouse
AND Set Y Position of Camera Object to YMouse



I can't check this myself right now as I'm not at my MMF2 machine, but it seems like it would work. You may want to force the XPos and YPos of the Camera Object to stay at the center of the screen, so that when the player moves the Camera Object too far to the left or right, it still stays in the frame. But using mouse controls will allow the view to canter itself by making a "jump" to where you click.

If you want smooth scrolling while the player clicks and/or drags the mouse about on the screen, that'll take a little extra work, but here's a recent discussion thread that addresses this issue:

http://create-games.com/forum_post.asp?id=296366

 
n/a

Avantar1975



Registered
  01/12/2011
Points
  39
21st January, 2013 at 21/01/2013 22:10:49 -

Yes, this would work in normal circumstances: I have tried it before posting - seems like centering the screen to anything does not work when using:

If FrameWinXSize("WinControl")<>ClientWidth("WinControl") then set width of Frame Window = Horizontal size of ClientArea
then the same for the hight

"Resize to screen size" is also ticked on the frame. This all to make sure the application can be used with multiple reolutions. Even if you do make the frame size bigger than the ClientWidth - it still doesn't work.(Any centering on any object through scrolling)

Some tournament brackets(the "maps" I refered to) are possibly bigger than most LCD monitors and therefore it would be super if my app can fit any resolution, scaled niceley and be able to scroll the "map". So far it looks to me that I am able to do either or, but not both.

Thanks for the suggestions.

Ps. I also tried this: http://www.create-games.com/forum_post.asp?id=296366

 
n/a
   

Post Reply



 



Advertisement

Worth A Click