Coder Social home page Coder Social logo

germangb / imgui-ext Goto Github PK

View Code? Open in Web Editor NEW
94.0 94.0 2.0 7.11 MB

Rust library for building imgui GUIs using a derive macro

Home Page: https://crates.io/crates/imgui-ext

License: MIT License

Rust 99.31% Shell 0.69%
graphics imgui rust ui

imgui-ext's People

Contributors

dependabot-preview[bot] avatar dependabot-support avatar germangb avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

imgui-ext's Issues

Rewrite codegen + publish to crates.io

Companion issue to #1


Before publishing to crates.io

  • Refactor rewrite codegen.
  • Maybe rethink project structure (use imgui_ext::ImGuiExt; rather than importing the whole prelude)
  • Write tests Have some test coverage
  • Docs

Use mem::transmute() for foreign types

Using mem::transmute should be safe in most situations as long as the types have the Copy trait.

Right now the implementation is trait based, and traits are implemented for just a handful types (arrays and tuples, mostly). By using mem::transmute, foreign types would be supported:

#[imgui(input)]
foo: [f32; 3]

#[imgui(input)]
foo_cgmath: cgmath::Vector3<f32>

This example works every time because Vector3 has the #[repr(C)] annotation, i.e. its memory layout is the same as the array's. If it didn't, the order of the fields could be altered by the compiler.

Also, the size of the types would have to be checked at runtime, I think...

Sensible default widgets

At the moment, the default widget is a label, which means that if you don't specify a widget type inside an annotation, that particular struct field is rendered as a text label (provided it implements Display), which is not interactive.

The idea is to define the following default widgets for each type:

rust type default widget remarks
i32, u32, f32, [f32; 2], (f32, f32) etc... input
bool checkbox
String, ImString input String might need an extra allocation, which is not desirable

NOTE: Table not definitive

This way you can save a few keystrokes:

#[derive(imgui_ext::Gui)]
struct Example {
    #[imgui(checkbox)]
    a: bool,
    #[imgui(input)]
    b: [f32; 2],
}

// would become equivalent to:

#[derive(imgui_ext::Gui)]
struct Example {
    #[imgui]
    a: bool,
    #[imgui]
    b: [f32; 2],
}

ComboBox widget (enums)

Having a drop down box to select a variant would be awesome (I'm sadly not sure about the derive logic for this).

I could also see this being useful to select an item out of an array of values.

Polish the rustdoc

The documentation page is in need of a lot of polish. I'm trying to improve it incrementally with every new commit, but the constant context switching between writing features/refactoring and writing docs leaves a lot to desire...

On top of that, I'm not a native speaker (english) which I think it shows in the sometimes poor use of grammar and lack of lexicon.

Some of the things I think need to be done:

  • Fix the rushed-looking parts.
  • Some of the examples are marked as no_run or ignore (lacking set up code).
  • Some of the pages have too much information, instead of simple, concise example...

Upgrade to imgui 0.2.1

Hey,

this seems to be pretty awesome and I'd love to use it. However I am bound to imgui 0.2.1^ for my project, and manually upgrading resulted in 1458 errors. Not-Upgrading resulted in one error about a version mismatch between the imgui::Ui struct versions.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.