Board index FlightGear Development Canvas

Rally Timer Crashes FG On ubuntu 13.04 Today's GIT  Topic is solved

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.

Rally Timer Crashes FG On ubuntu 13.04 Today's GIT

Postby Michat » Fri May 17, 2013 9:43 pm

Hi, User D-Leon reports me that Rally Timer Crashes FG On ubuntu 13.04 Today's GIT. We need your feedback. No command line alert. FG is loaded, aircraft loaded, and FG freezed. He has more skill than me, he is looking for a solution. I wish to know if someone can report feedback.

Thanks in advance.
User avatar
Michat
 
Posts: 1041
Joined: Mon Jan 25, 2010 6:24 pm
Location: Spain
Version: 191b
OS: GNewSense

Re: Rally Timer Crashes FG On ubuntu 13.04 Today's GIT

Postby Michat » Fri May 17, 2013 9:59 pm

This is the solution he D-LEON proposed.

Code: Select all
var dlg = canvas.Window.new([152,74]);
var my_canvas = dlg.createCanvas()
.setColorBackground(0,0,0);
var root = my_canvas.createGroup();

my_canvas.addEventListener("drag", func(e) { dlg.move(e.deltaX, e.deltaY); });

root.createChild("image")
.set("file", getprop("/sim/fg-home") ~ "/Nasal/rally-timer.jpg")
.setSize(152,74);

var text =
root.createChild("text", "dialog-caption")
.set("text", "00:00:00")
.set("alignment", "center-center")
.set("character-size", 18)
.set("font", "LiberationFonts/LiberationSans-Bold.ttf")
.set("fill", "#ffffff")
.setTranslation(76, 45);

var speed = props.globals.getNode("/velocities/groundspeed-kt", 1);
var dt = props.globals.getNode("/sim/time/delta-sec", 1);
var passed_time = 0;


var mainLoop = func(){

if( speed.getValue() > 16 )
passed_time += dt.getValue();

var frac = passed_time - int(passed_time);
text.set("text", sprintf("%02d:%02d:%02d", passed_time / 60, math.mod(passed_time, 60), frac * 100));
settimer(mainLoop, 0.1);
}


mainLoop();


Thanks him for the quick solution. Please can anyone see whats happens with the method make timer construct. He though that usually it may works.

Thanks in advance
User avatar
Michat
 
Posts: 1041
Joined: Mon Jan 25, 2010 6:24 pm
Location: Spain
Version: 191b
OS: GNewSense

Re: Rally Timer Crashes FG On ubuntu 13.04 Today's GIT

Postby TheTom » Fri May 17, 2013 10:14 pm

Are you sure you are using the latest flightgear? About a week ago i have pushed a commit to flightgear which prevents an endless loop if using maketimer with an intervall of 0. btw. yor fix only shows the correct time if the framrate is 10 fps.
TheTom
 
Posts: 322
Joined: Sun Oct 09, 2011 10:20 am

Re: Rally Timer Crashes FG On ubuntu 13.04 Today's GIT

Postby Michat » Sat May 18, 2013 2:25 pm

Hi, user D-LEON told me he is using last GIT for yesterday. I'll try to reconfirm that point with him.

His solution is based in 0.1 value in order to avoid main loop, from my skill, I can't tell you more. I'll try to move him to this thread.

Thank you TheTom.
User avatar
Michat
 
Posts: 1041
Joined: Mon Jan 25, 2010 6:24 pm
Location: Spain
Version: 191b
OS: GNewSense

Re: Rally Timer Crashes FG On ubuntu 13.04 Today's GIT

Postby D-Leon » Sun May 19, 2013 9:36 pm

first of all i appreciate your work on the canvas lib !!! Im highly interrestted on this technology. I plan to build an glascockpit with the svg parser very nice interface !!! Hat off and thumbs up.

TheTom wrote in Fri May 17, 2013 10:14 pm:Are you sure you are using the latest flightgear? About a week ago i have pushed a commit to flightgear which prevents an endless loop if using maketimer with an intervall of 0. btw. yor fix only shows the correct time if the framrate is 10 fps.


Michat ask me to test this stopwatch. when i loaded through my ~./fgfs/Nasal Folder the plane starts as normal until the script is executed then FG eats 100% of power i had 0 fps. So i replaced the previously unknown function maketimer (btw also nice timer interface) with an copy paste mainLoop from former times and the watch beginns to run.

i build 17.05.2013 ubuntu 13.04 without the RTI lib i think
D-Leon
 
Posts: 28
Joined: Wed Oct 03, 2012 8:44 am
Callsign: D-Leon
OS: Linux

Re: Rally Timer Crashes FG On ubuntu 13.04 Today's GIT

Postby Hooray » Sun May 19, 2013 10:04 pm

use the help/about dialog to provide all requested info
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: 11965
Joined: Tue Mar 25, 2008 8:40 am

Re: Rally Timer Crashes FG On ubuntu 13.04 Today's GIT  

Postby D-Leon » Mon May 20, 2013 12:40 am

i rebuild it from scratch and now it is working !

maketimer with 0
D-Leon
 
Posts: 28
Joined: Wed Oct 03, 2012 8:44 am
Callsign: D-Leon
OS: Linux

Re: Rally Timer Crashes FG On ubuntu 13.04 Today's GIT

Postby Michat » Mon Jul 15, 2013 10:20 pm

Got it, thanks all.
User avatar
Michat
 
Posts: 1041
Joined: Mon Jan 25, 2010 6:24 pm
Location: Spain
Version: 191b
OS: GNewSense


Return to Canvas

Who is online

Users browsing this forum: No registered users and 1 guest