Jump to content

Converting the Gauge Project to Multi-Gauge Format


n4gix

Recommended Posts

This is a continuation of the previous tutorial, which discussed setting up the MSVC++ .NET 2003 IDE for gauge development. In particular, the sample gauge file used in that tutorial will be used in this new installment.

 

Using the gauge code already discussed, I am now going to illustrate the process by which we need to modify the original code such that it will be ready for conversion to a true multi-gauge format.

 

NOTE: I suffer no illusions that this is the "best" way to handle the conversion of Easy Gauge source files to a multi-gauge format! However, it is simple, logical and most importantly, IT WORKS! ;)

 

As a first step, I have created a new subfolder in my gauge project and named it \subgauges. I have moved the xxxG.c file to this new subfolder:

 

[ATTACH=CONFIG]158979[/ATTACH]

 

Now I need to modify the main .c file to show where I've now located the xxxG.c file:

 

http://img247.imageshack.us/img247/3186/cplustut022oy.jpg

 

Next, I need to make the resource id's for this subgauge unique. I have adopted the convention of adding a three-four letter 'prefix' to designate the subgauge's revisions. In this case, MAP_ seems to be a logical choice.

 

Here is the revised .h file:

 

[ATTACH=CONFIG]158980[/ATTACH]

 

Now I'll modify the .rc file:

 

[ATTACH=CONFIG]158981[/ATTACH]

 

The final step in this process is a bit longer and I'll have to use a number of pictures to illustrate the full process. I'll continue this in the next section.

Bill Leaming http://smileys.sur-la-toile.com/repository/Combat/0054.gif

Gauge Programming - 3d Modeling Military Visualizations

Flightsim.com Panels & Gauges Forum Moderator

Flightsim Rig: Intel Core i7-2600K - 8GB DDR3 1333 - EVGA GTX770 4GB - Win7 64bit Home Premium

Development Rig1: Intel Core i7-3770k - 16GB DDR3 - Dual Radeon HD7770 SLI 1GB - Win7 64bit Professional

Development Rig2: Intel Core i7-860 - 8GB DDR3 Corsair - GeForce GTS240 1GB - Win7 64bit Home Premium

NOTE: Unless explicitly stated in the post, everything written by my hand is MY opinion. I do NOT speak for any company, real or imagined...

Link to comment
Share on other sites

Using the same 'prefix' convention, I'll now modify the main gauge source file (xxxG.c) as illustrated in the series of pictures following.

 

I've made ample notes on the pictures, so I'll keep the explanation short... ;)

 

The final step I need to take prior to attempting a new compile of this project is to 'fix' a little path problem with the IDE.

 

If you remember, I added the xxxG.c file to the project and set its Properties to "Excluded from Build." Well, since I've moved that file to a new subfolder, I need to let the IDE know about that move...

 

Highlight the xxxG.c filename and right-click. Choose the "Remove" option to delete the filename. Now, right-click on the "Source Files" again, an choose "Add/Add Existing Item." Navigate to the subgauge folder and highlight the xxxG.c file again.

 

Now, right-click on the xxxG.c filename, and using Properties, set the file to be "Exluded from Build" again.

 

Now I will rebuild the gauge project and check for any errors... Since I was very careful, I have none! Hooray!

 

In the next installment, I'll discuss adding a new subgauge to this project. Once that's done, you should be able to successfully continue adding subgauges until your project is finished.

 

[ATTACH=CONFIG]158982[/ATTACH]

[ATTACH=CONFIG]158983[/ATTACH]

[ATTACH=CONFIG]158984[/ATTACH]

[ATTACH=CONFIG]158985[/ATTACH]

[ATTACH=CONFIG]158986[/ATTACH]

[ATTACH=CONFIG]158987[/ATTACH]

Bill Leaming http://smileys.sur-la-toile.com/repository/Combat/0054.gif

Gauge Programming - 3d Modeling Military Visualizations

Flightsim.com Panels & Gauges Forum Moderator

Flightsim Rig: Intel Core i7-2600K - 8GB DDR3 1333 - EVGA GTX770 4GB - Win7 64bit Home Premium

Development Rig1: Intel Core i7-3770k - 16GB DDR3 - Dual Radeon HD7770 SLI 1GB - Win7 64bit Professional

Development Rig2: Intel Core i7-860 - 8GB DDR3 Corsair - GeForce GTS240 1GB - Win7 64bit Home Premium

NOTE: Unless explicitly stated in the post, everything written by my hand is MY opinion. I do NOT speak for any company, real or imagined...

Link to comment
Share on other sites

Now, I'll add another gauge to the Project to make this a true 'multi-gauge!' ;)

 

First, I copy/paste the existing .c, .h, .rc. and G.c source code to the Project's \subgauges folder:

 

[ATTACH=CONFIG]158995[/ATTACH]

 

Next, copy/paste all the .bmp files to the Project's \res folder:

 

[ATTACH=CONFIG]158996[/ATTACH]

 

Next, open the new gauge's .c file and copy/paste the highlighted entries to the Project's master .c file:

 

[ATTACH=CONFIG]158997[/ATTACH]

[ATTACH=CONFIG]158998[/ATTACH]

 

Next, copy/paste the GAUGE_TABLE_ENTRY line from the x.c file as illustrated. Now you may delete the x.c file from the \subgauges folder to keep things tidy... ;)

 

[ATTACH=CONFIG]158999[/ATTACH]

 

Now, open the x.h file and copy the resource lines to the master .h file as shown below. Add the 'prefix' you want to the RecX entries. Now you may close and delete the x.h file to keep things tidy...

 

[ATTACH=CONFIG]159000[/ATTACH]

 

Now, open the x.rc file and copy the bitmap entries to the master .rc file, and make the edits as shown below. Close the file and delete the x.rc file from the subfolder. There should now only be xG.c files remaining in the \subgauges folder! ;)

 

[ATTACH=CONFIG]159001[/ATTACH]

The last step I'm not going to "illustrate," since it is basically the same thing that's been covered already. You need to edit the xG.c file for the new subgauge to add the 'prefix' as shown previously, and make the other edits & deletions of unnecessary and redundant code.

 

Finally, run Rebuild MyNewGauge and check for errors. If you've been careful, you should have none!

Bill Leaming http://smileys.sur-la-toile.com/repository/Combat/0054.gif

Gauge Programming - 3d Modeling Military Visualizations

Flightsim.com Panels & Gauges Forum Moderator

Flightsim Rig: Intel Core i7-2600K - 8GB DDR3 1333 - EVGA GTX770 4GB - Win7 64bit Home Premium

Development Rig1: Intel Core i7-3770k - 16GB DDR3 - Dual Radeon HD7770 SLI 1GB - Win7 64bit Professional

Development Rig2: Intel Core i7-860 - 8GB DDR3 Corsair - GeForce GTS240 1GB - Win7 64bit Home Premium

NOTE: Unless explicitly stated in the post, everything written by my hand is MY opinion. I do NOT speak for any company, real or imagined...

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...