GAUGES POWER IS AMAZING

Klein

Members +
I invite everybody to share about problems or solutions to have "C" gauges working fine, so here is the first note on how to show and hide an image in a gauge, after many "trials and errors".

The macro to use to show/hide an image within a gauge is MAKE_ICON, if you have a look at the sample gauge from the FS2kSDK, the relevant example is the "SDK.Fuel_Selector.c", and in the old FS98SDK, the example is "SDK.magnetos.c."

Both are a bit confusing, explaining how to show an image between others, but nothing is said on how to show and hide a unique image.

Dai Griffiths shows a fine way to do it in his tutorials serie, I highly recommend his tutorials study, I wouldn't have succeeded on anything without it, see "SHOW/HIDE Macros" for that, but the way he does it needs the implementation of "SHOW_LISTELEMENT" and "HIDE_LISTELEMENT" in the gauges.h file, and that's not in the gauges.h from the FS2kSDK, there is somehow several meanings to do it using the original gauges.h

The return awaited for a single image to show in a MAKE_ICON macro is "0", that's the default value if you don't set up a gauge callback, the image name for value 0 is defined in the macro on line 2. if there are several images to show, the next is 1, 2, 3, etc... and the order is defined in the .h file, with intervals between images numbers of 1, in hexadecimal, so when you'll have image 1009, the next one must be 100A, then 100B, 100C, 100D,100E, 100F, and only now 1010.

Suppose you want all the images to be hidden, you can act in the icon-callback, returning -1 or any negative value, or you can define a flag for the entire macro to be hidden ( "HIDE_IMAGE(pelement)" and "SHOW_IMAGE(pelement)" )

Here is in a zip a sample of left and right magnetos as they are on a Sopwith Tripe panel, using only three bitmaps, with the different files and a gauge sample, and only three images:
-the background with the states "off" for both mags
-a left "on" image for the left mag
-a right "on" image for the right mag
The macro for the left mag uses the first meaning, and the one for the right mag the second.

Perhaps I believe I re-invented the wheel ? let me know ;)

cheers
Martin :jump:
 

Attachments

  • sopwith_mags.zip
    86.3 KB · Views: 3
This is such a fine thing to do, Martin. I was working on code cleanup and now documentation for a complete source upload all last night. It's just a simple MAKE_MOVING type but I feel it is instructive and I have beefed up the comments targeting a beginner. Also, as you know, I have some particular "style" elements that I feel will be helpful

I have requested permission to include the art work for two different gauges I made for a fellow SOH member a while back. Only the code is "mine". I hope to upload them soon.

I'm going to get to rewriting my gauge logging code as it is not "ready for prime time". I want it be in a seperate file and I'm thinking as a dot lib binary. One could use a command line switch to turn it on and off for minimal intrusion into another's code. I also want full Windows error checking on the fopen(), fprintf() ect. as this is just good practice. There's some real c Windows coding here but it's all in my hard drive. Include the source - why not - someone may want to tinker with it.

It's typically too quite over at this forum but let's see if we can't light it up a bit.

I have not made a gauge as you describe so I look forward to checking out you approach.

Mike
 
What do you all think of the idea of using the BMPs from stock M$ gauges and redoing the programming behind them?
I have done that on occasion as with some engine gauges for Aleatorylamp's FW 200. He needed multi engine gauges for a 4 engine bomber and I just pulled the BMPs from the stock CFS1 German fighters which of course only have "Engine1".

- Ivan.
 
On my opinion, it musn't be a problem to re-use the stock BMPs, I did it by example for the Curtiss Jenny conversion from FS2004 to CFS2, where I tried to re-write the XML code to a C code, re-using the stock images, for the panel to be the closest possible to the original one.
When the West Front Team converted Stuart Green's FS2004 WW1 planes to CFS2, I re-used the original bitmaps too, I consider it's an important step in a plane conversion to convert the gauges too.
On my point of vue, the stock microsoft BMPs must be considered as being in the public domain, as all planes, sceneries, flight dynamics...

On the sample I used in this thread for show/hide images, the bitmaps are stock sopwith gauge ones

Cheers
Martin
 
As chance would have it had just contacted an Admin on this topic. My newer version of DumpGauges.exe prints out a lot more information. I was using it to examine some Japanese gauges I had downloaded. I noticed one that had been renamed and the original owner was MS. Even though I felt the admins surely had this issue resolved I felt morally obligated to check. Here is the the response ...

"As far as the gauge is concerned MS game content rules allow you to modify and share some of their content. Gauges is one you are free to share. See the rules on line if you feel a need to confirm that information. It used to be under Xbox rules which also cover all versions of Flight Simulator."

So yeah, there is no legal issue. On a personal note you could, of course, mention it in readme. Even though I'm a firm believer in giving credit for others work with MS I have no problem with leaving that credit out.

Btw, this is perhaps obvious but in my experience, giving credit is more than just an ethical issue. I saw it many times in my work career. Person A states a good idea. Person B uses the idea but does not credit Person A. Person A no longer shares his ideas. If one believes we're better off via a group effort, as I do, this is very destructive.

Ivan, that you have voiced this concern is a great credit to you and your character.

Carry on,
Mike
 
Thank you to share your opinion about this sensible subject.
You both open a wide philosofic reflexion on the intellectual rights about what we work on.
On my opinion, but I'm not a legist, Microsoft keeps all intellectual rights on what is done in its simulations, it decided to share more or less these rights by publishing all the SDKs for anyone to interfer on its programs, but this way it puts a part of its work in public domain, that Don't want to say its intellectual rights are not there anymore, but by this way it agrees to share the intellectual rights.
What we do on what's allowed is really very tiny compared to the initial work, but is effective.
Mozart and Beethoven symphonies are in public domain now, that Don't want to tell anybody can say he composed it.

When I converted a gauge for the Albatros DIII Stuart Green's plane, I wrote in the .rc file:

BEGIN
VALUE "CompanyName", "Stuart Green\0"
VALUE "FileDescription", "Flight Simulator 2000 Gauge\0"
VALUE "FileVersion", VERSION_STRING
VALUE "LegalCopyright", "Stuart Green\0"
VALUE "ProductName", "Albatros DIII\0"
VALUE "ProductVersion", VERSION_STRING
END

Later I added a chapter on the Zeppelin Staaken gauges:

BEGIN
VALUE "CompanyName", "Stuart Green\0"
VALUE "FileDescription", "Flight Simulator 2000 Gauge\0"
VALUE "FileVersion", VERSION_STRING
VALUE "LegalCopyright", "Stuart Green\0"
VALUE "Conversion", "Martin Klein\0"
VALUE "ProductName", "Zeppelin Staaken\0"
VALUE "ProductVersion", VERSION_STRING
END

Everybody stays free to add, or not to add, such details.

I've the great chance to share projects with the West Front Team, for several years, with people who became pals as time goes by, often when a project is ready to be uploaded, we don't remember really who did what, but it's not too much a problem, what is important is to share.

Cheers
Martin
 
Back
Top