-
Notifications
You must be signed in to change notification settings - Fork 54
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #115 from sparker256/master
Fixed issue with do_on_mouse_click now is only called once per mouse …
- Loading branch information
Showing
8 changed files
with
204 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
-- Imugi Get Latitude and Longitude | ||
-- William R. Good 03-27-24 | ||
|
||
if not SUPPORTS_FLOATING_WINDOWS then | ||
-- to make sure the script doesn't stop old FlyWithLua versions | ||
logMsg("imgui not supported by your FlyWithLua version") | ||
return | ||
end | ||
|
||
|
||
local dec_deg_latitude = 0.0 | ||
local dec_deg_longitude = 0.0 | ||
|
||
|
||
function iglal_on_build(iglal_wnd, x, y) | ||
if imgui.Button("Get Location", 100, 50) then | ||
get_location() | ||
end | ||
|
||
imgui.TextUnformatted(string.format("Latitude %f", dec_deg_latitude)) | ||
imgui.TextUnformatted(string.format("Longitude %f", dec_deg_longitude)) | ||
|
||
end | ||
|
||
function get_location() | ||
dec_deg_latitude = LATITUDE | ||
dec_deg_longitude = LONGITUDE | ||
end | ||
|
||
iglal_wnd = nil | ||
|
||
function iglal_show_wnd() | ||
iglal_wnd = float_wnd_create(640, 480, 1, true) | ||
float_wnd_set_title(iglal_wnd, "Imgui Imugi Get Latitude and Longitude") | ||
float_wnd_set_imgui_builder(iglal_wnd, "iglal_on_build") | ||
end | ||
|
||
function iglal_hide_wnd() | ||
if iglal_wnd then | ||
float_wnd_destroy(iglal_wnd) | ||
end | ||
end | ||
|
||
iglal_show_only_once = 0 | ||
iglal_hide_only_once = 0 | ||
|
||
function toggle_imgui_show_hide_window_with_command() | ||
iglal_show_window = not iglal_show_window | ||
if iglal_show_window then | ||
if iglal_show_only_once == 0 then | ||
iglal_show_wnd() | ||
iglal_show_only_once = 1 | ||
iglal_hide_only_once = 0 | ||
end | ||
else | ||
if iglal_hide_only_once == 0 then | ||
iglal_hide_wnd() | ||
iglal_hide_only_once = 1 | ||
iglal_show_only_once = 0 | ||
end | ||
end | ||
end | ||
|
||
add_macro("Imgui Show Hide Imgui Get Latitude and Longitude: open/close", "iglal_show_wnd()", "iglal_hide_wnd()", "deactivate") | ||
create_command("FlyWithLua/imgui-get-latitude-and-longitude-window/show_toggle", "open/close umgui get latitude and longitude window", "toggle_imgui_get_latitude_and_longitude()", "", "") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,132 @@ | ||
-- Imugi Set Failures | ||
-- William R. Good 03-28-24 | ||
|
||
if not SUPPORTS_FLOATING_WINDOWS then | ||
-- to make sure the script doesn't stop old FlyWithLua versions | ||
logMsg("imgui not supported by your FlyWithLua version") | ||
return | ||
end | ||
|
||
dataref("rel_engfai0", "sim/operation/failures/rel_engfai0", "writable") | ||
dataref("rel_vacuum", "sim/operation/failures/rel_vacuum", "writable") | ||
dataref("rel_genera0", "sim/operation/failures/rel_genera0", "writable") | ||
|
||
|
||
function isf_on_build(isf_wnd, x, y) | ||
if imgui.Button("Fail Engine", 200, 25) then | ||
rel_engfai0 = 6 | ||
|
||
end | ||
imgui.SameLine() | ||
imgui.SetCursorPosX(250) | ||
|
||
if imgui.Button("Fix Engine", 200, 25) then | ||
rel_engfai0 = 0 | ||
end | ||
imgui.SameLine() | ||
imgui.SetCursorPosX(500) | ||
|
||
if rel_engfai0 == 0 then | ||
-- The following function changes the color of all widgets until PopStyleColor is called. | ||
-- The format is AABBGGRR where A is alpha and B, G and R are blue, green and red. | ||
-- So if you have an HTML color like #2B65EC (ocean blue), swap the first two and last two hex digits | ||
-- and prefix it with FF to use it: | ||
imgui.PushStyleColor(imgui.constant.Col.Text, 0xFF00FF00) | ||
imgui.TextUnformatted("Working") | ||
-- Restore the previous style, this _must_ be called after each pushed style: | ||
imgui.PopStyleColor() | ||
else | ||
imgui.PushStyleColor(imgui.constant.Col.Text, 0xFF0000FF) | ||
imgui.TextUnformatted("Failed") | ||
imgui.PopStyleColor() | ||
end | ||
|
||
imgui.SetCursorPosY(50) | ||
|
||
if imgui.Button("Fail Vacuum Pump", 200, 25) then | ||
rel_vacuum = 6 | ||
|
||
end | ||
imgui.SameLine() | ||
imgui.SetCursorPosX(250) | ||
|
||
if imgui.Button("Fix Vacuum Pump", 200, 25) then | ||
rel_vacuum = 0 | ||
end | ||
imgui.SameLine() | ||
imgui.SetCursorPosX(500) | ||
|
||
if rel_vacuum == 0 then | ||
imgui.PushStyleColor(imgui.constant.Col.Text, 0xFF00FF00) | ||
imgui.TextUnformatted("Working") | ||
imgui.PopStyleColor() | ||
else | ||
imgui.PushStyleColor(imgui.constant.Col.Text, 0xFF0000FF) | ||
imgui.TextUnformatted("Failed") | ||
imgui.PopStyleColor() | ||
end | ||
|
||
|
||
imgui.SetCursorPosY(95) | ||
|
||
if imgui.Button("Fail Generator", 200, 25) then | ||
rel_genera0 = 6 | ||
|
||
end | ||
imgui.SameLine() | ||
imgui.SetCursorPosX(250) | ||
|
||
if imgui.Button("Fix Generator", 200, 25) then | ||
rel_genera0 = 0 | ||
end | ||
imgui.SameLine() | ||
imgui.SetCursorPosX(500) | ||
|
||
if rel_genera0 == 0 then | ||
imgui.PushStyleColor(imgui.constant.Col.Text, 0xFF00FF00) | ||
imgui.TextUnformatted("Working") | ||
imgui.PopStyleColor() | ||
else | ||
imgui.PushStyleColor(imgui.constant.Col.Text, 0xFF0000FF) | ||
imgui.TextUnformatted("Failed") | ||
imgui.PopStyleColor() | ||
end | ||
|
||
end | ||
|
||
isf_wnd = nil | ||
|
||
function isf_show_wnd() | ||
isf_wnd = float_wnd_create(640, 480, 1, true) | ||
float_wnd_set_title(isf_wnd, "Imgui Set Failures") | ||
float_wnd_set_imgui_builder(isf_wnd, "isf_on_build") | ||
end | ||
|
||
function isf_hide_wnd() | ||
if isf_wnd then | ||
float_wnd_destroy(isf_wnd) | ||
end | ||
end | ||
|
||
isf_show_only_once = 0 | ||
isf_hide_only_once = 0 | ||
|
||
function toggle_imgui_show_hide_window_with_command() | ||
isf_show_window = not isf_show_window | ||
if isf_show_window then | ||
if isf_show_only_once == 0 then | ||
isf_show_wnd() | ||
isf_show_only_once = 1 | ||
isf_hide_only_once = 0 | ||
end | ||
else | ||
if isf_hide_only_once == 0 then | ||
isf_hide_wnd() | ||
isf_hide_only_once = 1 | ||
isf_show_only_once = 0 | ||
end | ||
end | ||
end | ||
|
||
add_macro("Imgui Set Failures: open/close", "isf_show_wnd()", "isf_hide_wnd()", "deactivate") | ||
create_command("FlyWithLua/imgui-set-failures-window/show_toggle", "open/close imgui set failures window", "toggle_imgui_set_failures_window()", "", "") |
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters