Skip to content

Commit 056847e

Browse files
committed
Add README.md
1 parent 0efafaf commit 056847e

3 files changed

Lines changed: 66 additions & 0 deletions

File tree

README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,11 @@ Unity Native Plugin API for Rust
1515
```cargo
1616
[dependencies]
1717
unity-native-plugin = { version = "*", features = ["d3d11"] }
18+
19+
# * Support features
20+
# * d3d11 - IUnityGraphicsD3D11
21+
# * d3d12 - IUnityGraphicsD3D12
22+
# * profiler - IUnityProfiler
1823
```
1924
* If you use Vulkan, define "unity-native-plugin-vulkan" in your dependencies.
2025
```cargo

unity-native-plugin-tester/Cargo.toml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,18 @@ name = "unity-native-plugin-tester"
33
version = "0.4.1"
44
authors = ["Yasuhiro Taniuchi"]
55
edition = "2018"
6+
license = "MIT"
7+
description = "Unity Native Plugin API Tester Library"
8+
homepage = "https://github.com/aosoft/unity-native-plugin-rs"
9+
repository = "https://github.com/aosoft/unity-native-plugin-rs"
10+
readme = "README.md"
11+
categories = ["api-bindings", "game-engines"]
12+
keywords = ["unity", "ffi"]
13+
include = [
14+
"**/*.rs",
15+
"Cargo.toml",
16+
"../LICENSE"
17+
]
618

719
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
820

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
Unity Native Plugin API Tester Library
2+
====
3+
4+
This library is for test runs of native plugin code written in Rust without Unity.
5+
6+
## How to use
7+
8+
* Define in Cargo.toml
9+
```cargo
10+
[dev-dependencies]
11+
unity-native-plugin-tester = { version = "*", features = ["d3d11"] }
12+
13+
# * Support features
14+
# * d3d11 - IUnityGraphicsD3D11
15+
```
16+
17+
* Write the test code in lib.rs.
18+
```rust
19+
#[test]
20+
fn test() {
21+
let instant = std::time::Instant::now();
22+
unity_native_plugin_tester::d3d11::test_plugin_d3d11(
23+
(256, 256), // (a)
24+
|_window, _context| {}, // (b)
25+
|_window, context| { // (c)
26+
let n = (instant.elapsed().as_millis() % 1000) as f32 / 1000.0;
27+
FillTexture(context.back_buffer().as_raw() as _, 0.0, 0.0, n, 1.0);
28+
unity_native_plugin_tester::window::LoopResult::Continue
29+
},
30+
|_, _| {}, // (d)
31+
unity_plugin_load, // (e)
32+
unity_plugin_unload, // (f)
33+
)
34+
.unwrap();
35+
}
36+
```
37+
* usage
38+
* (a) Size of the client area (back buffer)
39+
* (b) Initialize function
40+
* (c) Test code function
41+
* (d) Finalize function
42+
* (e) "unity_plugin_load" method (Defined by the unity_native_plugin_entry_point macro)
43+
* (f) "unity_plugin_unload" method (Defined by the unity_native_plugin_entry_point macro)
44+
45+
* Run the test
46+
```
47+
% cargo test test
48+
```
49+

0 commit comments

Comments
 (0)