Skip to content

Commit

Permalink
Merge pull request #530 from sanbox-irl/prep-0.8.0
Browse files Browse the repository at this point in the history
prep 0.8.0
  • Loading branch information
sanbox-irl committed Sep 17, 2021
2 parents 5f441b7 + 921a9d4 commit f2fdfd4
Show file tree
Hide file tree
Showing 12 changed files with 140 additions and 101 deletions.
100 changes: 65 additions & 35 deletions CHANGELOG.markdown

Large diffs are not rendered by default.

13 changes: 1 addition & 12 deletions LICENSE-APACHE
Expand Up @@ -175,18 +175,7 @@

END OF TERMS AND CONDITIONS

APPENDIX: How to apply the Apache License to your work.

To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "{}"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.

Copyright {yyyy} {name of copyright owner}
Copyright {2021} the imgui-rs developers

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion LICENSE-MIT
@@ -1,4 +1,4 @@
Copyright (c) 2015-2020 The imgui-rs Developers
Copyright (c) 2015-2021 The imgui-rs Developers

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
24 changes: 14 additions & 10 deletions README.markdown
Expand Up @@ -3,7 +3,7 @@
[![Build Status](https://github.com/imgui-rs/imgui-rs/workflows/ci/badge.svg)](https://github.com/imgui-rs/imgui-rs/actions)
[![Latest release on crates.io](https://img.shields.io/crates/v/imgui.svg)](https://crates.io/crates/imgui)
[![Documentation on docs.rs](https://docs.rs/imgui/badge.svg)](https://docs.rs/imgui)
[![Wrapped Dear ImGui Version](https://img.shields.io/badge/Dear%20ImGui%20Version-1.80-blue.svg)](https://github.com/ocornut/imgui)
[![Wrapped Dear ImGui Version](https://img.shields.io/badge/Dear%20ImGui%20Version-1.84.2-blue.svg)](https://github.com/ocornut/imgui)

(Recently under new maintenance, things subject to change)

Expand All @@ -28,20 +28,24 @@ Window::new("Hello world")
## Main library crates

- imgui: High-level safe API
- imgui-glium-renderer: Renderer implementation that uses the `glium` crate
- imgui-gfx-renderer: Renderer implementation that uses the `gfx` crate (_not
the new gfx-hal crate_)
- imgui-winit-support: Backend platform implementation that uses the `winit`
crate (latest by default, but earlier versions are supported via feature flags)
- imgui-glow-renderer: Renderer implementation that uses the `imgui` crate
- imgui-glium-renderer: Renderer implementation that uses the `glium` crate
- imgui-sys: Low-level unsafe API (automatically generated)

Additionally, the following are no longer maintained, but might work still:

- imgui-gfx-renderer: Renderer implementation that uses the `gfx` crate (_not
the new gfx-hal crate_)

## Features

- Bindings for Dear ImGui that can be used with safe Rust. Note: API coverage
is not 100%, but will keep improving over time.
- Builder structs for use cases where the original C++ library uses optional
function parameters
- Easy integration with Glium / pre-ll gfx (renderer)
- Easy integration with `glow`/ `glium`
- Easy integration with winit (backend platform)
- Optional support for the freetype font rasterizer

Expand Down Expand Up @@ -72,10 +76,10 @@ responsibilities include the following:

The most tested platform/renderer combination is `imgui-glium-renderer` +
`glium` + `imgui-winit-support` + `winit`, but this is not the only possible
combination. There's also `imgui-gfx-renderer`, and you can find additional 3rd
party crates that provide a wider support for more libraries (e.g. raw OpenGL,
SDL2). You can also write your own support code if you have a more advanced use
case, because **imgui-rs is not tied to any specific graphics / OS API**.
combination. There's also `imgui-glow-renderer`, which will increasingly replace
`glium`, and you can find additional 3rd party crates that provide a wider
support for more libraries (e.g. raw OpenGL, SDL2). You can also write your own
support code if you have a more advanced use case, because **imgui-rs is not tied to any specific graphics / OS API**.

## Compiling and running the demos

Expand All @@ -85,7 +89,7 @@ cd imgui-rs
git submodule update --init --recursive
```

Main examples are located in the imgui-examples directory.
Main examples are located in the `imgui-examples` directory.

```bash
# At the reposity root
Expand Down
70 changes: 40 additions & 30 deletions docs/upgrading-imgui.md
Expand Up @@ -4,69 +4,79 @@ This document covers how to upgrade imgui-rs to a new version of the upstream C+

The process is much the same to build imgui-rs for a tagged release (as shown) as it is for any arbitrary revision (such as one on a different branch)


## Step by step

1. Ensure the submodules are populated (`git submodule init` and `git submodule update --recursive`)

2. Check out the desired version of the `imgui-sys/third-party/imgui/` submodule

$ pwd
.../imgui-sys/third-party/imgui
$ git checkout v1.81
Previous HEAD position was 58075c44 Version 1.80
HEAD is now at 4df57136 Version 1.81
```sh
$ pwd
.../imgui-sys/third-party/imgui
$ git checkout v1.81
Previous HEAD position was 58075c44 Version 1.80
HEAD is now at 4df57136 Version 1.81
```

3. Ensure `luajit` is installed, as this is required by cimgui's generator.

$ luajit --help
$ luajit --help

4. Check out the `cimgui` project somewhere, as we use use the generator within this

$ git clone --recursive https://github.com/cimgui/cimgui.git /tmp/cimgui
```sh
git clone --recursive https://github.com/cimgui/cimgui.git /tmp/cimgui
```

5. Ensure the `imgui` submodule within `cimgui` is pointing to the same revision as in `imgui-rs`

$ cd /tmp/cimgui/imgui
$ git checkout v1.81
HEAD is now at 4df57136 Version 1.81
```sh
$ cd /tmp/cimgui/imgui
$ git checkout v1.81
HEAD is now at 4df57136 Version 1.81
```

6. Back in `imgui-rs/imgui-sys/third-party/` - run the `update-cimgui-output.sh` helper script to execute cimgui's generator

$ pwd
.../imgui-sys/third-party
$ ./update-cimgui-output.sh /tmp/cimgui/
[...]
copyfile ./output/cimgui.h ../cimgui.h
copyfile ./output/cimgui.cpp ../cimgui.cpp
all done!!
```sh
$ pwd
.../imgui-sys/third-party
$ ./update-cimgui-output.sh /tmp/cimgui/
[...]
copyfile ./output/cimgui.h ../cimgui.h
copyfile ./output/cimgui.cpp ../cimgui.cpp
all done!!
```

This updates various files in the imgui-sys folder like `cimgui.cpp`, `definitions.json` and so on
This updates various files in the imgui-sys folder like `cimgui.cpp`, `definitions.json` and so on

With this step, we now have new C bindings to the desired verison of Dear ImGui.
With this step, we now have new C bindings to the desired verison of Dear ImGui.

7. Back in the root of the imgui-rs repo, run `cargo xtask bindgen`

$ cargo xtask bindgen
```sh
$ cargo xtask bindgen
Finished dev [unoptimized + debuginfo] target(s) in 0.04s
Running `target/debug/xtask bindgen`
Executing bindgen [output = .../imgui-rs/imgui-sys/src/bindings.rs]
Success [output = .../imgui-rs/imgui-sys/src/bindings.rs]
Executing bindgen [output = .../imgui-rs/imgui-sys/src/wasm_bindings.rs]
Success [output = .../imgui-rs/imgui-sys/src/wasm_bindings.rs]
Running `target/debug/xtask bindgen`
Executing bindgen [output = .../imgui-rs/imgui-sys/src/bindings.rs]
Success [output = .../imgui-rs/imgui-sys/src/bindings.rs]
Executing bindgen [output = .../imgui-rs/imgui-sys/src/wasm_bindings.rs]
Success [output = .../imgui-rs/imgui-sys/src/wasm_bindings.rs]
```

This requires bindgen to be installed (`cargo install bindgen` should do it)
This requires bindgen to be installed (`cargo install bindgen` should do it)

This step generates `imgui-sys/src/bindings.rs` which is used by `imgui/src/*`
This step generates `imgui-sys/src/bindings.rs` which is used by `imgui/src/*`

8. Run `cargo build` and fix any errors caused by changes upstream (see next section)

9. Run the tests with `cargo test`.

10. Try running one of the examples

cargo run --example test_window_impl

```sh
cargo run --example test_window_impl
```

## Common sources of problems

Expand Down
3 changes: 3 additions & 0 deletions imgui-gfx-examples/Cargo.toml
Expand Up @@ -9,6 +9,9 @@ repository = "https://github.com/imgui-rs/imgui-rs"
license = "MIT/Apache-2.0"
publish = false

[badges]
maintenance = { status = "deprecated" }

[features]
opengl = ["imgui-gfx-renderer/opengl"]
# FIXME
Expand Down
7 changes: 5 additions & 2 deletions imgui-gfx-renderer/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "imgui-gfx-renderer"
version = "0.7.0"
version = "0.8.0"
edition = "2018"
authors = ["The imgui-rs Developers"]
description = "gfx renderer for the imgui crate"
Expand All @@ -14,9 +14,12 @@ opengl = []
directx = []
default = ["opengl"]

[badges]
maintenance = { status = "deprecated" }

[dependencies]
gfx = "0.18"
imgui = { version = "0.7.0", path = "../imgui" }
imgui = { version = "0.8.0", path = "../imgui" }

[target.'cfg(windows)'.build-dependencies]
winapi = { version = "0.3", features = ["d3dcompiler"] }
4 changes: 2 additions & 2 deletions imgui-glium-renderer/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "imgui-glium-renderer"
version = "0.7.0"
version = "0.8.0"
edition = "2018"
authors = ["The imgui-rs Developers"]
description = "Glium renderer for the imgui crate"
Expand All @@ -11,4 +11,4 @@ categories = ["gui", "rendering"]

[dependencies]
glium = { version = ">=0.28, < 0.31", default-features = false }
imgui = { version = "0.7.0", path = "../imgui" }
imgui = { version = "0.8.0", path = "../imgui" }
8 changes: 4 additions & 4 deletions imgui-glow-renderer/Cargo.toml
@@ -1,22 +1,22 @@
[package]
name = "imgui-glow-renderer"
version = "0.7.0"
version = "0.8.0"
edition = "2018"
authors = ["The imgui-rs Developers"]
authors = ["jmaargh and the imgui-rs Developers"]
description = "glow renderer for the imgui crate"
homepage = "https://github.com/imgui-rs/imgui-rs"
repository = "https://github.com/imgui-rs/imgui-rs"
license = "MIT/Apache-2.0"
categories = ["gui", "rendering"]

[dependencies]
imgui = { version = "0.7.0", path = "../imgui" }
imgui = { version = "0.8.0", path = "../imgui" }
glow = "0.10.0"
memoffset = "0.6.4"

[dev-dependencies]
glutin = "0.27.0"
imgui-winit-support = { version = "0.7.1", path = "../imgui-winit-support" }
imgui-winit-support = { version = "0.8.0", path = "../imgui-winit-support" }
image = "0.23"

[features]
Expand Down
2 changes: 1 addition & 1 deletion imgui-sys/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "imgui-sys"
version = "0.7.0"
version = "0.8.0"
edition = "2018"
authors = ["The imgui-rs Developers"]
description = "Raw FFI bindings to dear imgui"
Expand Down
4 changes: 2 additions & 2 deletions imgui-winit-support/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "imgui-winit-support"
version = "0.7.1"
version = "0.8.0"
edition = "2018"
authors = ["The imgui-rs Developers"]
description = "winit support code for the imgui crate"
Expand All @@ -10,7 +10,7 @@ license = "MIT/Apache-2.0"
categories = ["gui"]

[dependencies]
imgui = { version = "0.7.0", path = "../imgui" }
imgui = { version = "0.8.0", path = "../imgui" }
winit-19 = { version = ">= 0.16, < 0.20", package = "winit", optional = true }
winit-20 = { version = ">= 0.20, < 0.22", package = "winit", optional = true }
winit-22 = { version = "0.22", package = "winit", optional = true }
Expand Down
4 changes: 2 additions & 2 deletions imgui/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "imgui"
version = "0.7.0"
version = "0.8.0"
edition = "2018"
authors = ["The imgui-rs Developers"]
description = "High-level Rust bindings to dear imgui"
Expand All @@ -14,7 +14,7 @@ exclude = ["/resources"]

[dependencies]
bitflags = "1"
imgui-sys = { version = "0.7.0", path = "../imgui-sys" }
imgui-sys = { version = "0.8.0", path = "../imgui-sys" }
parking_lot = "0.11"

[features]
Expand Down

0 comments on commit f2fdfd4

Please sign in to comment.