Scaffold: upstream @ 851cdbd, core submodule, test runner, example
This commit is contained in:
commit
b9130d3876
19 files changed
+15843
No files matched your search
@@ -0,0 +1,2 @@
|
||||
.gitattributes export-ignore
|
||||
tools/upstream/** linguist-vendored=true
|
||||
@@ -0,0 +1,3 @@
|
||||
[submodule "tools/core"]
|
||||
path = tools/core
|
||||
url = https://git.bug.tools/bug/imgui-luau.git
|
||||
@@ -0,0 +1,8 @@
|
||||
-- ImPlot for imgui-luau. Port of https://github.com/epezent/implot (851cdbdd60d1dfb64c23e987969694de0f547a6b).
|
||||
-- Usage: local ImPlot = require(path.to.ImPlot)(require(path.to.ImGui))
|
||||
return function(G)
|
||||
local ImGui, ImVec2, ImVec4 = G.ImGui, G.ImVec2, G.ImVec4
|
||||
local ImPlot = {}
|
||||
-- [Port] TODO: port from tools/upstream
|
||||
return ImPlot
|
||||
end
|
||||
@@ -0,0 +1,23 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2020 Evan Pezent
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
|
||||
Luau port: Copyright (c) 2026 4DBug, same MIT terms.
|
||||
@@ -0,0 +1,26 @@
|
||||
# implot-luau
|
||||
|
||||
Immediate-mode 2D plotting for imgui-luau (Roblox / LÖVE).
|
||||
|
||||
Luau port of [ImPlot](https://github.com/epezent/implot) for [imgui-luau](https://git.bug.tools/bug/imgui-luau) ([GitHub](https://github.com/4DBug/imgui-luau)).
|
||||
Mirrors: [git.bug.tools](https://git.bug.tools/bug/implot-luau) / [GitHub](https://github.com/4DBug/implot-luau).
|
||||
|
||||
**Status: work in progress.**
|
||||
|
||||
```lua
|
||||
local G = require(ReplicatedStorage.ImGui)
|
||||
local ImPlot = require(ReplicatedStorage.ImPlot)(G)
|
||||
```
|
||||
|
||||
## Development
|
||||
|
||||
```sh
|
||||
git clone --recursive https://git.bug.tools/bug/implot-luau.git
|
||||
bash tools/test.sh # tests/t_*.luau in the core's Roblox mock
|
||||
```
|
||||
|
||||
Upstream source (pinned) is in `tools/upstream/`; port-specific comments are tagged `[Port]`.
|
||||
|
||||
## License
|
||||
|
||||
MIT, see LICENSE (upstream copyright kept).
|
||||
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"name": "implot-luau",
|
||||
"tree": {
|
||||
"$className": "DataModel",
|
||||
"ReplicatedStorage": {
|
||||
"ImGui": { "$path": "tools/core/build/ImGuiTyped.luau", "Impl": { "$path": "tools/core/build/ImGui.luau" } },
|
||||
"ImPlot": { "$path": "ImPlot.lua" }
|
||||
},
|
||||
"StarterPlayer": { "StarterPlayerScripts": { "ImPlotExample": { "$path": "examples/roblox/main.client.luau" } } }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
local RS = game:GetService("ReplicatedStorage")
|
||||
local RunService = game:GetService("RunService")
|
||||
local G = require(RS:WaitForChild("ImGui"))
|
||||
local ImPlot = require(RS:WaitForChild("ImPlot"))(G)
|
||||
local ImGui = G.ImGui
|
||||
|
||||
ImGui.CreateContext()
|
||||
G.ImGui_ImplRoblox.Init(game:GetService("Players").LocalPlayer:WaitForChild("PlayerGui"))
|
||||
RunService.RenderStepped:Connect(function()
|
||||
G.ImGui_ImplRoblox.NewFrame()
|
||||
ImGui.NewFrame()
|
||||
-- ImPlot example goes here
|
||||
ImGui.Render()
|
||||
G.ImGui_ImplRoblox.RenderDrawData(ImGui.GetDrawData())
|
||||
end)
|
||||
@@ -0,0 +1,5 @@
|
||||
local RS = game:GetService("ReplicatedStorage")
|
||||
local G = require(RS:WaitForChild("ImGui"))
|
||||
local ImPlot = require(RS:WaitForChild("ImPlot"))(G)
|
||||
assert(type(ImPlot) == "table", "module did not return a table")
|
||||
print("OK")
|
||||
Submodule
+1
Submodule tools/core added at 7cd2ee010a.
Executable
+9
@@ -0,0 +1,9 @@
|
||||
#!/usr/bin/env bash
|
||||
# Runs every tests/t_*.luau against the core (tools/core submodule) in the Roblox mock.
|
||||
cd "$(dirname "$0")/.."
|
||||
fail=0
|
||||
for t in tests/t_*.luau; do
|
||||
out=$(python3 tools/core/tools/test/run.py --module ImPlot=ImPlot.lua --main "$t" --quiet --roblox 2>&1)
|
||||
if echo "$out" | grep -q "^OK"; then echo "PASS $t"; else echo "FAIL $t"; echo "$out" | tail -20; fail=1; fi
|
||||
done
|
||||
exit $fail
|
||||
+55
@@ -0,0 +1,55 @@
|
||||
// Sample app built with Dear ImGui and ImPlot
|
||||
// This app uses implot and imgui, but does not output to any backend! It only serves as a proof that an app can be built, linked, and run.
|
||||
|
||||
#include "imgui.h"
|
||||
#include "implot.h"
|
||||
#include "stdio.h"
|
||||
|
||||
int main(int, char**)
|
||||
{
|
||||
printf("sample_implot: start\n");
|
||||
|
||||
IMGUI_CHECKVERSION();
|
||||
ImGui::CreateContext();
|
||||
ImPlot::CreateContext();
|
||||
|
||||
// Additional imgui initialization needed when no backend is present
|
||||
ImGui::GetIO().DisplaySize = ImVec2(400.f, 400.f);
|
||||
ImGui::GetIO().Fonts->Build();
|
||||
|
||||
// Render 500 frames
|
||||
for(int counter = 0; counter < 500; ++counter)
|
||||
{
|
||||
ImGui::NewFrame();
|
||||
|
||||
if (ImGui::Begin("Hello, world!"))
|
||||
{
|
||||
ImGui::Text("Hello again");
|
||||
|
||||
if (ImPlot::BeginPlot("My Plot"))
|
||||
{
|
||||
static double values[] = {1., 3., 5.};
|
||||
ImPlot::PlotLine("Values", values, 3);
|
||||
ImPlot::EndPlot();
|
||||
}
|
||||
|
||||
#ifdef IMPLOT_INSTANTIATE_ALL_NUMERIC_TYPES
|
||||
if (ImPlot::BeginPlot("My Plot (long double)"))
|
||||
{
|
||||
static long double values[] = {1., 3., 5.};
|
||||
ImPlot::PlotLine("Values", values, 3);
|
||||
ImPlot::EndPlot();
|
||||
}
|
||||
#endif
|
||||
|
||||
ImGui::End();
|
||||
}
|
||||
|
||||
ImGui::Render();
|
||||
}
|
||||
|
||||
ImPlot::DestroyContext();
|
||||
ImGui::DestroyContext();
|
||||
printf("sample_implot: end\n");
|
||||
return 0;
|
||||
}
|
||||
Vendored
+21
@@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2020 Evan Pezent
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
Vendored
+1
@@ -0,0 +1 @@
|
||||
https://github.com/epezent/implot @ 851cdbdd60d1dfb64c23e987969694de0f547a6b
|
||||
Vendored
+5931
File diff suppressed because it is too large.
Load diff
Vendored
+1408
File diff suppressed because it is too large.
Load diff
Vendored
+3064
File diff suppressed because it is too large.
Load diff
Vendored
+1722
File diff suppressed because it is too large.
Load diff
Vendored
+3527
File diff suppressed because it is too large.
Load diff
+11
@@ -0,0 +1,11 @@
|
||||
[package]
|
||||
name = "4dbug/implot-luau"
|
||||
version = "0.1.0"
|
||||
registry = "https://github.com/UpliftGames/wally-index"
|
||||
realm = "shared"
|
||||
license = "MIT"
|
||||
description = "Immediate-mode 2D plotting for imgui-luau (Roblox / LÖVE)."
|
||||
include = ["ImPlot.lua", "LICENSE", "README.md", "wally.toml", "default.project.json"]
|
||||
|
||||
[peer-dependencies]
|
||||
ImGui = "4dbug/imgui-luau@^0.4.0"
|
||||
Reference in new issue
Block a user