Jump to content
Sign in to follow this  
badderjet

Guru call... intermediate / advanced C info needed...

Recommended Posts

Guest Vorlin

Hi all,Life's been crazy... shoulder injury, new aircraft project, physical therapy and light duty at work during our busiest season...Anywho, to get to the point, I have what's more of a question on how to strategically approach an issue in C than a simple coding question.Here's the deal:I made this nice gauge set in XML... with some new features that are pretty close to revolutionary in the realm of freeware (though payware may already be doing something similar). We'll be releasing it with restrictions on re-using the gauges. I can easily arrange for them to be disabled if they're moved, that's not the issue.The issue is that the new features use a case statement that selects one of ten different bitmaps, depending on the results of a formula that checks for certain conditions. Writing the C to do this is easy, for any one gau file...What about for twelve gau files?The issue is that in XML the ten bmp files are listed once, and only once, and then twelve different XML files all use the same image resources. This means that the extra resources amount to about 900k. However, with the 4mb choke point on gau files, I'm forced to have no more than 3 or 4 gauges in any given gau file... which means I'm having to repeat all ten bmp's in each new dll.So, instead of 900k, I'm now facing 3.6M if I use only 4 gau files... and I may need to use 5 or 6 at the rate things are going so that would take it out to 5.4M.Now, we all know that 5.4M, or even 3.6M, just to have some nice new feature is totally unacceptable. It's a performance hit from #### (sorry, Bill).What I'm looking to do is have these extra resources (these images) in one place and one place only... and call them from each gauge. Is it possible to lay a gauge over another gauge if the top gauge is semi-transparent? Or, is it possible for one gauge to call another gauge dynamically? IE: Gauge2 is glass, gauge1 is background and bezel. Gauge1 has a pelement list that lays down the background, calls gauge2 and then lays the bezel an it's mask over gauge2.... without including gauge2's code in gauge1's executable code the way called macros from include files are written out completely in the compiled code?Without the ability to call them in, I'm stuck repeating the same images many times over... a serious waste of resources.All help and ideas greatly appreciated.Thanks,Scott / Vorlin

Share this post


Link to post
Share on other sites
Guest bartels

The same set of images for each gauge? Reuse the bitmap id's for the gauges, then you need the set only one time in the resource file.

Share this post


Link to post
Share on other sites
Guest Vorlin

Arne,Either I'm not understanding or maybe I wasn't clear. I'm creating multiple gau files (dll's) but only want the images to be part of the code of one of them... and then call them into the other gau files at runtime.From your reply, I'm wondering if images can be shared between C guages in a way that is similar to sharing L:Vars in xml guages.Are all the gau's loaded into memory as one big collection of code that has the ability to use resources and functions by calling them in by name (or resource id) regardless of which gau (dll) they actually were packaged in???*********EDIT: If the above is true, then I could simply create one or two gau files that contain all the images for this gauge set but no code, then one other gau file could contain all the written code for all gauges (since executable code is so much smaller than bmp resources in memory). Ok, this is a nice idea but I'm beginning to confuse myself about how that would be accomplished! I'll just wait to see what you and others say...*********This has to be one of those things that is simple in principal but confusing for the C novice.... Thanks for helping, I must be missing some detail somewhere and once I understand that, I think this will all become clear to me.Scott / Vorlin

Share this post


Link to post
Share on other sites

Ok... what you want to do is possible, but not easy.You would have to load the .gau file using such calls as GetModuleHandle and LoadLibrary. You'd have to use the handle to load the bitmap resources.This would allow you to load bitmaps from another gauge... assuming the .gau file is where you 'expect' it to be. Which reveals the major weakness... if your .gau file were removed or moved, then none of your gauges would work and instead quite probably crash the sim.


Ed Wilson

Mindstar Aviation
My Playland - I69

Share this post


Link to post
Share on other sites

>However, with the 4mb choke point on gau>files, I'm forced to have no more than 3 or 4 gauges in any>given gau file... which means I'm having to repeat all ten>bmp's in each new dll.Er, what "4mb choke point?" I've got more than one gauge over 11mb...iFly747-400.gau is nearly 47mb!!!


Fr. Bill    

AOPA Member: 07141481 AARP Member: 3209010556


     Avsim Board of Directors | Avsim Forums Moderator

Share this post


Link to post
Share on other sites
Guest bartels

Why not a multigauge which resource parts holds all bitmaps, that also has a bunch of subgauges that use these bitmaps? Then different subgauges can reuse the same bitmaps. Not really revolunatery, but simple stock C-programming. Loading from external resources is of course possible, but absolutely not worth the effort.

Share this post


Link to post
Share on other sites
Guest Mathias

>Why not a multigauge which resource parts holds all bitmaps,>that also has a bunch of subgauges that use these bitmaps?>Then different subgauges can reuse the same bitmaps. Not>really revolunatery, but simple stock C-programming. Loading>from external resources is of course possible, but absolutely>not worth the effort.Arne beat me to it. Since FS2000 it is possible to program cluster gauges that just have one set of bitmaps that can be used in multiple sub-gauges. This

Share this post


Link to post
Share on other sites

There is a very simple and clear tutorial at http://flightsim.com in the Panel & Gauges forum that should help you get the hang of building a multi-gauge cluster... ;)


Fr. Bill    

AOPA Member: 07141481 AARP Member: 3209010556


     Avsim Board of Directors | Avsim Forums Moderator

Share this post


Link to post
Share on other sites
Guest Vorlin

Ok, I do know about multigauges and that is what one would assume to be the way to go... but I was under the impression that gau files over 4 meg in size were unstable. From replies above, I'm beginning to think that this is an old wive's tale.In which case, I can just make a multigauge and be done with it.Scott / Vorlin

Share this post


Link to post
Share on other sites
Guest iholrf

>>However, with the 4mb choke point on gau>>files, I'm forced to have no more than 3 or 4 gauges in any>>given gau file... which means I'm having to repeat all ten>>bmp's in each new dll.>>Er, what "4mb choke point?" I've got more than one gauge over>11mb...>>iFly747-400.gau is nearly 47mb!!!is it really? Holy crap! Dat 'splains much lucy.

Share this post


Link to post
Share on other sites
Guest FS-boy

Scott, For what it's worth, I have a gauge cluster (single .dll) that is over 10 MB in size. It loads and runs great. I'd say that the stability of loading and running large gauges depends on the configuration of your computer. Bill

Share this post


Link to post
Share on other sites

>Ok, I do know about multigauges and that is what one would>assume to be the way to go... but I was under the impression>that gau files over 4 meg in size were unstable. From replies>above, I'm beginning to think that this is an old wive's>tale.Wonder where you got that magic number of 4 megs... Uhm. *:-* Well there are payware gauges out there exceeding 50 or 60 with ease. :-)So go for a simple, usual, absolute standard multi gauge containing all of your bitmaps once and all of the sub gauges being able to use them. :-smooch

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  

  • Tom Allensworth,
    Founder of AVSIM Online


  • Flight Simulation's Premier Resource!

    AVSIM is a free service to the flight simulation community. AVSIM is staffed completely by volunteers and all funds donated to AVSIM go directly back to supporting the community. Your donation here helps to pay our bandwidth costs, emergency funding, and other general costs that crop up from time to time. Thank you for your support!

    Click here for more information and to see all donations year to date.
×
×
  • Create New...