Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Classic Chat / I met a problem with SetViewZoom();

Author
Message
halley
13
Years of Service
User Offline
Joined: 27th Apr 2011
Location: China
Posted: 6th Jun 2014 06:35
There are two zoom mode, one is top left, another is centre.
But I need zoom by top,right, bottom,left, bottom,right, how should I do? I try to SetViewOffset to move the view. I never success to reach my goal.

The Miracrea Games
Van B
Moderator
22
Years of Service
User Offline
Joined: 8th Oct 2002
Location: Sunnyvale
Posted: 6th Jun 2014 09:47
Whenever I get stumped like this, I tend to add in some main loop controls... like having a zoom in and out control, or have the view offset scroll with the arrow keys and show the actual offset value.

I think it would be better if you do that and try and figure it out, because only you know exactly how it should work.

I am the one who knocks...
Markus
Valued Member
20
Years of Service
User Offline
Joined: 10th Apr 2004
Location: Germany
Posted: 6th Jun 2014 10:51 Edited at: 6th Jun 2014 10:51
u try something like this? just a idea
SetViewZoomMode( 1) //center

at zoom
x=getvirtualwidth()/2
y=getvirtualheight()/2
SetViewOffset( -x, -y )
SetViewZoom( zoom )
SetViewOffset( 0, 0 )

AGK 108 (B)19 : Windows 8.1 Pro 64 Bit : AMD Radeon R7 265
baxslash
Valued Member
Bronze Codemaster
17
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 6th Jun 2014 20:54
In my experience it's best to use the top left and calculate any offsets based on that point. The centred view is a mind bender because it doesn't take view zoom into account. It is based on an unzoomed view when you use setViewOffset.
halley
13
Years of Service
User Offline
Joined: 27th Apr 2011
Location: China
Posted: 7th Jun 2014 12:47
It took me more than 4 hours to solve the problem. I really hope AppGameKit can support zooming by offset.

Now when set view offset, and zoom view by centre mode, the view will move at first, the black screen will appear, and then zoom in. It looks strange. Then I think it over and over, and got a solution finally.
As the following shows, I zoom the view as while as moving the view.




The Miracrea Games

Login to post a reply

Server time is: 2024-11-25 05:28:46
Your offset time is: 2024-11-25 05:28:46