Sign in to follow this  
Guest darrenecm

Question on drawing gauge

Recommended Posts

Hey guys, I found the problem with the bad frame rates on my gauges, but the solution is harder. I am trying to make a pop up of the gauge(PFD) but I need to determine which gauge is drawn in order to disable the gauge on the main panel when the pop up gauge is on. What I need to find out is which gauge is drawn, but I have no clue on how to figure that out. Thank you very much for your help.Sincerely,Tiberiu Brasov

Share this post


Link to post
Share on other sites
Help AVSIM continue to serve you!
Please donate today!

You can use the is_panel_window_visible_ident function (defined in the FS9 version of GAUGES.H) to determine if your popup window is open.Doug

Share this post


Link to post
Share on other sites

Doug, Thank you very much for your reply, but I need to figure which gauge is drawn, in order to stop the draw process for the main panel bitmap. If I do not know that and stop the draw process when the pop up is opened, then both gauges will be off, which is not what I want. Thanks for your help!Yours Truly,Tiberiu Brasov

Share this post


Link to post
Share on other sites

Well OK... How about this:Code in PANEL_SERVICE_PRE_DRAW is only executed when the gauge is actually on the screen. Share a variable in the pop-up gauge. In the PRE_DRAW section of that gauge, toggle the value back and forth between two values - something like:shared_variable = shared_variable * -1;In the PANEL_SERVICE_PRE_DRAW section of the other gauge, you can test this variable against the value it had on the last frame. If the value is the same, it is because the pop-up gauge is not being drawn. If the value is different it is because it is being changed by the pop-up gauge - thus indicating that that gauge is being drawn.Keep in mind that this test must be done in PANEL_SERVICE_PRE_DRAW, so that it is performed at the same frequency that the variable is changing.Doug

Share this post


Link to post
Share on other sites

Doug, Thanks for your reply, but this is not what I need. The same gauge is getting called in the pop up as the one on the main panel. Meaning that I do not have two different gauges compiled, but just one, being called a second time. I guess that you understood me wrong.Yours Truly,Tiberiu Brasov

Share this post


Link to post
Share on other sites

I've yet to get a total understanding of the way gauge code is structured, I'm still working on GDI+ and DirectX, but might I suggest the following:Wouldn't your fixed and pop-up gauge displays each have a different graphics device context handle (hdc)? If so you could adjust your gauge drawing code to differentiate between drawing to one and not to the other?- Darren

Share this post


Link to post
Share on other sites

Darren, Thank you very much for your reply! Indeed, they have different hdc, and that is the solution to my problem. Thank you so much for your help. How is the implementation with DirectX in a gauge going?Yours Truly,Tiberiu Brasov

Share this post


Link to post
Share on other sites

Blimey it seems my constant attempts at trying to fathom the Panel SDK is starting to sink in if my subconscious can summon up a theoretical solution to try that actually works :)As for DirectX, I've put together a standalone Windows Win32 shell that allows me to open up a Direct3D window as well as easily start and stop GDI+ drawing features. Once I've got a grip on the basics of both API's I can then turn my attention to seeing how easy it is for GDI+ and DirectX to inter-operate. I'm still at the experimental stage and find myself regularly scratching my head when trying to get certain things drawing on the screen as described in the DirectX SDK, but I'm slowly getting there.I was hoping to use the Netpipes SDK to allow me to bring in all the FS2004 variables to possibly drive some of the graphics in this application shell, but I've discovered that Netpipes is practically worthless and seems to only support a small sub-set of all the token variables as described in the SDK.However, my subconscious did summon up another possible alternative to getting at these variables by creating a kind of 'dummy' gauge that has no graphics and isn't visible. All it would do is constantly query the variables I'm interested in and then 'transmit' the data via some network protocol (maybe a socket) so my application get get at 'em. That's the theory anyway, I'm a long ways off doing that as I've not even read up on network protocols and Socket programming yet. If only there were more hours in a day ;)- Darren

Share this post


Link to post
Share on other sites

True, FSUIPC certainly does offer easier and greater access to variables (including writing to them I hear). To make use of FSUIPC in a commercial situation though I believe you have to register your application / add-on so that it will work with unregistered versions of FSUIPC that many users may have installed in their Flight Simulator setup?Besides, putting myself through the process of re-inventing that proverbial wheel will be good practice for me in getting my head around the entire gauge DLL system...I'm a glutton for punishment like that see :)That said I'll be looking at FSUIPC in detail eventually as it will no doubt become useful in later more complex projects I may dream up ;)- Darren

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