From 8d513b97d4a0d6ece2a5200d8afedc550a2cfcc7 Mon Sep 17 00:00:00 2001 From: Nats-ji Date: Mon, 8 Feb 2021 06:51:27 +0800 Subject: [PATCH] Input hack --- CPStyling/init.lua | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/CPStyling/init.lua b/CPStyling/init.lua index 43106bc..9c7250d 100644 --- a/CPStyling/init.lua +++ b/CPStyling/init.lua @@ -447,4 +447,39 @@ function CPStyle.fileExists(filename) if (f~=nil) then io.close(f) return true else return false end end +CPStyle.Input = { enable = false } + +function CPStyle.Input:Enable(state) + if state == nil then + self.enable = not self.enbale + else + self.enable = state + end +end + +function CPStyle.Input:Register() + if self.enable then + CPS.colorBegin("WindowBg", theme.Hidden) + CPS.colorBegin("FrameBg", theme.Hidden) + CPS.colorBegin("Text", theme.Hidden) + CPS.colorBegin("NavHighlight", theme.Hidden) + CPS.colorBegin("Border", theme.Hidden) + ImGui.Begin("##CPStyle.Input", ImGuiWindowFlags.NoTitleBar | ImGuiWindowFlags.NoResize) + ImGui.SetKeyboardFocusHere() + self.keypress, self.pressed = ImGui.InputText("##keyboardinput", "", 100) + if self.pressed then ImGui.SetKeyboardFocusHere() end + ImGui.InputText("##dummy", "", 100) + ImGui.End() + CPS.colorEnd(5) + end +end + +function CPStyle.Input:GetKeyPress() + if self.keypress == "" then + return nil + else + return self.keypress + end +end + return CPStyle