Skip to content

Commit d2019fc

Browse files
authored
Fixing a variety of broken links (#116)
1 parent 5a589da commit d2019fc

File tree

12 files changed

+41
-41
lines changed

12 files changed

+41
-41
lines changed

src/bind/classes.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,21 +33,21 @@ fn init(handle: InitHandle) {
3333

3434
## Class definition
3535

36-
Similar to the [Hello World](../getting-started/hello-world.md#overriding-a-godot-method) example, we can define the `GodotApi` native class as follows:
36+
Similar to the [Hello World](../intro/hello-world.md#overriding-a-godot-method) example, we can define the `GodotApi` native class as follows:
3737
```rust
38-
// Tell godot-rust that this struct is exported as a native class
38+
// Tell godot-rust that this struct is exported as a native class
3939
// (implements NativeClass trait)
4040
#[derive(NativeClass)]
4141

4242
// Specify the base class (corresponds to 'extends' statement in GDScript).
43-
// * Like 'extends' in GDScript, this can be omitted.
43+
// * Like 'extends' in GDScript, this can be omitted.
4444
// In that case, the 'Reference' class is used as a base.
4545
// * Unlike 'extends' however, only existing Godot types are permitted,
4646
// no other user-defined scripts.
4747
#[inherit(Node)]
4848
pub struct GodotApi {}
4949

50-
// Exactly one impl block can have the #[methods] annotation,
50+
// Exactly one impl block can have the #[methods] annotation,
5151
// which registers methods in the background.
5252
#[methods]
5353
impl GodotApi {
@@ -58,10 +58,10 @@ impl GodotApi {
5858
}
5959
```
6060

61-
The [`#[derive(NativeClass)]` macro](https://docs.rs/gdnative/latest/gdnative/derive.NativeClass.html) enables a Rust type to be usable as a _native class_ in Godot. It implements [the `NativeClass` trait](https://docs.rs/gdnative/latest/gdnative/nativescript/trait.NativeClass.html), which fills in the glue code required to make the class available in Godot. Among other information, this includes class name and registry of exported methods and properties. For the user, the utility methods `new_instance()` and `emplace()` are provided for constructing `Instance` objects.
61+
The [`#[derive(NativeClass)]` macro](https://docs.rs/gdnative/latest/gdnative/derive/derive.NativeClass.html) enables a Rust type to be usable as a _native class_ in Godot. It implements [the `NativeClass` trait](https://docs.rs/gdnative/latest/gdnative/export/trait.NativeClass.html), which fills in the glue code required to make the class available in Godot. Among other information, this includes class name and registry of exported methods and properties. For the user, the utility methods `new_instance()` and `emplace()` are provided for constructing `Instance` objects.
6262

6363
The function `new()` corresponds to `_init()` in GDScript. The _base_ is the base object of the script, and must correspond to the class specified in the `#[inherit]` attribute (or `Reference` if the attribute is absent). The parameter can be a shared reference `&T` or a `TRef<T>`.
6464

6565
With a `new()` method, you are able to write `GodotApi.new()` in GDScript. If you don't need this, you can add the `#[no_constructor]` attribute to the struct declaration.
6666

67-
At this point, arguments cannot be passed into the constructor. Consult [this FAQ entry](../faq.md#passing-additional-arguments-to-a-class-constructor) for available workarounds.
67+
At this point, arguments cannot be passed into the constructor. Consult [this FAQ entry](../faq/code.html#can-the-new-constructor-have-additional-parameters) for available workarounds.

src/bind/index.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
# Binding to Rust code
22

3-
This chapter provides an exhaustive list of mechanisms to pass data through the Rust GDNative binding, in both directions:
3+
This chapter provides an exhaustive list of mechanisms to pass data through the Rust GDNative binding, in both directions:
44
* **GDScript -> Rust**, e.g. to react to an input event with custom Rust logic
55
* **Rust -> GDScript**, e.g. to apply a game logic change to a graphics node in Godot
66

7-
The goal is to serve as both an in-depth learning resource for newcomers and a reference to look up specific mechanisms at a later stage. Before delving into this chapter, make sure to read [An Overview of GDNative](gdnative-overview.md), which explains several fundamental concepts used here.
7+
The goal is to serve as both an in-depth learning resource for newcomers and a reference to look up specific mechanisms at a later stage. Before delving into this chapter, make sure to read [An Overview of GDNative](../overview), which explains several fundamental concepts used here.
88

99
The subchapters are intended to be read in order, but you can navigate to them directly:
1010

11-
1. [Class registration](rust-binding/classes.md)
12-
1. [Exported methods](rust-binding/methods.md)
13-
1. [Exported properties](rust-binding/properties.md)
14-
1. [Calling into GDScript from Rust](./rust-binding/calling-gdscript.md)
11+
1. [Class registration](classes.md)
12+
1. [Exported methods](methods.md)
13+
1. [Exported properties](properties.md)
14+
1. [Calling into GDScript from Rust](./calling-gdscript.md)

src/bind/methods.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ In order to receive data from Godot, you can export methods. With the `#[method]
66
> `#[export]` has been renamed to `#[method]` and is now deprecated.
77
> It keeps working for the time being though (i.e. gdnative 0.11).
88
>
9-
> For more information, see [`gdnative::derive::NativeClass`](https://godot-rust.github.io/docs/gdnative/derive/derive.NativeClass.html).
9+
> For more information, see [`gdnative::derive::NativeClass`](https://docs.rs/gdnative/latest/gdnative/derive/derive.NativeClass.html).
1010
1111
The exported method's first parameter is always `&self` or `&mut self` (operating on the Rust object), and the second parameter is `&T` or `TRef<T>` (operating on the Godot base object, with `T` being the inherited type).
1212

@@ -24,7 +24,7 @@ impl GodotApi {
2424
godot_print!("_init()");
2525
Self { enemy_count: 0 }
2626
}
27-
27+
2828
#[method]
2929
fn create_enemy(
3030
&mut self,
@@ -48,7 +48,7 @@ impl GodotApi {
4848
#[method]
4949
fn count_enemies(&self) -> i32 {
5050
self.enemy_count
51-
}
51+
}
5252
}
5353
```
5454
The two creation methods are semantically equivalent, yet they demonstrate how godot-rust implicitly converts the values to the parameter types (unmarshalling). You could use `Variant` everywhere, however it is more type-safe and expressive to use specific types. The same applies to return types, you could use `Variant` instead of `i32`.
@@ -63,7 +63,7 @@ api.create_enemy2("Elf", Vector2(50, 70));
6363

6464
print("enemies: ", api.count_enemies())
6565

66-
# don't forget to add it to the scene tree, otherwise memory must be managed manually
66+
# don't forget to add it to the scene tree, otherwise memory must be managed manually
6767
self.add_child(api)
6868
```
6969

@@ -99,7 +99,7 @@ impl GodotApi {
9999
) {
100100
self.enemies.push(enemy);
101101
}
102-
102+
103103
// You can even return the enemies directly with Vec.
104104
// In GDScript, you will get an array of nodes.
105105
// An alternative would be VariantArray, able to hold different types.

src/bind/traits.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ For more information about how you can customize the behavior of the dervive mac
3131

3232
## Export Trait
3333

34-
The Godot editor retrieves property information from [Object::get_property_list](https://docs.godotengine.org/en/stable/classes/class_object.html#id2). To populate this data, `godot-rust` requires that the [`Export`](https://docs.rs/gdnative/latest/gdnative/nativescript/trait.Export.html) trait be implemented for each type Rust struct.
34+
The Godot editor retrieves property information from [Object::get_property_list](https://docs.godotengine.org/en/stable/classes/class_object.html#id2). To populate this data, `godot-rust` requires that the [`Export`](https://docs.rs/gdnative/latest/gdnative/export/trait.Export.html) trait be implemented for each type Rust struct.
3535

3636
There are no derive macros that can be used for `Export` but many of the primitive types have it implemented by default.
3737

src/faq/code.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -84,13 +84,13 @@ impl SignalEmitter {
8484
data: "initial",
8585
}
8686
}
87-
87+
8888
#[method]
8989
fn update_data(&mut self, #[base] base: TRef<Node>, data: LargeData) {
9090
self.data = data;
9191
base.emit_signal("updated", &[]);
9292
}
93-
93+
9494
#[method]
9595
fn get_data(&self) -> &LargeData {
9696
&self.data
@@ -439,16 +439,16 @@ impl MyNode {
439439

440440
The GDNative API supports any type that implements the [`ToVariant`](https://docs.rs/gdnative/latest/gdnative/core_types/trait.ToVariant.html) and/or [`FromVariant`](https://docs.rs/gdnative/latest/gdnative/core_types/trait.FromVariant.html) traits.
441441

442-
To use a type as a property, in addition to the above, the type will also need to implement the [`Export`](https://docs.rs/gdnative/latest/gdnative/nativescript/trait.Export.html) trait.
442+
To use a type as a property, in addition to the above, the type will also need to implement the [`Export`](https://docs.rs/gdnative/latest/gdnative/export/trait.Export.html) trait.
443443

444444
Some concrete examples of types that can be used with the GDNative API are the following:
445445

446446
- [`Variant`](https://docs.rs/gdnative/latest/gdnative/core_types/struct.Variant.html), this is Godot's "any" type. It must be converted before it can be used.
447447
- A subset of scalar types such as `i64`, `f64`, `bool`, etc.
448448
- [`String`](https://doc.rust-lang.org/std/string/struct.String.html) and [`GodotString`](https://docs.rs/gdnative/latest/gdnative/core_types/struct.GodotString.html).
449-
- [Godot core types](https://docs.rs/gdnative/latest/gdnative/core_types/index.html) such as [`Color`](https://docs.rs/gdnative/latest/gdnative/core_types/struct.Color.html), [`Aabb`](https://docs.rs/gdnative/latest/gdnative/core_types/struct.Aabb.html), [`Transform2D`](https://docs.rs/gdnative/latest/gdnative/core_types/type.Transform2D.html), [`Vector2`](https://docs.rs/gdnative/latest/gdnative/core_types/type.Vector2.html), etc.
450-
- Godot classes such as `Node`, `Reference`, etc. which must be accessed via [`Ref<T>`](https://docs.rs/gdnative/latest/gdnative/struct.Ref.html) (you can't pass them by value, because Godot owns them).
451-
- Any Rust struct that derives [`NativeClass`](https://docs.rs/gdnative/latest/gdnative/derive.NativeClass.html), through [`Instance<T>`](https://docs.rs/gdnative/latest/gdnative/nativescript/struct.Instance.html).
449+
- [Godot core types](https://docs.rs/gdnative/latest/gdnative/core_types/index.html) such as [`Color`](https://docs.rs/gdnative/latest/gdnative/core_types/struct.Color.html), [`Aabb`](https://docs.rs/gdnative/latest/gdnative/core_types/struct.Aabb.html), [`Transform2D`](https://docs.rs/gdnative/latest/gdnative/core_types/struct.Transform2D.html), [`Vector2`](https://docs.rs/gdnative/latest/gdnative/core_types/struct.Vector2.html), etc.
450+
- Godot classes such as `Node`, `Reference`, etc. which must be accessed via [`Ref<T>`](https://docs.rs/gdnative/latest/gdnative/object/struct.Ref.html) (you can't pass them by value, because Godot owns them).
451+
- Any Rust struct that derives [`NativeClass`](https://docs.rs/gdnative/latest/gdnative/derive/derive.NativeClass.html), through [`Instance<T>`](https://docs.rs/gdnative/latest/gdnative/object/struct.Instance.html).
452452

453453

454454
## How can I profile my code to measure performance?

src/faq/multithreading.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
## How do I use multithreading?
77

8-
Make sure you read [Godot's thread safety guidelines](https://docs.godotengine.org/en/stable/tutorials/performance/threads/thread_safe_apis.html).
8+
Make sure you read [Godot's thread safety guidelines](https://docs.godotengine.org/en/3.6/tutorials/performance/threads/thread_safe_apis.html).
99

1010
> This is **EXTREMELY IMPORTANT**.
1111

src/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ The source repository for this book is [hosted on GitHub](https://github.com/god
5656

5757
## License
5858

59-
The GDNative bindings and this user guide are licensed under the MIT license.
59+
The GDNative bindings and this user guide are licensed under the MIT license.
6060
The GDExtension bindings are licensed under the [Mozilla Public License 2.0](https://www.mozilla.org/en-US/MPL).
6161

6262

src/intro/hello-world.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ gdnative = "0.10"
4444
> While it's also possible to place the Rust crate within the Godot project, doing so might lead to problems with Godot's resource importer. It's best to place the Rust crate somewhere outside the Godot project directory.
4545
>
4646
> Previously, some third-party resources have recommended separating Rust code into multiple crates. While this is fine to do, godot-rust works best when there is a single `cdylib` crate acting as the entry point for all crates in the workspace. Script downcasting, for example, only works for types registered in the same GDNative library. Code from `std` and other dependencies can also lead to code bloat when duplicated in multiple binaries.
47-
>
47+
>
4848
> We suggest that users start projects as a single crate, and only split code into workspaces when necessary.
4949
5050

@@ -88,7 +88,7 @@ This macro defines the necessary C callbacks used by Godot. You only need *one*
8888

8989
> ### GDNative internals
9090
>
91-
> The purposes of this macro will be discussed in detail in [_An Overview of GDNative_](../gdnative-overview.md). For now, treat it as a magic incantation.
91+
> The purposes of this macro will be discussed in detail in [_An Overview of GDNative_](../overview). For now, treat it as a magic incantation.
9292
9393

9494
## Your first script

src/intro/setup.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ Before we can start creating a hello-world project using godot-rust, we'll need
66

77
The default API version is currently 3.2.3-stable. For the rest of the tutorial, we'll assume that you have Godot 3.2.3-stable installed, and available in your `PATH` as `godot`.
88

9-
You may download binaries of Godot 3.2.3-stable from the official repository: [https://downloads.tuxfamily.org/godotengine/3.2.3/](https://downloads.tuxfamily.org/godotengine/3.2.3/).
9+
You may download binaries of Godot 3.2.3-stable from the official repository: [https://godotengine.org/download/archive/3.2.3-stable/](https://godotengine.org/download/archive/3.2.3-stable/).
1010

1111
> ### Using another build of the engine
1212
>

src/overview/data-representations.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Data representations
22

3-
The godot-rust library uses many different approaches to store and transport data. This chapter explains high-level concepts of related terminology used throughout the library and its documentation. It is not a usage guide however -- to see the concepts in action, check out [Binding to Rust code](../rust-binding.md).
3+
The godot-rust library uses many different approaches to store and transport data. This chapter explains high-level concepts of related terminology used throughout the library and its documentation. It is not a usage guide however -- to see the concepts in action, check out [Binding to Rust code](../bind).
44

55

66
## Object and class
@@ -16,24 +16,24 @@ Every user-defined class inherits `Object` directly or indirectly, and thus all
1616

1717
`Object` itself comes with manual memory management. All instances must be deallocated using the `free()` method. This is typically not what you want, instead you will most often work with the following classes inherited from `Object`:
1818

19-
* **`Reference`**
20-
Reference-counted objects. This is the default base class if you don't use the `extends` keyword in GDScript. Allows to pass around instances of this type freely, managing memory automatically when the last reference goes out of scope.
19+
* **`Reference`**
20+
Reference-counted objects. This is the default base class if you don't use the `extends` keyword in GDScript. Allows to pass around instances of this type freely, managing memory automatically when the last reference goes out of scope.
2121
Do not confuse this type with the godot-rust `Ref` smart pointer.
22-
* **`Node`**
23-
Anything that's part of the scene tree, such as `Spatial` (3D), `CanvasItem` and `Node2D` (2D). Each node in the tree is responsible of its children and will deallocate them automatically when it is removed from the tree. At the latest, the entire tree will be destroyed when ending the application.
22+
* **`Node`**
23+
Anything that's part of the scene tree, such as `Spatial` (3D), `CanvasItem` and `Node2D` (2D). Each node in the tree is responsible of its children and will deallocate them automatically when it is removed from the tree. At the latest, the entire tree will be destroyed when ending the application.
2424
**Important:** as long as a node is not attached to the scene tree, it behaves like an `Object` instance and must be freed manually. On the other hand, as long as it is part of the tree, it can be destroyed (e.g. when its parent is removed) and other references pointing to it become invalid.
25-
* **`Resource`**
25+
* **`Resource`**
2626
Data set that is loaded from disk and cached in memory, for example 3D meshes, materials, textures, fonts or music (see also [Godot tutorial](https://docs.godotengine.org/en/stable/getting_started/step_by_step/resources.html)).
27-
`Resource` inherits `Reference`, so in the context of godot-rust, it can be treated like a normal, reference-counted class.
27+
`Resource` inherits `Reference`, so in the context of godot-rust, it can be treated like a normal, reference-counted class.
2828

2929
When talking about inheritance, we always mean the relationship in GDScript code. Rust does not have inheritance, instead godot-rust implements `Deref` traits to allow implicit upcasts. This enables to invoke all parent methods and makes the godot-rust API very close to GDScript.
3030

3131
Classes need to be added as `NativeScript` resources inside the Godot editor, see [here](../intro/hello-world.html#creating-the-nativescript-resource) for a description.
3232

3333
_See `Object` in
3434
[godot-rust docs](https://docs.rs/gdnative/latest/gdnative/api/struct.Object.html),
35-
[Godot docs](https://docs.godotengine.org/en/latest/classes/class_object.html)_
36-
_See `GodotObject`, the Rust trait implemented for all Godot classes, in [godot-rust docs](https://docs.rs/gdnative/latest/gdnative/trait.GodotObject.html)_
35+
[Godot docs](https://docs.godotengine.org/en/latest/classes/class_object.html)_
36+
_See `GodotObject`, the Rust trait implemented for all Godot classes, in [godot-rust docs](https://docs.rs/gdnative/latest/gdnative/object/trait.GodotObject.html)_
3737

3838

3939
## Variant
@@ -53,7 +53,7 @@ _See `Variant` in
5353

5454
Scripts are programmable building blocks that can be attached to nodes in the scene tree, in order to customize their behavior. Depending on the language in which the script is written, there are different classes which inherit the `Script` class; relevant here will be `NativeScript` for classes defined in Rust, and `GDScript` for classes defined in GDScript. Scripts are stored as Godot resources (like materials, textures, shaders etc), usually in their own separate file.
5555

56-
Scripts _always_ inherit another class from Godot's `Object` hierarchy, either an existing one from Godot or a user-defined one. In Rust, scripts are limited to inherit an existing Godot class; other scripts cannot be inherited. This makes each script a class on their own: they provide the properties and methods from their _base object_, plus all the properties and methods that you define in the script.
56+
Scripts _always_ inherit another class from Godot's `Object` hierarchy, either an existing one from Godot or a user-defined one. In Rust, scripts are limited to inherit an existing Godot class; other scripts cannot be inherited. This makes each script a class on their own: they provide the properties and methods from their _base object_, plus all the properties and methods that you define in the script.
5757

5858
_See `Script` in
5959
[godot-rust docs](https://docs.rs/gdnative/latest/gdnative/api/struct.Script.html),

0 commit comments

Comments
 (0)