Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed issue with do_on_mouse_click now is only called once per mouse … #115

Merged
merged 1 commit into from
Mar 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/cmake.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on: [push]
env:
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
BUILD_TYPE: RelWithDebInfo
FWL_VERSION: 2.8.11
FWL_VERSION: 2.8.12

jobs:
build-lin:
Expand Down
2 changes: 2 additions & 0 deletions FlyWithLua/Documentation/ChangeLog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -93,3 +93,5 @@ v2.8.9 Added support for X-Plane Fmod SDK.
v2.8.10 Removed X-Plane LuaJIT alloc because it is not needed and was causing issues with Linux.

v2.8.11 Fixed missing Throttle 9 from SaveInitalAssignments.ini Thanks XPJavelin

v2.8.12 Fixed issue with do_on_mouse_click now is only called once per mouse click Thanks apn
65 changes: 65 additions & 0 deletions FlyWithLua/Scripts (disabled)/imgui_get_lat_lon.lua
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()", "", "")
132 changes: 132 additions & 0 deletions FlyWithLua/Scripts (disabled)/imgui_set_failures.lua
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 modified FlyWithLua/lin_x64/FlyWithLua.xpl
Binary file not shown.
Binary file modified FlyWithLua/mac_x64/FlyWithLua.xpl
Binary file not shown.
Binary file modified FlyWithLua/win_x64/FlyWithLua.xpl
Binary file not shown.
7 changes: 4 additions & 3 deletions src/FlyWithLua.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// FlyWithLua Plugin for X-Plane 12
// ----------------------------------

#define PLUGIN_VERSION_NO "2.8.11"
#define PLUGIN_VERSION_NO "2.8.12"
#define PLUGIN_VERSION_BUILD __DATE__ " " __TIME__
#define PLUGIN_VERSION PLUGIN_VERSION_NO " build " PLUGIN_VERSION_BUILD

Expand Down Expand Up @@ -168,7 +168,8 @@
* v2.8.8 [added] Added support for the horizontal scrollbar in Imgui windows.
* v2.8.9 [changed] Now using the X-Plane Fmod SDK for the com1, interior, ui and the master buses.
* v2.8.10 [changed] Removed X-Plane LuaJIT alloc because it is not needed and was causing issues with Linux.
* v2.8.11 [changed] Fixed missing Throttle 9 from SaveInitalAssignments.ini Thanks XPJavelin
* v2.8.11 [changed] Fixed missing Throttle 9 from SaveInitalAssignments.ini Thanks XPJavelin from x-plane.org
* v2.8.12 [changed] Fixed issue with do_on_mouse_click now is only called once per mouse click Thanks apn from x-plane.org
*
*
* Markus (Teddii):
Expand Down Expand Up @@ -7487,7 +7488,7 @@ PLUGIN_API int XPluginEnable(void)

//register the mouse capture window
XPLMCreateWindow_t MouseWindowData;
MouseWindowData.structSize = 72; // SDK 2 size to work around XPD-9350
MouseWindowData.structSize = sizeof(MouseWindowData);
MouseWindowData.left = 0;
MouseWindowData.bottom = 0;
XPLMGetScreenSize(&MouseWindowData.right, &MouseWindowData.top);
Expand Down