diff --git a/resource/imgui_test/example.jpg b/examples/cleo5/example.jpg similarity index 100% rename from resource/imgui_test/example.jpg rename to examples/cleo5/example.jpg diff --git a/examples/cleo5/imgui_test.cs b/examples/cleo5/imgui_test.cs new file mode 100644 index 0000000..6eed7c7 Binary files /dev/null and b/examples/cleo5/imgui_test.cs differ diff --git a/examples/cleo5/imgui_test.txt b/examples/cleo5/imgui_test.txt new file mode 100644 index 0000000..e560cc4 --- /dev/null +++ b/examples/cleo5/imgui_test.txt @@ -0,0 +1,273 @@ +// +// ImGuiCleo Example Script +// +{$CLEO} +{$USE CLEO} +{$USE imgui} + +const TOGGLE_KEY = 116 // F5 +int $gShowWindow = 0 +int $gVersionInfo = 0 +int $gRadioBtn = 1 +int $gTimerExample = 0 +int $gPrevTimer = 0 +int $gComboSelection = 1 +int $gImage = ImGui.LoadImage("cleo\example.jpg") + +while true + /* + This must always be 0 to render ImGui each frame + If you need to wait for something use timers instead, + example below + */ + wait 0 + + + /* + All ImGui code must be wrapped inside the BeginFrame() .. EndFrame() + You need to pass a "UNIQUE ID" for the frame name. + Use something that's unlikely to be used by any other scripts + */ + ImGui.BeginFrame("IMGUI_CLEO_DEMO") + ImGui.SetCursorVisible($gShowWindow) + + if $gShowWindow == 1 + then + ImGui.SetNextWindowSize(350.0, 600.0, ImGuiCond.Once) + $gShowWindow = ImGui.Begin("ImGuiCleo Demo Window", $gShowWindow, 0, 0, 0, 0) + + float $reduxVer = ImGui.GetPluginVersion() + s$imguiVer = ImGui.GetVersion() + int $fps = Game.GetFramerate() + + ImGui.Spacing() + + if $gVersionInfo == 1 + then + ImGui.Columns(2) + Text.StringFormat(s$temp, "ImGui: %s", s$imguiVer) + ImGui.Text(s$temp) + Text.StringFormat(s$temp, "Framerate: %d", $fps) + ImGui.Text(s$temp) + ImGui.NextColumn() + Text.StringFormat(s$temp, "CLEO: %f", $reduxVer) + ImGui.Text(s$temp) + ImGui.Columns(1) + ImGui.Spacing() + end + + ImGui.BeginChild("WindowChild") + + int $tab = ImGui.Tabs("TabBar", "Checkbox,Button,Input,Text,Styles") + + if $tab == 0 + then + ImGui.Spacing() + ImGui.Columns(2) + $gVersionInfo = ImGui.Checkbox("Show version info", $gVersionInfo) + ImGui.NextColumn() + $gTimerExample = ImGui.Checkbox("Show timer example", $gTimerExample) + ImGui.Columns(1) + ImGui.Spacing() + end + + + if $tab == 1 + then + ImGui.Spacing() + if ImGui.CollapsingHeader("Arrow buttons") + then + ImGui.ButtonArrow("Left", 0) + ImGui.SameLine() + ImGui.ButtonArrow("Right", 1) + ImGui.SameLine() + ImGui.ButtonArrow("Up", 2) + ImGui.SameLine() + ImGui.ButtonArrow("Down", 3) + + ImGui.Separator() + ImGui.Spacing() + end + + if ImGui.CollapsingHeader("Radio buttons") + then + $gRadioBtn = ImGui.RadioButton("RB1", $gRadioBtn, 1) + ImGui.SameLine() + $gRadioBtn = ImGui.RadioButton("RB2", $gRadioBtn, 2) + ImGui.SameLine() + $gRadioBtn = ImGui.RadioButton("RB3", $gRadioBtn, 3) + ImGui.Spacing() + end + + if ImGui.CollapsingHeader("Regular buttons") + then + ImGui.GetScalingSize("S0", 2, 0, $szX, $szY) + if ImGui.Button("Normal button", $szX, $szY) + then + Text.PrintString("Normal button was pressed", 1000) + end + ImGui.SameLine() + if ImGui.ButtonImage("Image Button", $gImage, $szX, $szY) + then + Text.PrintString("Image Button was pressed", 1000) + end + + ImGui.Spacing() + + float $szX = 0 + float $szY = 0 + $szX, $szY = ImGui.GetScalingSize("S1", 3, 0) + if ImGui.ButtonColored("CB 1", 1.0, 0.0, 0.0, 1.0, $szX, $szY) + then + Text.PrintString("Color button 1 was pressed", 1000) + end + ImGui.SameLine() + if ImGui.ButtonColored("CB 2", 0.0, 1.0, 0.0, 1.0, $szX, $szY) + then + Text.PrintString("Color button 2 was pressed", 1000) + end + ImGui.SameLine() + if ImGui.ButtonColored("CB 3", 0.0, 0.0, 1.0, 1.0, $szX, $szY) + then + Text.PrintString("Color button 3 was pressed", 1000) + end + + ImGui.GetScalingSize("S2", 1, 0, $szX, $szY) + ImGui.Text("Tip:\n\tClick the below area") + if ImGui.ButtonInvisible("Invis button", $szX, $szY) + then + Text.PrintString("Invisible button was pressed", 1000) + end + + if ImGui.IsItemHovered("HOver") + then + ImGui.Text("Hovering invisible button") + end + + ImGui.Spacing() + ImGui.Separator() + end + end + + ImGui.Spacing() + + // Input and Slider example + if $tab == 2 + then + ImGui.Spacing() + 1@ = ImGui.InputInt("Int input", 420, 0, 1000) + 1@ = ImGui.InputFloat("Float input", 69.9, 0.0, 100.0) + ImGui.Spacing() + 1@ = ImGui.SliderInt("Int slider", 5, 0, 10) + 1@ = ImGui.SliderFloat("Float slider", 5.0, 0.0, 10.0) + ImGui.Spacing() + s$text = ImGui.InputText("Text input widget") + ImGui.Spacing() + + float $szX = 0 + float $szY = 0 + $szX, $szY = ImGui.GetScalingSize("S012", 2, 0) + if ImGui.Button("Rest Inputs", $szX, $szY) + then + ImGui.SetItemValueInt("Int input", 420) + ImGui.SetItemValueInt("Int slider", 5) + end + ImGui.SameLine() + if ImGui.Button("Rest Sliders", $szX, $szY) + then + ImGui.SetItemValueFloat("Float input", 69.9) + ImGui.SetItemValueFloat("Float slider", 5.0) + end + + ImGui.Dummy(0.0, 20.0) + + float $r = 0 + float $g = 0 + float $b = 0 + float $a = 0 + $r, $g, $b, $a = ImGui.ColorPicker("Color Picker") + ImGui.ButtonColored("COLORBTN", $r, $g, $b, $a, 70.0, 30.0) + + ImGui.Dummy(0.0, 10.0) + ImGui.Text("Text input: " + text) + + $gComboSelection = ImGui.ComboBox("Combo", "Option1,Option2,Option3", $gComboSelection) + end + + if $tab == 3 + then + ImGui.Spacing() + ImGui.Text("A little brown fox jumps over the lazy dog") + ImGui.TextDisabled("A little brown fox jumps over the lazy dog") + ImGui.TextColored("A little brown fox jumps over the lazy dog", 1.0, 0.0, 0.0, 1.0) + ImGui.TextWithBullet("A little brown fox jumps over the lazy dog") + ImGui.Spacing() + ImGui.TextWrapped("A little brown fox jumps over the lazy dog. A little brown fox jumps over the lazy dog. A little brown fox jumps over the lazy dog") + end + + if $tab == 4 + then + ImGui.Spacing() + ImGui.Text("Red checkbox") + ImGui.Spacing() + ImGui.PushStyleColor(ImGuiCol.FrameBg, 200, 0, 0, 255) + ImGui.PushStyleColor(ImGuiCol.FrameBgActive, 90, 0, 0, 255) + ImGui.PushStyleColor(ImGuiCol.FrameBgHovered, 120, 0, 0, 255) + $gVersionInfo = ImGui.Checkbox("Show version info", $gVersionInfo) + ImGui.PopStyleColor(3) + ImGui.Spacing() + ImGui.Text("Button with custom style") + ImGui.Spacing() + + ImGui.PushStyleVar(ImGuiStyleVar.FrameRounding, 10.0) + + float $szX = 0 + float $szY = 0 + $szX, $szY = ImGui.GetScalingSize("S012", 2, 0) + if ImGui.Button("Rounded button", $szX, $szY) + then + Text.PrintString("Rounded button was pressed", 1000) + end + ImGui.PopStyleVar(1) + + ImGui.SameLine() + if ImGui.Button("Regular button", $szX, $szY) + then + Text.PrintString("Regular button was pressed", 1000) + end + end + + ImGui.EndChild() + + ImGui.End() + end + ImGui.EndFrame() + + + // Timer example + // This code has 5 second delay + float $delta = TIMERA - $gPrevTimer + if and + $gTimerExample > 0 + $delta > 5000 + then + Text.PrintString("Timer test message", 1000) + $gPrevTimer = TIMERA + end + + if Pad.IsKeyPressed(TOGGLE_KEY) + then + while Pad.IsKeyPressed(TOGGLE_KEY) + wait 0 + end + + if $gShowWindow == 1 + then + $gShowWindow = 0 + else + $gShowWindow = 1 + end + end +end + + diff --git a/examples/redux/imgui_test/example.jpg b/examples/redux/imgui_test/example.jpg new file mode 100644 index 0000000..9460ca0 Binary files /dev/null and b/examples/redux/imgui_test/example.jpg differ diff --git a/resource/imgui_test/index.js b/examples/redux/imgui_test/index.js similarity index 95% rename from resource/imgui_test/index.js rename to examples/redux/imgui_test/index.js index 9b72dec..394ba25 100644 --- a/resource/imgui_test/index.js +++ b/examples/redux/imgui_test/index.js @@ -11,7 +11,7 @@ var gRadioBtn = 1 var gTimerExample = 0 var gPrevTimer = 0 var gComboSelection = 1 -var gImage = ImGui.LoadImage("./example.jpg") +var gImage = ImGui.LoadImage("cleo/imgui_test/example.jpg") function textBox(text) { @@ -45,7 +45,7 @@ while (true) if (gShowWindow) { - ImGui.SetNextWindowSize(350, 600, 2) // 2 = ImGuiCond_Once + ImGui.SetNextWindowSize(350.0, 600.0, 2) // 2 = ImGuiCond_Once gShowWindow = ImGui.Begin("ImGuiRedux Demo Window", gShowWindow, 0, 0, 0, 0) let reduxVer = ImGui.GetPluginVersion() @@ -176,14 +176,14 @@ while (true) let size = ImGui.GetScalingSize("S012", 2, 0) if (ImGui.Button("Rest Inputs", size.x, size.y)) { - ImGui.SetWidgetValueInt("Int input", 420) - ImGui.SetWidgetValueInt("Int slider", 5) + ImGui.SetItemValueInt("Int input", 420) + ImGui.SetItemValueInt("Int slider", 5) } ImGui.SameLine() if (ImGui.Button("Rest Sliders", size.x, size.y)) { - ImGui.SetWidgetValueFloat("Float input", 69.9) - ImGui.SetWidgetValueFloat("Float slider", 5.0) + ImGui.SetItemValueFloat("Float input", 69.9) + ImGui.SetItemValueFloat("Float slider", 5.0) } ImGui.Dummy(0, 20) diff --git a/resource/d3d8.dll b/resource/d3d8.dll deleted file mode 100644 index 6b4ee32..0000000 Binary files a/resource/d3d8.dll and /dev/null differ