hudhook icon indicating copy to clipboard operation
hudhook copied to clipboard

egui support

Open Alleexxi opened this issue 2 years ago • 12 comments

title says everything

Alleexxi avatar Aug 10 '22 20:08 Alleexxi

It does not say everything everything. For instance, it doesn't mention the words "please" and "thank you" that I, like any self respecting person, would expect of some stranger on the internet asking me to add such a complex feature to a project of mine, for free, as opposed to some one liner without even a hint of punctuation that was coughed up in barely a few seconds of thought.

But yeah. egui support is something I am interested in providing eventually, though it is going to be quite a complex undertaking.

veeenu avatar Aug 10 '22 23:08 veeenu

Sorry, its just almost every issue i see/read is something like i wrote. So i though thats how u "write" issue's. Sorry if that doesn't make sense. I would really appreciate egui support because i like the design/look of it more than imgui.

Alleexxi avatar Aug 11 '22 01:08 Alleexxi

It's cool. I'm not sure how other maintainers feel about that in general, but courtesy and kindness are a hard boundary for me.

Regardless of how other people behave, if I may offer a piece of advice: kindness will always go a long way, because when you write anywhere on the internet it's always real people who will read you, and all other things being equal, people always prefer to be treated kindly.

egui does indeed look good and has the added value of being pure Rust. It's not the first time I consider it.

We will have to build 6 units of code, so to speak; 3 egui renderers (dx9, dx11, dx12) and one hook for each of those. Most of the code could be shared with the current imgui implementations but it'll still take a bit of testing and experimentation.

veeenu avatar Aug 11 '22 06:08 veeenu

i would try to make it support egui myself. but i am too stupid to get the example to work

Edit: when i try to build the hookyou example it give me a error

error[E0603]: struct ImguiRenderLoopFlags is private --> src\lib.rs:6:45 | 6 | use hudhook::hooks::dx11::{ImguiRenderLoop, ImguiRenderLoopFlags}; | ^^^^^^^^^^^^^^^^^^^^ private struct |

Edit 2: sorry if this is offtopic

Alleexxi avatar Aug 11 '22 12:08 Alleexxi

Although egui seems interesting, I'd say it'd be out of the scope of this project since it heavily relies on imgui general behavior. It would involve either writing specific wrappers (as @veeenu said) or trying to write a more 'generic' code that at the end of the day would hurt maintainability.

I'd love to see more options for hooking into games, but I'd prefer keeping this one as imgui only. Of course, that's just my view.

Maybe this repository would be a good template for starting another one with an egui implementation.

etra0 avatar Aug 11 '22 21:08 etra0

I don't fully agree with that -- after all, the API surface that the three current hooks share and expose to the top level is relatively minimal and quite generic, and otoh each egui renderer would share a lot of code with imgui's, so keeping and maintaining everything together may be simpler than rewriting the same mechanisms elsewhere, as the core problems to support a rendering hook have already been solved, so to speak.

Besides, it is not necessary to abstract all the way and we can get away with breaking the library in a few top-level traits (i.e. imgui hooks with whatever renderer vs egui hooks with whatever renderer).

But yeah, in general this will require a modicum of careful and proper design.

Luckily Rust has a lot of mechanisms to ease a similar process, feature flags and the excellent module system being two great examples.

veeenu avatar Aug 11 '22 22:08 veeenu

Edit: when i try to build the hookyou example it give me a error

error[E0603]: struct ImguiRenderLoopFlags is private --> src\lib.rs:6:45 | 6 | use hudhook::hooks::dx11::{ImguiRenderLoop, ImguiRenderLoopFlags}; | ^^^^^^^^^^^^^^^^^^^^ private struct |

This is a genuine issue, I created #23 to track it.

veeenu avatar Aug 12 '22 08:08 veeenu

maybe relevant: https://github.com/sy1ntexx/egui-d3d11

etra0 avatar Mar 15 '23 04:03 etra0

maybe relevant: https://github.com/sy1ntexx/egui-d3d11

A few of these libraries has indeed started to appear. To me it seems like they sorta follow the same base.

They can be found here: DirectX 9 DirectX 11 OpenGL 3

I definitely also agree that egui support could be very interesting to support here, especially given that egui is written purely in Rust, although I am unsure of what changes it’d require in hudhook.

Jakobzs avatar Apr 24 '23 00:04 Jakobzs

hi! is this still planned? also, i noticed #122 - does that PR already make it possible to implement egui outside of hudhook itself?

RubberDuckShobe avatar Mar 25 '24 23:03 RubberDuckShobe

There is active work being done on it, but the codebase is not in a state where abstracting things away altogether will be practical; no matter how you slice it, the task will result in a lot of added code so not sure how this will work out.

veeenu avatar Mar 26 '24 05:03 veeenu

OpenGL DirectX11 Dunno maybe something of this can help as well.

luadebug avatar Aug 06 '24 00:08 luadebug