Board index FlightGear Development Canvas

FGPanel from CANVAS idea

Canvas is FlightGear's new fully scriptable 2D drawing system that will allow you to easily create new instruments, HUDs and even GUI dialogs and custom GUI widgets, without having to write C++ code and without having to rebuild FlightGear.

FGPanel from CANVAS idea

Postby diande » Sat Jul 13, 2013 8:34 pm

Can I make CANVAS span to the entire screen - something like in the picture below, but to take the hole screen and draw my instruments on it - so I can achieve the effect from the IFR Cessna, but be able to implement a PFD. The main idea is to link it after that to a master simulation and have my self an external PFD.

Image
diande
 
Posts: 17
Joined: Sat Jul 06, 2013 3:50 pm

Re: FGPanel from CANVAS idea

Postby Hooray » Sat Jul 13, 2013 8:39 pm

yes, you would want to take a look at the full-screen IFR panel that you mentioned, and then just replace the instruments with a single canvas instrument, and then hide the menubar - and you'd have a full-screen 2D panel with a canvas region, which you can then populate with all required displays.

The other option would be using a GUI dialog/window to show all instruments - to the canvas, it doesn't matter how it is shown, it's just a placement mode, nothing else.
Please don't send support requests by PM, instead post your questions on the forum so that all users can contribute and benefit
Thanks & all the best,
Hooray
Help write next month's newsletter !
pui2canvas | MapStructure | Canvas Development | Programming resources
Hooray
 
Posts: 11427
Joined: Tue Mar 25, 2008 8:40 am

Re: FGPanel from CANVAS idea

Postby diande » Sat Jul 13, 2013 8:43 pm

Hooray, you are awesome :) You help me a lot. Thanks for that!
I started this morning working with FG. Can you guide me how can I replace the IFR panlel with a single Canvas sprite? Will it stretch automatically, or I need to set a fixed resolution for it?
diande
 
Posts: 17
Joined: Sat Jul 06, 2013 3:50 pm

Re: FGPanel from CANVAS idea

Postby Hooray » Sat Jul 13, 2013 8:53 pm

for starters, you would probably want to set the width/height attributes to your screen resolution - either in the 2D panel, or in the GUI dialog. The texture itself can be dynamically resized, and could theoretically read the resolution from the property tree, but I don't think that the panel or dialog can be automatically stretched according to screen resolution, I *think* these are not "live" properties, they can only be affected through editing the XML file.

For example, check out $FG_ROOT/Aircraft/c172p/ panel-only: http://mapserver.flightgear.org/git/?p= ... 64;hb=HEAD

You can see that there are two panel references - named "panel", and "panel_2".

The path to the default panel is: Aircraft/c172p/Panels/c172-610x-panel.xml

Next, you go into the panels directory: http://mapserver.flightgear.org/git/?p= ... d4;hb=HEAD

And you'll see that the panel dimensions are specified there: http://mapserver.flightgear.org/git/?p= ... b=HEAD#l38

(w=width, h=height) - 1024x768

I would suggest to simply copy that stuff and remove everything that you don't need - (just disable it via XML comments), and next, you'd want to add a canvas region with the proper dimensions - for an example, see the c172p-canvas-set.xml file (I think it uses a 3D model). Because the demo uses a 3D model, you should check out the wiki for placing a canvas onto a 2D panel: http://wiki.flightgear.org/Howto:Add_a_ ... r_aircraft
Please don't send support requests by PM, instead post your questions on the forum so that all users can contribute and benefit
Thanks & all the best,
Hooray
Help write next month's newsletter !
pui2canvas | MapStructure | Canvas Development | Programming resources
Hooray
 
Posts: 11427
Joined: Tue Mar 25, 2008 8:40 am

Re: FGPanel from CANVAS idea

Postby Hooray » Sat Jul 13, 2013 9:01 pm

Thinking about it, the GUI/dialog route may actually be more flexible than the panel-route that I described above - simply because the 2D panel code is basically unmaintained currently - but the GUI option is actively developed by Tom, with all his latest work on event handling, I think it would be a more future-proof option to use a fullscreen "dialog" or canvas window and use that to render your PFD.

But again, it shouldn't matter 90% of the time, because all your PFD stuff will be implemented in Nasal space anyhow, so the dialog or the 2D panel are just placements - and it should not take much longer than a couple of minutes to switch between dialog<->2D panel.

Even though I described the 2D panel route, I believe native canvas windows are a better option, and they should also be able to go into fullscreen mode automatically, just by reading the /sim/startup/x-size and y-size properties

Ideally, you'll be able to use FG 2.10 or even directly switch to 2.12 once it is released

EDIT: I added a little example to the wiki: http://wiki.flightgear.org/Howto:Creati ... ns#Example
If you think, that's useful, please feel invited to contribute to the article with your own code snippets.
Please don't send support requests by PM, instead post your questions on the forum so that all users can contribute and benefit
Thanks & all the best,
Hooray
Help write next month's newsletter !
pui2canvas | MapStructure | Canvas Development | Programming resources
Hooray
 
Posts: 11427
Joined: Tue Mar 25, 2008 8:40 am


Return to Canvas

Who is online

Users browsing this forum: No registered users and 1 guest