SDK Question How to get VC MFD resolution?

BrianJ

Addon Developer
Addon Developer
Joined
Apr 19, 2008
Messages
1,678
Reaction score
902
Points
128
Location
Code 347
Hello,
I'm trying to get the MFD button labelling display in my Virtual Cockpit to be correct for any of the MFD resolution options of 256 / 512 / 1024.

I have this bit of code I stole from Atlantis.cpp that determines where the button labels are written on the MFD display when you press [SEL] button.

In clbkLoadVC section I have....

Code:
static EXTMFDSPEC mfds = { // common MFD specs
        {0,0,0,0},          // pos
        nmesh,            // nmesh
        0,                  // ngroup (to be filled)
        MFD_SHOWMODELABELS, // flag
        6, 6,               // nbt1, nbt2
        (int)(256/6), (int)(256/7)        // bt_yofs, bt_ydist
     };
This works for MFD resolution 256, but not higher.
(The Atlantis.cpp used 512, and it works for that resolution but not 256 or 1024)

Question: Is there a way to get the MFD resolution in the OrbiterAPI?

I guess I could check the Orbiter.cfg and Orbiter_NG.cfg for the "VCMfdSize = xxx" line and use that - but is there an easier way in the API?

Many thanks,
Brian
 

GLS

Well-known member
Orbiter Contributor
Addon Developer
Joined
Mar 22, 2008
Messages
5,914
Reaction score
2,908
Points
188
Website
github.com
Hello,
I'm trying to get the MFD button labelling display in my Virtual Cockpit to be correct for any of the MFD resolution options of 256 / 512 / 1024.

I have this bit of code I stole from Atlantis.cpp that determines where the button labels are written on the MFD display when you press [SEL] button.

In clbkLoadVC section I have....

Code:
static EXTMFDSPEC mfds = { // common MFD specs
        {0,0,0,0},          // pos
        nmesh,            // nmesh
        0,                  // ngroup (to be filled)
        MFD_SHOWMODELABELS, // flag
        6, 6,               // nbt1, nbt2
        (int)(256/6), (int)(256/7)        // bt_yofs, bt_ydist
     };
This works for MFD resolution 256, but not higher.
(The Atlantis.cpp used 512, and it works for that resolution but not 256 or 1024)

Question: Is there a way to get the MFD resolution in the OrbiterAPI?

I guess I could check the Orbiter.cfg and Orbiter_NG.cfg for the "VCMfdSize = xxx" line and use that - but is there an easier way in the API?

Many thanks,
Brian

Actually, I found that the other day by accident. :lol:
In Graphics.h
Code:
const void *GetConfigParam (DWORD paramtype) const;
#define CFGPRM_PANELMFDHUDSIZE 0x001A
Never tried it, but should work. :shrug:
 

Urwumpe

Not funny anymore
Addon Developer
Donator
Joined
Feb 6, 2008
Messages
37,605
Reaction score
2,327
Points
203
Location
Wolfsburg
Preferred Pronouns
Sire
Of course, you could also look at the constructor of a MFD. The width and height of the MFD surface are passed as parameters there.
 

BrianJ

Addon Developer
Addon Developer
Joined
Apr 19, 2008
Messages
1,678
Reaction score
902
Points
128
Location
Code 347
Thanks so much for the pointers! I'm not quite there yet though....



Actually, I found that the other day by accident. :lol:
In Graphics.h
Code:
const void *GetConfigParam (DWORD paramtype) const;
#define CFGPRM_PANELMFDHUDSIZE 0x001A
Never tried it, but should work. :shrug:
I added the GraphicsAPI.h in to my headers list:
Code:
#include "GraphicsAPI.h"
and I tried the sample code in the GraphicsAPI.h comments, in my clbkSetClassCaps section:
Code:
double lightscale = *(double*)GetConfigParam (CFGPRM_SURFACELIGHTBRT);
But my compiler says GetConfigParam is undefined.
Any further pointers? I feel I should be adding a .lib somewhere :-D


Of course, you could also look at the constructor of a MFD. The width and height of the MFD surface are passed as parameters there.
I don't know what an "MFD constructor" looks like, but knowing that it exists is a step closer to finding it ;-)


Thanks again, guys,
Brian
 

GLS

Well-known member
Orbiter Contributor
Addon Developer
Joined
Mar 22, 2008
Messages
5,914
Reaction score
2,908
Points
188
Website
github.com
Thanks so much for the pointers! I'm not quite there yet though....




I added the GraphicsAPI.h in to my headers list:
Code:
#include "GraphicsAPI.h"
and I tried the sample code in the GraphicsAPI.h comments, in my clbkSetClassCaps section:
Code:
double lightscale = *(double*)GetConfigParam (CFGPRM_SURFACELIGHTBRT);
But my compiler says GetConfigParam is undefined.
Any further pointers? I feel I should be adding a .lib somewhere :-D

It is in "orbiter.lib". So you need to go to the project properties, select "all configurations" on the top, then find Linker, Input, and add orbiter.lib to Additional Dependecies




I don't know what an "MFD constructor" looks like, but knowing that it exists is a step closer to finding it ;-)
When you create and MFD, it's constructor is called, and the size is one of the arguments.
 

BrianJ

Addon Developer
Addon Developer
Joined
Apr 19, 2008
Messages
1,678
Reaction score
902
Points
128
Location
Code 347
It is in "orbiter.lib". So you need to go to the project properties, select "all configurations" on the top, then find Linker, Input, and add orbiter.lib to Additional Dependecies

When you create and MFD, it's constructor is called, and the size is one of the arguments.
Thanks so much, but it still won't recognise GetConfigParam :-(


Anyway, I got a solution the stupid clunky way, by checking the .cfg files.
20 lines of code instead of 2, probably but never mind :) It works.


Thanks again,
Brian
 

GLS

Well-known member
Orbiter Contributor
Addon Developer
Joined
Mar 22, 2008
Messages
5,914
Reaction score
2,908
Points
188
Website
github.com
Oh, that's because it is a member of the GraphicsClient class.... :uhh: that's what I gain by not having opened VS to look it up... sorry :facepalm:
It's probably meant only for graphics clients. :shrug:
 
Top