Jump to content
Sign in to follow this  
n4gix

How To program XML to C Interfaces

Recommended Posts

Guest bartels

Hi all of you,basing on the work of Andreas Drawe I wrote a bit down to implement FS9-modules with "C:...:..." style interfaces to XML gauges just like e.g. C:fs9gps:.... or C:fsview:view.Arne Bartels

Share this post


Link to post
Share on other sites

Shucks, I got all excited because I misread your post...I thought you'd discovered a way to implement some "XML only" functions in C guages......such as loading the terrain map the XML GPS can display... ;(


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

Don't you think this way round is not interesting enough <g>? And please have a bit of patience. The other way round is under development .Arne Bartels

Share this post


Link to post
Share on other sites
Guest Eugen

Hi Arne,Could this be a way to have variables for strings, the L-var:string doesn't work in xml as you know.Eugen

Share this post


Link to post
Share on other sites
Guest bartels

Yes. E.g. C:xmlinterface:stringval of the example module is read/writeable.Arne Bartels

Share this post


Link to post
Share on other sites
Guest Eugen

Arne,Could you create "Str-Vars" in xml like you do with L-vars or do they need to be declarated in the c-module ?Eugen

Share this post


Link to post
Share on other sites

>Don't you think this way round is not interesting enough>? And please have a bit of patience. The other way>round is under development .Thanks, Arne... If I were into XML gauge coding, yes it would be "interesting enough..." ;)As I am hoping to include the "terrain map" in a GDI+ version of the Garmin G1000 (as well as the Avidyne Entegra Ike Slack is working on), that is of more immediate interest. ;)


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

Unfortunetaely I didn't get it to work properly. Here is a bit of sample code. Usage: add ALL .cpp files, but ONLY CCustomDraw.rc as rc file to a new gauge project. "CCustomDraw!custom" is a C implementation of the GDI drawing in my above mentioned example, it works. No wonder, since I set up the methods "on the other side", so I exactly new which parmaters were needed."CCustomDraw!fs9view" implements the "C:fs9view:view" method. It does work in a way, but the position data relative to the FS window is needed. All I could get was the position relative to the panel bitmap, so there is usually an offset to the view (if the panel bitmap isn't upper left aligned). Note: it isn't GDI, it is a new view window at the gauges place, therefore no combination with GDI is psossible."CCustomDraw!fs9gps" implements "C:fs9gps:Rose", it looks wierd, some parameters aren't fixed yet, but at least it shows up. I wanted to implement C:fs9gps:Map, but didn't succeed (IGaugeCDrawable::Draw alwasy returns FALSE, and nothing shows up). If anyone wants to play with it....Arne Bartels

Share this post


Link to post
Share on other sites
Guest bartels

I declared them in C module, that was the point of the exercise.Arne Bartels

Share this post


Link to post
Share on other sites

>I wanted to implement C:fs9gps:Map, but didn't succeed>(IGaugeCDrawable::Draw alwasy returns FALSE, and nothing shows>up). If anyone wants to play with it....>Arne BartelsThanks, Arne. I'll take a close look at this and see if there's any hope for what we'd like to achieve, although it seems already that it will not be possible... ;(We may have to implement "Plan B" whereby we access and display external georeferenced bitmaps, such as is done by FSM Moving Map...


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

Maybe not imporssible, but still something missing. I noticed that C:fs9gps:Map uses some more flags via IGaugeCDrawable::GetFlags(). The other have only TAKES_DC or nothing, but this one also uses NO_TRANSPARENCY and DOUBLE_BUFFER. Maybe the drawing element needs extra info or, I used wrong params in the() Draw call. I abandoned, because I don't really need it and I have other things to do, not that it is impossible!Arne Bartels

Share this post


Link to post
Share on other sites

>I abandoned, because I>don't really need it and I have other things to do, not that>it is impossible!Thanks, Arne. I appreciate immensely the information provided thus far. I'm certain that it will be useful either to me or others... ;)I fully understand the limitations of one's time, as I have already far more on my plate than I can easily handle myself. With no less than five projects being simultaneously developed by ESDG (and being involved in some capacity with four of 'em directly!), I have precious little time available myself! ;)Thanks again!


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 drawe

...>As I am hoping to include the "terrain map" in a GDI+ version>of the Garmin G1000 (as well as the Avidyne Entegra Ike Slack>is working on), that is of more immediate interest. ;)>Hi to all of you,it is possible to get the fs9gps working in a C gauge. You'll have to provide your own IGaugeCDrawableCreateParameters and IGaugeCDrawableDrawParameters classes to provide the necessary parameters and link everything together as shown in Arne's examples.In the PANEL_SERVICE_PRE_DRAW event of the gauge callback I use something likeif (timer == 0){ SetupdrawSuccess = pIGCD->SetupDraw(dim_surf, hdc_surf, NULL); GetdrawSuccess = pIGCD->GetDraw(pIGCD_DrawParams);}timer ++;if (timer >= 18){ SET_OFF_SCREEN(pelement_surf); timer = 0;}I don't know if this is the best way but at least it works.I attached a gauge which will show the terrain map and also the AI traffic based on the TrafficInfo.dllhttp://forums.avsim.net/user_files/110228.zipAlexander Drawe

Share this post


Link to post
Share on other sites

>I don't know if this is the best way but at least it works.>I attached a gauge which will show the terrain map and also>the AI traffic based on the TrafficInfo.dll>>http://forums.avsim.net/user_files/110228.zip>>Alexander DraweOutstanding! Would it be possible for you to post the source code for that gauge so I can learn more from it? I'm afraid I'm a bit too "green" to manage on my own... ;)


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

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...