Jump to content
Sign in to follow this  
rfresh737

Read/Write zoom value?

Recommended Posts

I've look in the SDK but can't find a call to read the current VC zoom level setting...is there a way to read it?

 

I also would like to set a VC zoom value and am wondering if this possible as well?

 

Thanks...

 

Share this post


Link to post
Share on other sites

So, this is what I've learned so far in case others are interested in this topic:

 

1. Microsoft didn't provide a way to read or get the current zoom level in SimConnect.  Period.

 

2. There is only one call constant (ZOOM1_X) to set the zoom level.  I'm programming in C# but I'll bet the C++ header file for this constant == 64. This constant sets the zoom level to 1.0.

 

3. While there is only one documented constant (ZOOM1_X)...you can send any integer value and get incremental zoom levels.  For example, send 32 to get .5 zoom level.

 

So, I guess I've now answered my own question.

Share this post


Link to post
Share on other sites
I'm wondering if someone could help me with actually implementing this 1.0 zoom level?
 
I'm doing this in C# and here is my code...I'm just trying to do a button click to set the zoom level but my code isn't working. I'm not sure where the problem is.
 
Thanks for any help.
 
        enum EVENTS : uint
        {
            ZOOM_1X,
        };

 

simconnect.MapClientEventToSimEvent(EVENTS.ZOOM_1X, "ZOOM_1X");

 

simconnect.TransmitClientEvent((uint)SimConnect.SIMCONNECT_OBJECT_ID_USER, EVENTS.ZOOM_1X, (uint)0, INPUT_GROUPS.INPUT0, SIMCONNECT_EVENT_FLAG.GROUPID_IS_PRIORITY);

Share this post


Link to post
Share on other sites

I know this is old, but this was helpful, and I figured out how to make the above examples work:

 

enum EVENT_ID
{
     ZOOM_1X
}
simconnect.TransmitClientEvent(SimConnect.SIMCONNECT_OBJECT_ID_USER, EVENT_ID.ZOOM_1X, 0, GROUP_ID.GROUP1, SIMCONNECT_EVENT_FLAG.GROUPID_IS_PRIORITY);

I didn't cast anything and my enums are not uint derived. Not sure if that makes any difference but it works for me.

 

I also figured out how to do more than just set the zoom to 1X. There are other zoom events. Specifically ZOOM_IN and ZOOM_OUT, except that they are backwards. ZOOM_IN zooms out and ZOOM_OUT actually zooms in.
 

enum EVENT_ID
{
    ZOOM_IN,
    ZOOM_OUT
}


//DEFINE EVENT
simconnect.MapClientEventToSimEvent(EVENT_ID.ZOOM_IN, "ZOOM_OUT");
simconnect.MapClientEventToSimEvent(EVENT_ID.ZOOM_OUT, "ZOOM_IN");

//TRIGGER EVENTS
simconnect.TransmitClientEvent(SimConnect.SIMCONNECT_OBJECT_ID_USER, EVENT_ID.ZOOM_IN, 0, GROUP_ID.GROUP1, SIMCONNECT_EVENT_FLAG.GROUPID_IS_PRIORITY);
simconnect.TransmitClientEvent(SimConnect.SIMCONNECT_OBJECT_ID_USER, EVENT_ID.ZOOM_OUT, 0, GROUP_ID.GROUP1, SIMCONNECT_EVENT_FLAG.GROUPID_IS_PRIORITY);

 

To get to .3x zoom, just set the zoom to 1X, then zoom out a few times (7 times, to be exact).

 

Hopefully this helps some people!

Share this post


Link to post
Share on other sites

Nah, you don't do it like that. That's tedious.

You do it like this using the secret event:

P3D_simconnect.MapClientEventToSimEvent(EVENT_ID.EVENT_ZoomSet, "VIEW_ZOOM_SET")
P3D_simconnect.TransmitClientEvent(DEFINITIONS.Struct1, EVENT_ID.EVENT_ZoomSet, ZoomLevel * 64, hSimconnect.Group1, SIMCONNECT_EVENT_FLAG.GROUPID_IS_PRIORITY)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Tom Allensworth,
    Founder of AVSIM Online


  • Flight Simulation's Premier Resource!

    AVSIM is a free service to the flight simulation community. AVSIM is staffed completely by volunteers and all funds donated to AVSIM go directly back to supporting the community. Your donation here helps to pay our bandwidth costs, emergency funding, and other general costs that crop up from time to time. Thank you for your support!

    Click here for more information and to see all donations year to date.
×
×
  • Create New...