X-Planeで画面を移動させるための全てのコマンドをまとめてクリックで表示させる。
-- 画像県警の初期設定 ---- -- E_Camera Move ---- local image_E_1 = float_wnd_load_image(SCRIPT_DIRECTORY .. "/tab_img/E-1.png") local image_E_2 = float_wnd_load_image(SCRIPT_DIRECTORY .. "/tab_img/E-2.png") local image_E_3 = float_wnd_load_image(SCRIPT_DIRECTORY .. "/tab_img/E-3.png") local image_E_4 = float_wnd_load_image(SCRIPT_DIRECTORY .. "/tab_img/E-10.png") local image_E_5 = float_wnd_load_image(SCRIPT_DIRECTORY .. "/tab_img/E-11.png") local image_E_6 = float_wnd_load_image(SCRIPT_DIRECTORY .. "/tab_img/E-12.png") local image_E_7 = float_wnd_load_image(SCRIPT_DIRECTORY .. "/tab_img/E-4.png") local image_E_8 = float_wnd_load_image(SCRIPT_DIRECTORY .. "/tab_img/E-5.png") local image_E_9 = float_wnd_load_image(SCRIPT_DIRECTORY .. "/tab_img/E-6.png") local image_E_10 = float_wnd_load_image(SCRIPT_DIRECTORY .. "/tab_img/E-13.png") local image_E_11 = float_wnd_load_image(SCRIPT_DIRECTORY .. "/tab_img/E-14.png") local image_E_12 = float_wnd_load_image(SCRIPT_DIRECTORY .. "/tab_img/E-16.png") local image_E_13 = float_wnd_load_image(SCRIPT_DIRECTORY .. "/tab_img/E-7.png") local image_E_14 = float_wnd_load_image(SCRIPT_DIRECTORY .. "/tab_img/E-8.png") local image_E_15 = float_wnd_load_image(SCRIPT_DIRECTORY .. "/tab_img/E-9.png") local image_E_16 = float_wnd_load_image(SCRIPT_DIRECTORY .. "/tab_img/E-17.png") local image_E_17 = float_wnd_load_image(SCRIPT_DIRECTORY .. "/tab_img/E-15.png") local image_E_18 = float_wnd_load_image(SCRIPT_DIRECTORY .. "/tab_img/E-19.png") local image_E_19 = float_wnd_load_image(SCRIPT_DIRECTORY .. "/tab_img/E-19.png") local image_E_20 = float_wnd_load_image(SCRIPT_DIRECTORY .. "/tab_img/E-20.png") local image_E_21 = float_wnd_load_image(SCRIPT_DIRECTORY .. "/tab_img/E-21.png") local image_E_22 = float_wnd_load_image(SCRIPT_DIRECTORY .. "/tab_img/E-20.png") local image_E_23 = float_wnd_load_image(SCRIPT_DIRECTORY .. "/tab_img/E-18.png") local image_E_24 = float_wnd_load_image(SCRIPT_DIRECTORY .. "/tab_img/E-21.png") local image_E = { image_E_1, image_E_2, image_E_3, image_E_4, image_E_5, image_E_6, image_E_7, image_E_8, image_E_9, image_E_10, image_E_11, image_E_12, image_E_13, image_E_14, image_E_15, image_E_16, image_E_17, image_E_18, image_E_19, image_E_20, image_E_21, image_E_22, image_E_23, image_E_24 } local Image_Button_posX = { "10", "145", "280", "415", "550", "685", "10", "145", "280", "415", "550", "685", "10", "145", "280", "415", "550", "685", "10", "145", "280", "415", "550", "685", "10", "145", "280", "415", "550" } --左のボタンからの位置 +135 local Image_Button_posY = { "52", "52", "52", "52", "52", "52", "147", "147", "147", "147", "147", "147", "242", "242", "242", "242", "242", "242", "337", "337", "337", "337", "337", "337" } --上のボタンからの位置 +95 local number_Button_posX = { "15", "150", "285", "420", "555", "685", "15", "150", "285", "420", "555", "685", "15", "150", "285", "420", "555", "685", "15", "150", "285", "420", "555", "685", "15", "150", "285", "420", "685", "555" } local number_Button_posY = { "54", "54", "54", "54", "54", "54", "149", "149", "149", "149", "149", "149", "244", "244", "244", "244", "244", "244", "339", "339", "339", "339", "339", "339" } local CameraMove_lavel_text = { "hatSw Up Left", --E-1 "hatSw Up", --E-2 "hatSw Up Right", --E-3 "Rot Left", --E-4 "Rot Down", --E-5 "Rot Right", --E-6 "hatSw Left", --E-7 "3d cockpit look", --E-8 "hatSw Right", --E-9 "Zoom In", --E-10 "Rot Up", --E-11 "Zoon Out", --E-12 "hatSw Down Left", --E-13 "hatSw Down", --E-14 "hatSw Down Right", --E-15 "Left", --E-16 "Up", --E-17 "Right", --E-18 "", --E-19 "", --E-20 "", --E-21 "Forward", --E-22 "Down", --E-23 "Backward" --E-24 } local CameraMove_view_command = { "sim/general/hat_switch_up_left", --E-1 "sim/general/hat_switch_up", --E-2 "sim/general/hat_switch_up_right", --E-3 "sim/general/rot_left", --E-4 "sim/general/rot_down", --E-5 "sim/general/rot_right", --E-6 "sim/general/hat_switch_left", --E-7 "sim/view/3d_cockpit_cmnd_look", --E-8 "sim/general/hat_switch_right", --E-9 "sim/general/zoom_in", --E-10 "sim/general/rot_up", --E-11 "sim/general/zoom_out", --E-12 "sim/general/hat_switch_down_left", --E-13 "sim/general/hat_switch_down", --E-14 "sim/general/hat_switch_down_right", --E-15 "sim/general/left", --E-16 "sim/general/up", --E-17 "sim/general/right", --E-18 "", --E-19 "", --E-20 "", --E-21 "sim/general/forward", --E-22 "sim/general/down", --E-23 "sim/general/backward" --E-24 } local button_color = { "0xFFCD5C5C", --E-1 "0xFFCD5C5C", --E-2 "0xFFCD5C5C", --E-3 "0x9ACD32FF", --E-4 "0x9ACD32FF", --E-5 "0x9ACD32FF", --E-6 "0xFFCD5C5C", --E-7 "0xFFCD5C5C", --E-8 "0xFFCD5C5C", --E-9 "0xFFFF00FF", --E-10 "0x9ACD32FF", --E-11 "0xFFFF00FF", --E-12 "0xFFCD5C5C", --E-13 "0xFFCD5C5C", --E-14 "0xFFCD5C5C", --E-15 "0xDC143CFF", --E-16 "0xDC143CFF", --E-17 "0xDC143CFF", --E-18 "", --E-19 "", --E-20 "", --E-21 "0xFFFF0080", --E-22 "0xDC143CFF", --E-23 "0xFFFF0080" --E-24 } --初期設定 local press_hold_button = false --初期の円はグレー表示 --------------------------------------------------------------------------------- --コマンドを使う場合、この設定が必要 local view_selector_wnd = nil --function show_wnd_2() view_selector_wnd = float_wnd_create(825, 442, 1, true) float_wnd_set_position(view_selector_wnd, 300, 100) float_wnd_set_title(view_selector_wnd, "X-Plane View Selector") float_wnd_set_imgui_builder(view_selector_wnd, "view_selector_build_wnd") float_wnd_set_onclose(view_selector_wnd, "on_close") --------------------------------------------------------------------------------- function view_selector_build_wnd(view_selector_wnd, x, y) imgui.TextUnformatted(" B737-800X Zibo") if imgui.BeginTabBar("test_tabs") then -- タボアイテムををまとめる if imgui.BeginTabItem("E_camera move") then ----------タブの内容を入れるスペース--------------- for i = 1, 24, 1 do if i == 19 then --ボタンを表示しない位置(一番下の ::continue:: とセットになる) goto continue elseif i == 20 then --ボタンを表示しない位置 goto continue elseif i == 21 then --ボタンを表示しない位置 goto continue end -- E-1 ----------------- imgui.SetCursorPosX(Image_Button_posX[i]) -- +152 imgui.SetCursorPosY(Image_Button_posY[i]) imgui.PushStyleColor(imgui.constant.Col.Button, button_color[i]) --下の imgui.PopStyleColor() とセットになっている。 imgui.ImageButton(image_E[i], 120, 65) if imgui.IsItemActive() then --imgui.IsItemActive()は常にfalseを返します press_hold_button = not press_hold_button --ボタンを押し続けてコマンドを連続で実行 command_once(CameraMove_view_command[i]) end imgui.PopStyleColor() --ボタン下のテキスト(中心に入れる設定) local camera_move_label = CameraMove_lavel_text[i] local text_size = imgui.CalcTextSize(camera_move_label) --テキストのサイズを取得 --68はボタンの中心位置、テキストサイズを半分にして引くとボタンに対してテキストが中心になる。 imgui.SetCursorPos(64 + Image_Button_posX[i] - (text_size / 2), imgui.GetCursorPosY()) --パラメーターは、Xの位置と、Yの位置 imgui.TextUnformatted(camera_move_label) --ボタンナンバーの位置とラベル imgui.SetCursorPosX(number_Button_posX[i]) imgui.SetCursorPosY(number_Button_posY[i]) imgui.TextUnformatted("E-" .. i) ::continue:: end ---------タブの内容を入れる END--------------- imgui.EndTabItem() end imgui.EndTabBar() end end function on_close(view_selector_wnd) end