1
0
Fork 0

Add slider to configure frame-rate throttling.

This commit is contained in:
ThorstenB 2012-04-09 00:05:48 +02:00
parent 1867df11ce
commit 19d7be312d
2 changed files with 57 additions and 2 deletions

View file

@ -122,6 +122,61 @@
</binding> </binding>
</checkbox> </checkbox>
--> -->
<group>
<layout>hbox</layout>
<row>1</row>
<col>0</col>
<checkbox>
<halign>left</halign>
<label>Throttle frame rate</label>
<name>frame-rate-throttle</name>
<property>/sim/gui/frame-rate-throttled</property>
<binding>
<command>dialog-apply</command>
<object-name>frame-rate-throttle</object-name>
</binding>
<binding>
<command>nasal</command>
<script>
var throttled = getprop("/sim/gui/frame-rate-throttled");
if (throttled)
setprop("/sim/frame-rate-throttle-hz", 50);
else
setprop("/sim/frame-rate-throttle-hz", 0);
</script>
</binding>
</checkbox>
<group>
<layout>hbox</layout>
<visible>
<greater-than>
<property>/sim/frame-rate-throttle-hz</property>
<value>0</value>
</greater-than>
</visible>
<slider>
<name>frame-rate</name>
<min>15.0</min>
<max>70.0</max>
<step>1.0</step>
<property>/sim/frame-rate-throttle-hz</property>
<binding>
<command>dialog-apply</command>
<object-name>frame-rate</object-name>
</binding>
</slider>
<text>
<halign>left</halign>
<label>99 Hz</label>
<format>%2.0f Hz</format>
<live>true</live>
<property>/sim/frame-rate-throttle-hz</property>
</text>
</group>
</group>
<group> <group>
<layout>hbox</layout> <layout>hbox</layout>
@ -392,8 +447,6 @@
</not> </not>
</visible> </visible>
<layout>hbox</layout>
<text> <text>
<label>Performance</label> <label>Performance</label>
</text> </text>
@ -664,6 +717,7 @@
<open> <open>
gui.enable_widgets(cmdarg(), "shadows-debug", getprop("/sim/gui/devel-widgets")); gui.enable_widgets(cmdarg(), "shadows-debug", getprop("/sim/gui/devel-widgets"));
props.globals.getNode("/sim/rendering/shaders/quality-level", 1).setAttribute("userarchive", 0); props.globals.getNode("/sim/rendering/shaders/quality-level", 1).setAttribute("userarchive", 0);
setprop("/sim/gui/frame-rate-throttled", (getprop("/sim/frame-rate-throttle-hz") > 0));
</open> </open>
</nasal> </nasal>
</PropertyList> </PropertyList>

View file

@ -800,6 +800,7 @@ Started September 2000 by David Megginson, david@megginson.com
<realism> <realism>
<dme-fallback-to-loc type="bool">false</dme-fallback-to-loc> <dme-fallback-to-loc type="bool">false</dme-fallback-to-loc>
</realism> </realism>
<frame-rate-throttle-hz type="double" userarchive="y">0</frame-rate-throttle-hz>
</sim> </sim>
<!-- mouse mode --> <!-- mouse mode -->
<devices> <devices>