Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion content/examples/animation.md
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ fn section(colors: &Colors, title: &'static str, content: impl IntoElement) -> i
}

fn main() {
Application::new()
gpui_platform::application()
.with_assets(Assets {})
.run(|cx: &mut App| {
let bounds = Bounds::centered(None, gpui_size(px(500.), px(650.)), cx);
Expand Down
2 changes: 1 addition & 1 deletion content/examples/async_tasks.md
Original file line number Diff line number Diff line change
Expand Up @@ -559,7 +559,7 @@ fn progress_bar(colors: &Colors, progress: u32) -> impl IntoElement {
}

fn main() {
Application::new().run(|cx: &mut App| {
gpui_platform::application().run(|cx: &mut App| {
let bounds = Bounds::centered(None, size(px(550.), px(850.)), cx);
cx.open_window(
WindowOptions {
Expand Down
2 changes: 1 addition & 1 deletion content/examples/creating_components.md
Original file line number Diff line number Diff line change
Expand Up @@ -432,7 +432,7 @@ impl Render for CreatingComponentsExample {
}

fn main() {
Application::new().run(|cx: &mut App| {
gpui_platform::application().run(|cx: &mut App| {
let bounds = Bounds::centered(None, size(px(700.), px(400.)), cx);
cx.open_window(
WindowOptions {
Expand Down
2 changes: 1 addition & 1 deletion content/examples/custom_drawing.md
Original file line number Diff line number Diff line change
Expand Up @@ -477,7 +477,7 @@ fn section(
}

fn main() {
Application::new().run(|cx: &mut App| {
gpui_platform::application().run(|cx: &mut App| {
let bounds = Bounds::centered(None, size(px(550.), px(800.)), cx);
cx.open_window(
WindowOptions {
Expand Down
2 changes: 1 addition & 1 deletion content/examples/data_table.md
Original file line number Diff line number Diff line change
Expand Up @@ -461,7 +461,7 @@ impl Render for DataTable {
}

fn main() {
Application::new().run(|cx: &mut App| {
gpui_platform::application().run(|cx: &mut App| {
cx.open_window(
WindowOptions {
focus: true,
Expand Down
2 changes: 1 addition & 1 deletion content/examples/interactive_elements.md
Original file line number Diff line number Diff line change
Expand Up @@ -565,7 +565,7 @@ impl Render for InteractiveElementsExample {
}

fn main() {
Application::new().run(|cx: &mut App| {
gpui_platform::application().run(|cx: &mut App| {
let bounds = Bounds::centered(None, size(px(700.), px(650.)), cx);
cx.open_window(
WindowOptions {
Expand Down
2 changes: 1 addition & 1 deletion content/examples/layout.md
Original file line number Diff line number Diff line change
Expand Up @@ -497,7 +497,7 @@ fn section(colors: &Colors, title: &'static str, content: impl IntoElement) -> i
}

fn main() {
Application::new().run(|cx: &mut App| {
gpui_platform::application().run(|cx: &mut App| {
let bounds = Bounds::centered(None, size(px(650.), px(700.)), cx);
cx.open_window(
WindowOptions {
Expand Down
2 changes: 1 addition & 1 deletion content/examples/paths_bench.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ impl Render for PaintingViewer {
}

fn main() {
Application::new().run(|cx| {
gpui_platform::application().run(|cx| {
cx.open_window(
WindowOptions {
titlebar: Some(TitlebarOptions {
Expand Down
2 changes: 1 addition & 1 deletion content/examples/pattern.md
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ impl Render for PatternExample {
}

fn main() {
Application::new().run(|cx: &mut App| {
gpui_platform::application().run(|cx: &mut App| {
let bounds = Bounds::centered(None, size(px(600.0), px(600.0)), cx);
cx.open_window(
WindowOptions {
Expand Down
2 changes: 1 addition & 1 deletion content/examples/shadow.md
Original file line number Diff line number Diff line change
Expand Up @@ -583,7 +583,7 @@ impl Render for Shadow {
}

fn main() {
Application::new().run(|cx: &mut App| {
gpui_platform::application().run(|cx: &mut App| {
let bounds = Bounds::centered(None, size(px(1000.0), px(800.0)), cx);
cx.open_window(
WindowOptions {
Expand Down
2 changes: 1 addition & 1 deletion content/examples/styling.md
Original file line number Diff line number Diff line change
Expand Up @@ -493,7 +493,7 @@ fn color_swatch(colors: &Colors, name: &'static str, color: Rgba) -> impl IntoEl
}

fn main() {
Application::new().run(|cx: &mut App| {
gpui_platform::application().run(|cx: &mut App| {
cx.activate(true);
cx.on_action(|_: &Quit, cx| cx.quit());
cx.bind_keys([
Expand Down
2 changes: 1 addition & 1 deletion content/examples/text.md
Original file line number Diff line number Diff line change
Expand Up @@ -580,7 +580,7 @@ fn section(colors: &Colors, title: &'static str, content: impl IntoElement) -> i
}

fn main() {
Application::new().run(|cx: &mut App| {
gpui_platform::application().run(|cx: &mut App| {
let bounds = Bounds::centered(None, size(px(650.), px(900.)), cx);
cx.open_window(
WindowOptions {
Expand Down
19 changes: 10 additions & 9 deletions content/learn/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ version = "0.1.0"
edition = "2024"

[dependencies]
gpui = { git = "https://github.com/zed-industries/zed" }
gpui = { git = "https://github.com/gpui-ce/gpui-ce" }
gpui_platform = { git = "https://github.com/gpui-ce/gpui-ce" }
```

> **Note:** GPUI is part of the Zed repository. Check the [GPUI Community Edition](https://github.com/nicholasoxford/gpui-ce) for a standalone version.
Expand All @@ -59,7 +60,7 @@ Replace the contents of `src/main.rs` with:

```rust
use gpui::{
div, prelude::*, px, rgb, size, App, Application, Bounds, Context,
div, prelude::*, px, rgb, size, App, Bounds, Context,
SharedString, Window, WindowBounds, WindowOptions,
};

Expand All @@ -82,7 +83,7 @@ impl Render for HelloWorld {
}

fn main() {
Application::new().run(|cx: &mut App| {
gpui_platform::application().run(|cx: &mut App| {
let bounds = Bounds::centered(None, size(px(400.), px(300.)), cx);

cx.open_window(
Expand Down Expand Up @@ -113,13 +114,13 @@ Let's break this down piece by piece.

```rust
fn main() {
Application::new().run(|cx: &mut App| {
gpui_platform::application().run(|cx: &mut App| {
// ...
});
}
```

Every GPUI app starts with `Application::new().run(...)`. The closure receives an `App` context (`cx`), which is your gateway to the GPUI runtime. Through `cx`, you can:
Every GPUI app starts with `gpui_platform::application().run(...)`. The closure receives an `App` context (`cx`), which is your gateway to the GPUI runtime. Through `cx`, you can:

- Open windows
- Create entities (state containers)
Expand Down Expand Up @@ -220,7 +221,7 @@ Now let's make something interactive. We'll build a counter that you can increme

```rust
use gpui::{
div, prelude::*, px, rgb, size, App, Application, Bounds, Context,
div, prelude::*, px, rgb, size, App, Bounds, Context,
Window, WindowBounds, WindowOptions,
};

Expand Down Expand Up @@ -297,7 +298,7 @@ impl Render for Counter {
}

fn main() {
Application::new().run(|cx: &mut App| {
gpui_platform::application().run(|cx: &mut App| {
let bounds = Bounds::centered(None, size(px(300.), px(200.)), cx);

cx.open_window(
Expand Down Expand Up @@ -508,7 +509,7 @@ Here's the complete counter with detailed comments:

```rust
use gpui::{
div, prelude::*, px, rgb, size, App, Application, Bounds, Context,
div, prelude::*, px, rgb, size, App, Bounds, Context,
Window, WindowBounds, WindowOptions,
};

Expand Down Expand Up @@ -598,7 +599,7 @@ impl Render for Counter {

fn main() {
// Create and run the application
Application::new().run(|cx: &mut App| {
gpui_platform::application().run(|cx: &mut App| {
// Define window size and position
let bounds = Bounds::centered(None, size(px(300.), px(200.)), cx);

Expand Down