SDK Question [solved] Screen size

Goth

Occasional orbinaut
Donator
Joined
Aug 1, 2008
Messages
424
Reaction score
2
Points
0
How do you get Orbiter's screen size?
opcOpenRenderViewport is outdated and doesn't work anymore either.
 
Last edited:

meson800

Addon Developer
Addon Developer
Donator
Joined
Aug 6, 2011
Messages
405
Reaction score
2
Points
18
I'm not sure if there is an Orbiter way to do it, but the Windows way to do it would be as follows:
1. Find the main orbiter HWND. Not sure how to do this, but Face did something similar in his OMP client here
2. Once you have the HWND, you can find the resolution by doing
Code:
  RECT orbiterResolution;
   // handle to Orbiter, found by some function
   const HWND hOrbiterWindow;
   GetWindowRect(hOrbiterWindow, &orbiterResolution);
   // The top left corner will have coordinates (0,0)
   // and the bottom right corner will have coordinates
   // (horizontal, vertical)
   int horizontal = desktop.right;
   int vertical = desktop.bottom;
 

orb

New member
News Reporter
Joined
Oct 30, 2009
Messages
14,020
Reaction score
4
Points
0
How is opcOpenRenderViewport not working anymore?
 

Goth

Occasional orbinaut
Donator
Joined
Aug 1, 2008
Messages
424
Reaction score
2
Points
0
How is opcOpenRenderViewport not working anymore?
Ok this was my problem:
opcOpenRenderViewport is called by Orbiter only if no instance of oapi::Module is created and registered during InitModule, or if a registered module does not overload the oapi::Module::clbkSimulationStart method.
You can't have both things. So I'll just comment out the Module class and use opcOpenRenderViewport for now.
 

asbjos

tuanibrO
Addon Developer
Joined
Jun 22, 2011
Messages
696
Reaction score
259
Points
78
Location
This place called "home".
Code:
oapiGetViewportSize (&ScreenWidth, &ScreenHeight, &ScreenColour);

It's on page 49 in the API_Reference.pdf.
 
Top