From 31038b280e7ebbb0ae83dee98bf01e45ddc65f38 Mon Sep 17 00:00:00 2001 From: fly Date: Fri, 22 Dec 2023 20:16:13 +0100 Subject: [PATCH] Initial commit Signed-off-by: fly --- .gitignore | 2 ++ fov-persistance/addon-config.xml | 15 ++++++++++++++ fov-persistance/addon-main.nas | 32 ++++++++++++++++++++++++++++++ fov-persistance/addon-metadata.xml | 16 +++++++++++++++ 4 files changed, 65 insertions(+) create mode 100644 .gitignore create mode 100644 fov-persistance/addon-config.xml create mode 100644 fov-persistance/addon-main.nas create mode 100644 fov-persistance/addon-metadata.xml diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..3819313 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +*.swp +*.swo diff --git a/fov-persistance/addon-config.xml b/fov-persistance/addon-config.xml new file mode 100644 index 0000000..12d2ac6 --- /dev/null +++ b/fov-persistance/addon-config.xml @@ -0,0 +1,15 @@ + + + + + + + fov-persistance + 0.1 + merspieler + Maintains a given fov for a given resolution + Initial commit + + + + diff --git a/fov-persistance/addon-main.nas b/fov-persistance/addon-main.nas new file mode 100644 index 0000000..fd68505 --- /dev/null +++ b/fov-persistance/addon-main.nas @@ -0,0 +1,32 @@ +last_tile = ""; + +var updateFOV = func() +{ + if (getprop("/sim/gui/canvas/size[0]") == 5760) + { + setprop("/sim/current-view/field-of-view", 120); + } + else + { + setprop("/sim/current-view/field-of-view", getprop("/sim/current-view/config/default-field-of-view-deg")); + } +}; + +var main = func (root) +{ + var fdm_init = setlistener("/sim/signals/fdm-initialized", func + { + setlistener("/sim/gui/canvas/size[0]", func + { + updateFOV(); + }, 0, 0); + setlistener("/sim/current-view/name", func + { + updateFOV(); + }, 0, 0); + setlistener("/sim/current-view/config/default-field-of-view-deg", func + { + updateFOV(); + }, 0, 0); + }); +}; diff --git a/fov-persistance/addon-metadata.xml b/fov-persistance/addon-metadata.xml new file mode 100644 index 0000000..76d6c12 --- /dev/null +++ b/fov-persistance/addon-metadata.xml @@ -0,0 +1,16 @@ + + + + FlightGear add-on metadata + 1 + + + + org.flightgear.addons.fov-persistance + fov-persistance + 0.1.0 + all + fov-persistance + fov-persistance + +