You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// Implement custom methods that can be called from GDScript.
66
+
#[godot_api]
67
+
implPlayer {
68
+
#[func]
69
+
fntake_damage(&mutself, damage:i32) {
70
+
self.hitpoints -=damage;
71
+
godot_print!("Player hit! HP left: {}", self.hitpoints);
72
+
73
+
// Update health bar.
74
+
self.health_bar.set_value(self.hitpoints asf64);
75
+
76
+
// Call Node methods on self, via mutable base access.
77
+
ifself.hitpoints <=0 {
78
+
self.base_mut().queue_free();
79
+
}
80
+
}
81
+
}
82
+
```
29
83
30
-
> [!WARNING]
31
-
> The public API introduces breaking changes from time to time, primarily motivated by new features and improved ergonomics.
32
-
> Our [crates.io releases][crates-io] adhere to SemVer, but may lag behind the `master` branch. See also [API stability] in the book.
33
84
34
-
**Features:** Most Godot APIs have been mapped at this point. The current focus lies on a more natural Rust experience and enable more design
35
-
patterns that come in handy for day-to-day game development. See [#24] for an up-to-date feature overview.
85
+
## Development status
36
86
37
-
At the moment, there is experimental support for [Wasm], [Android] and [iOS], but documentation and tooling is still lacking. Contributions are very welcome!
87
+
The library has evolved a lot since 2023 and is now in a usable state for projects such as games, editor plugins, tools and other applications
88
+
based on Godot. See [ecosystem] to get an idea of what users have built with godot-rust.
38
89
39
-
**Bugs:** Most undefined behavior related to the FFI layer has been ironed out, but there may still be occasional safety issues. Apart from that,
40
-
new additions to the library are typically not feature-complete from the start, but become more robust with feedback and testing over time.
41
-
To counter bugs, we have an elaborate CI suite including clippy, unit tests, engine integration tests and memory sanitizers. Even hot-reload is tested!
90
+
Keep in mind that we occasionally introduce breaking changes, motivated by improved user experience or upstream changes. These are usually
91
+
minor and accompanied by migration guides. Our [crates.io releases][crates-io] adhere to SemVer, but lag a bit behind the `master` branch.
92
+
See also [API stability] in the book.
42
93
94
+
The vast majority of Godot APIs have been mapped to Rust. The current focus lies on a more natural Rust experience and enable more design
95
+
patterns that come in handy for day-to-day game development. To counter bugs, we use an elaborate CI suite including clippy, unit tests,
96
+
engine integration tests and memory sanitizers. Even hot-reload is tested!
43
97
44
-
## Getting started
98
+
At the moment, there is experimental support for [Wasm], [Android] and [iOS], but documentation and tooling is still lacking.
99
+
Contributions are very welcome!
45
100
46
-
To dive into Rust development with gdext, check out [the godot-rust book][book]. The book is still under construction,
47
-
but already covers a _Hello World_ setup as well as several more in-depth chapters.
48
101
49
-
To consult the API reference, have a look at the online [API Docs].
102
+
## Getting started
50
103
51
-
Furthermore, we provide some practical examples and small games in the [demo-projects] repository.
104
+
The best place to start is [the godot-rust book][book]. Use it in conjunction with our [API Docs].
105
+
We also provide practical examples and small games in the [demo-projects] repository.
52
106
53
107
If you need help, join our [Discord] server and ask in the `#help` channel!
54
108
@@ -58,29 +112,30 @@ If you need help, join our [Discord] server and ask in the `#help` channel!
58
112
We use the [Mozilla Public License 2.0][mpl]. MPL tries to find a balance between permissive (MIT, Apache, Zlib) and copyleft licenses (GPL, LGPL).
59
113
60
114
The license provides a lot of freedom: you can use the library commercially and keep your own code closed-source,
61
-
i.e. game development is not restricted. The main condition is that if you change gdext_itself_, you need to make
115
+
i.e. game development is not restricted. The main condition is that if you change godot-rust_itself_, you need to make
62
116
those changes available (and only those, no surrounding code).
63
117
64
118
65
119
## Contributing
66
120
67
121
Contributions are very welcome! If you want to help out, see [`Contributing.md`](Contributing.md) for some pointers on getting started.
0 commit comments