-
Notifications
You must be signed in to change notification settings - Fork 178
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Project AngelHUD #2490
Project AngelHUD #2490
Conversation
Impressive! Why not use this logic to draw the default HUD also? |
I absolutely intend to do that - in fact, it's necessary because the default truck HUD is made via the MyGUI-based HUD system, so it must go away before we port to OGRE 1.12. The airplane HUD, in contrast, is hardcoded, which is also not optimal. I'll also make ImGui available to terrain scripts - custom race scoreboards etc... |
Pretty sweet. Might be a bit of a stretch, but would vehicles dashboards be able to draw IMGUI? (similar to |
@CuriousMike56 Not at all, in fact it's mandatory since the current MyGUI-HUD can also render to texture and some mods rely on it. Not to mention I want the feature, too. It should be pretty straightforward to implement. I added initial bindings to SimBuffer - most of these fields are available, see screenshot on top or commit message for example use. |
Got this warning when compiling
|
@tritonas00 Something goes wrong outside AngelScript, otherwise you'd see more detailed error messages from AngelScript itself. I'll tighten the surrounding checks and fix the warning. |
Yes it works now, thanks! Epic! Now need to find a way to use data.engine_rpm as an imgui histogram or progressbar input lol Also @only-a-ptr have you seen this? http://floooh.github.io/oryol-sticky-tests/imgui-highdpi-sapp.html |
@tritonas00 Segfault on import is fixed |
821bf36
to
025c0c1
Compare
403bd35
to
8f49029
Compare
Added directory ROR_HOME/projects. Each subdir contains 'project.json', resources (meshes, materials, textures) and one or more truckfiles. The ingame top menubar contains 'Projects' menu to spawn modified truckfiles and to import existing ones.
Status: import/export for nodes and beams Added option to accept all ; as ;grp:
Goal: Allow modders to create and test custom vehicle HUD in-game using AngelScript + DearIMGUI. User scenario: 1. enter simulation and create a project using top menubar. Projects are created in "MyDocuments\MyGames\RigsOfRods\projects" as subdirectories, each containing project JSON and truckfiles (dubbed snapshots). Unlike regular mods, all resources within a project are always fully reloaded from disk, allowing modder to add/remove/change data on the go. 2. add angelscript file to the truckfile via section 'scripts' (to be implemented) 3. within the angelscript, define a function to be invoked on each rendered frame. 4. within the angelscript function, draw the HUD using DearIMGUI (bindings partially implemented, see ImGuiAngelscript.cpp) reading data from simbuffer (bindings partially implemented, see GameScript.cpp). The simbuffer contains all data described in https://docs.rigsofrods.org/vehicle-creation/making-custom-hud/ and a lot more, allowing modder to create truly giagnostic GUI - DearIMGUI is packed by very capable widgets and a flexible drawing API. Graphical HUD can be done simply by calling ImGui::Image() with texture name. -- TEST SCRIPT -- int setup(string arg) { string msg; msg = "setup() works! arg: " + arg; log(msg); return 0; } int frame_num = 0; int loop() { string msg; msg = "Frame: " + frame_num; // Opens window "Debug" (DearIMGUI feat) ImGui::Text(msg); frame_num++; return 0; } -- TEST TRUCK -- scripts frame-step: test_script_filename.as, Any text (including spaces) passed to `setup()` as `arg`
// ----- Example script ----- int setup(string arg) { return 0; } int loop(GfxActor@ actor) { ImGui::Begin("SimBuffer test", true); ActorSimBuffer@ data = actor.GetSimDataBuffer(); string str; str = "Pos: X" + data.pos.x + ", Y" + data.pos.y + ", Z" + data.pos.z; ImGui::Text(str); ImGui::End(); return 0; }
Added enums PropAnim[Flag|Mode] - copypastes from BeamData.h but used for different purpose (rendering vs. simulation)
Also fixed "color" (Ogre::ColourValue) not registered properly.
Thanks to @tritonas00 for the base layout.
5a0bc37
to
60f8419
Compare
Think of this as an excercise in understanding OGRE internals :) I'd like to use OGRE 1.12x's builtin imgui support, but it seems it only supports one font, and I'd like fonts to be loadable ad-hoc via AngelScript. Thus, I'm doing this middle-step where I copy OGRE code to RoR (see gui/imgui/README for all details) to experiment with it, develop a solution and contribute it back to OGRE.
This is a replacement for our MyGUI-based custom HUD system. Goal: Allow modders to create and test custom vehicle HUD in-game using AngelScript + DearIMGUI.
User scenario:
enter simulation and create a project using top menubar. Projects are created in "MyDocuments\MyGames\RigsOfRods\projects" as subdirectories, each containing project JSON and truckfiles (dubbed snapshots). Unlike regular mods, all resources within a project are always fully reloaded from disk, allowing modder to add/remove/change data on the go.
add angelscript file to the truckfile using button "+ Add example script" in projects top menu. Details: Project AngelHUD #2490 (comment)
within the angelscript, define function
int setup(string arg)
to be invoked once and functionint loop()
to be invoked on each rendered frame.within the angelscript function, draw the HUD using DearIMGUI, reading data from simbuffer (see example code). The simbuffer contains all data described in https://docs.rigsofrods.org/vehicle-creation/making-custom-hud/ and a lot more, allowing modder to create truly diagnostic GUI - DearIMGUI is packed with very capable widgets and a flexible drawing API. Graphical HUD can be done simply by calling ImGui::Image() with texture name.
Notes: