Skip to content

Commit bc9c480

Browse files
author
rain
committed
docs: sync C++ skills coverage
1 parent f39360b commit bc9c480

5 files changed

Lines changed: 38 additions & 5 deletions

File tree

crates/cli/src/subcommands/dev.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ pub fn cli() -> Command {
8181
Arg::new("client-lang")
8282
.long("client-lang")
8383
.value_parser(clap::value_parser!(Language))
84-
.help("The programming language for the generated client module bindings (e.g., typescript, csharp, python). If not specified, it will be detected from the project."),
84+
.help("The programming language for the generated client module bindings (e.g., typescript, csharp, rust, unrealcpp). If not specified, it will be detected from the project."),
8585
)
8686
.arg(common_args::server().help("The nickname, host name or URL of the server to publish to"))
8787
.arg(common_args::yes())

docs/docs/00100-intro/00100-getting-started/00300-language-support.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,12 @@ slug: /intro/language-support
66

77
## Server Database Modules
88

9-
SpacetimeDB modules define your database schema and server-side business logic. Modules can be written in three languages:
9+
SpacetimeDB modules define your database schema and server-side business logic. Modules can be written in four languages:
1010

1111
- **[Rust](../../00200-core-concepts/00100-databases.md)** - High performance, compiled to WebAssembly [(Quickstart)](../00200-quickstarts/00500-rust.md)
1212
- **[C#](../../00200-core-concepts/00100-databases.md)** - Great for Unity developers, compiled to WebAssembly [(Quickstart)](../00200-quickstarts/00600-c-sharp.md)
1313
- **[TypeScript](../../00200-core-concepts/00100-databases.md)** - Ideal for web developers, runs on V8 [(Quickstart)](../00200-quickstarts/00400-typescript.md)
14+
- **[C++](../../00200-core-concepts/00100-databases.md)** - Fits Unreal and C++ workflows, compiled to WebAssembly [(Quickstart)](../00200-quickstarts/00700-cpp.md)
1415

1516
## Client SDKs
1617

docs/docs/00200-core-concepts/00300-tables/00550-event-tables.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ slug: /tables/event-tables
55

66
import Tabs from '@theme/Tabs';
77
import TabItem from '@theme/TabItem';
8+
import { CppModuleVersionNotice } from "@site/src/components/CppModuleVersionNotice";
89

910
In many applications, particularly games and real-time systems, modules need to notify clients about things that happened without storing that information permanently. A combat system might need to tell clients "entity X took 50 damage" so they can display a floating damage number, but there is no reason to keep that record in the database after the moment has passed.
1011

@@ -60,6 +61,21 @@ pub struct DamageEvent {
6061
}
6162
```
6263

64+
</TabItem>
65+
<TabItem value="cpp" label="C++">
66+
67+
<CppModuleVersionNotice />
68+
69+
```cpp
70+
struct DamageEvent {
71+
Identity entity_id;
72+
uint32_t damage;
73+
std::string source;
74+
};
75+
SPACETIMEDB_STRUCT(DamageEvent, entity_id, damage, source)
76+
SPACETIMEDB_TABLE(DamageEvent, damage_event, Public, true)
77+
```
78+
6379
</TabItem>
6480
</Tabs>
6581
@@ -128,6 +144,21 @@ fn attack(ctx: &ReducerContext, target_id: Identity, damage: u32) {
128144
}
129145
```
130146

147+
</TabItem>
148+
<TabItem value="cpp" label="C++">
149+
150+
<CppModuleVersionNotice />
151+
152+
```cpp
153+
SPACETIMEDB_REDUCER(attack, ReducerContext ctx, Identity target_id, uint32_t damage) {
154+
// Game logic...
155+
156+
// Publish the event
157+
ctx.db[damage_event].insert(DamageEvent{target_id, damage, "melee_attack"});
158+
return Ok();
159+
}
160+
```
161+
131162
</TabItem>
132163
</Tabs>
133164

docs/docs/00300-resources/00200-reference/00100-cli-reference/00100-cli-reference.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,7 @@ Start development mode with auto-regenerate client module bindings, auto-rebuild
249249

250250
Default value: `src/module_bindings`
251251
* `--module-path <MODULE-PATH>` — Path to the SpacetimeDB server module, relative to current directory. Defaults to `<project-path>/spacetimedb`.
252-
* `--client-lang <CLIENT-LANG>` — The programming language for the generated client module bindings (e.g., typescript, csharp, python). If not specified, it will be detected from the project.
252+
* `--client-lang <CLIENT-LANG>` — The programming language for the generated client module bindings (e.g., typescript, csharp, rust, unrealcpp). If not specified, it will be detected from the project.
253253

254254
Possible values: `csharp`, `typescript`, `rust`, `unrealcpp`
255255

@@ -659,4 +659,3 @@ Run `spacetime version --help` to see all options.
659659
This document was generated automatically by
660660
<a href="https://crates.io/crates/clap-markdown"><code>clap-markdown</code></a>.
661661
</i></small>
662-

skills/cpp-server/SKILL.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,9 @@ FIELD_PrimaryKeyAutoInc(entity, id)
3737
FIELD_Index(entity, name)
3838
```
3939
40-
Options: `SPACETIMEDB_TABLE(Type, accessor, Public|Private)`
40+
Options:
41+
- `SPACETIMEDB_TABLE(Type, accessor, Public|Private)`: regular table
42+
- `SPACETIMEDB_TABLE(Type, accessor, Public|Private, true)`: event table
4143
4244
Field constraints:
4345
- `FIELD_PrimaryKey(accessor, field)`: primary key

0 commit comments

Comments
 (0)