39 Commits

Author SHA1 Message Date
Jonathan Spira
44b8621d20 docking branch 2024-10-02 08:48:59 -04:00
Jonathan Spira
50e166e84f clippy don't be so mad! 2023-09-14 23:03:46 -04:00
Rodrigo Rivas Costa
2fcfdd55f4 Add callbacks to the draw_list. 2023-04-04 10:00:01 +02:00
Robin
0cb64e8b59 Fixed build errors with docking feature 2022-12-21 21:21:57 +01:00
Robin Quint
e51af80da7 upgraded imgui to 1.89.1, changed winit-support to use new event io 2022-12-21 15:14:31 +01:00
Jiří Sejkora
30f8f04dcf Remove im_str! usage from examples in docs 2022-02-27 20:48:45 -05:00
Jack OntheGoMac
5cecf3f82c fix doc warnings 2021-12-23 13:04:55 -08:00
dbr
291b7a5b47 Misc fixes
Mainly changes from newer bindgen
2021-10-27 21:06:46 +11:00
dbr
929dd2fcfe Bulk of changes required to support main + docking 2021-10-27 19:24:12 +11:00
dbr
e25e51d3fc Remove redundant as_slice call per PR feedback 2021-10-13 15:42:30 +11:00
dbr
416272a48a fmt 2021-10-12 13:26:33 +11:00
dbr
eb1bd01179 Add basic polyline methods to draw list 2021-10-12 13:24:50 +11:00
Jack Mac
1d15196b5e removed the lifetime from the majority of the library 2021-10-01 11:36:22 -04:00
Jack Mac
8b22856090 OKAY and this is mostly done 2021-09-30 18:58:38 -04:00
Jack Mac
ff10eb01c8 added scare warning to string editing to explain null-termination 2021-09-15 12:14:05 -04:00
Jack Mac
50edf02d39 added deny(rust_2018_idioms)
we might as well be on 2018 if we're going to have to upgrade to 2021 in a few weeks!
2021-09-15 11:59:00 -04:00
dbr
6007bc5a4b Update imgui to 1.84.2 #512
Changes required:
- Overloaded methods named slightly differently (e.g sys::igPlotHistogramFloatPtr to sys::igPlotHistogram_FloatPtr)
- ImGuiNavInput_KeyMenu_ was removed upstream, so NavInput::INTERNAL_COUNT needed tweaked
2021-09-14 11:17:55 +10:00
dbr
0784c95f29 fmt 2021-09-13 18:24:38 +10:00
dbr
52898779e1 Allow simultaneous access to different draw lists
Only need to prevent accessing the same draw-list twice at one time

Closes #488
2021-09-13 18:22:51 +10:00
Thom Chiovoloni
cb918fc652 Update Dear Imgui to v1.82 2021-04-04 17:29:16 -07:00
dbr
107133c799 Fix functional conflicts
- `ui.same_line()` no longer needs the default value specified \o/
- Doctests now actually being run, need to mark a code block as not-Rust
2021-03-09 10:37:32 +11:00
dbr/Ben
965dd87892
Merge branch 'master' into drawimage 2021-03-09 10:27:23 +11:00
toyboot4e
9b90f0e9d0 Add doc aliases 2021-03-05 14:00:06 +09:00
dbr
6b735e9aab Somehow missed reverting the DrawList prefix from Triangle 2021-02-25 23:08:15 +11:00
dbr
d98e004454 cargo fmt 2021-02-25 21:04:40 +11:00
dbr
caf8c8d95a Fix doc link to imgui::Image
Unsure why but [`imgui::Image`] doesn't work while [`crate::Image`] does
2021-02-24 20:13:07 +11:00
dbr
a4f74624e1 Fix wording in imgui::draw_list docs 2021-02-24 20:07:05 +11:00
dbr
759ed18202 Remove DrawList prefix from widgets
The prefix makes things too cluttered and only helps in fairly specific circumstances
2021-02-24 20:06:36 +11:00
dbr
6bf75335ed cargo fmt 2021-02-20 20:21:26 +11:00
dbr
68867ea580 Basic doc onimgui::draw_list module 2021-02-20 20:19:55 +11:00
dbr
20864b53de Add "DrawList" prefix Line, Rect, Triangle, Circle, BezierCurve
Also make their constructers public

For consistency with newly added DrawListImage (which was ambiguous with the Image widget)
2021-02-20 20:03:13 +11:00
dbr
1a55b4ae24 Add "DrawList" prefix to Image/ImageQuad/ImageRounded
Also make their constructions public just in case it leads to neater code in some circumstances
2021-02-20 20:00:53 +11:00
dbr
714710c681 Move ImDrawCornerFlags out of legacy.rs as per #445
Becomes draw_list::CornerFlags with Rust-style casing and documentation as necessary
2021-02-11 14:16:00 +11:00
dbr
e83f71bf82 Fix clippy lint about redundant .into() 2021-02-10 18:24:35 +11:00
dbr
028ebf538f Make DrawListMut::add_image doc example more concise
Longer example code in 'imgui-examples/examples/custom_textures.rs' shows more detailed usage
2021-02-10 17:49:14 +11:00
dbr
00d8180671 Add DrawListMut::add_image and friends 2021-02-10 14:56:26 +11:00
Thom Chiovoloni
53828505ed Fix compile errors with 1.80 update 2021-02-01 08:37:31 -08:00
Thom Chiovoloni
4f1cde06f2 ImColor changes and improvements:
- Renamed to `ImColor32` to avoid confusion with `ImColor` from the C++.
  code: https://github.com/ocornut/imgui/blob/9499afdf/imgui.h#L2180
    - Eventually I'd probably like to add something mirroring the actual
      `ImColor`.

- Now supports construction and access from `const fn` where possible.
    - Still impossible for the `f32` APIs

- Now supports `.r`/`.g`/`.b`/.a` field access (read and write), by way
  of a new type `imgui::color::ImColor32Fields`, which essentially
  exists just to serve this purpose. This is a bit cludgey, but lets us
  provide the ability for reading and writing `r/g/b/a` values without
  adding many `fn get_r(self) -> u8` and `fn set_r(&mut self, r: u8);`
  style functions.

- No longer requires FFI calls to construct from RGB floats.
    - This gives much more freedom to the optimizer, as external calls
      are impenetrable optimization barriers (It has to pessimistially
      assume that they read/write to all globally accessable memory, and
      must be called in the exact order that is listed).
    - Also, it allows inlining these calls, and avoid computing the same
      value twice (if the args are the same).

    - Also improves usage from IDEs, debuggers, etc, and avoids a rare
      possibility of UB if NaN was passed in (however, this almost
      certainly could only cause problems if cross-lang LTO was used,
      which I believe we don't support).

    - This code is more complex than needed, but was taken from another
      project of mine (functions were renamed to line up with imgui's
      names), and has good (literally exhaustive) test coverage.

    - Unfortunately, float arithmetic in const fn is still not allowed,
      so for now these aren't usable `const fn`.

- Added utility constants to mirror the `IM_COL32_WHITE`,
  `IM_COL32_BLACK`, `IM_COL32_BLACK_TRANS` constants.
2021-02-01 01:45:39 -08:00
nsf
171d86aea1 Refactor WindowDrawList into DrawListMut and fix #413.
- Rename WindowDrawList -> DrawListMut. It's not about window draw lists, but
  about background/foreground draw lists as well. The naming was not an easy
  choice, but seems like in rust it's a common convention to add a Mut suffix for
  mutable entities. Imgui-rs already has DrawList and it acts as an immutable
  reference type for rendering implementations to consume. Hence the name
  DrawListMut, which becomes a mutable reference to draw list with methods
  to modify it.
- Add Ui::get_foreground_draw_list(). Same as Ui::get_background_draw_list()
  but for foreground.
- Add draw_list example which shows the use of all three draw lists
  (window, bg, fg).
2020-12-31 20:20:36 -08:00