Skip to content

Commit

Permalink
set input handler on node
Browse files Browse the repository at this point in the history
  • Loading branch information
kayhhh committed Jul 1, 2024
1 parent 7fcd76f commit e7b713e
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 12 deletions.
1 change: 0 additions & 1 deletion spatial/wit/wired-input/deps/wired-physics

This file was deleted.

1 change: 0 additions & 1 deletion spatial/wit/wired-input/deps/wired-scene

This file was deleted.

13 changes: 3 additions & 10 deletions spatial/wit/wired-input/world.wit
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,17 @@ package wired:input;

world host {
import handler;
import types;
}

interface handler {
use types.{input-event};
use wired:scene/node.{node};

// Input handler.
// Represents an object in 3D space that can react to input.
// Handlers can optionally capture the input method, stopping propagation to other handlers.
resource spatial-handler {
constructor(node: borrow<node>);
resource input-handler {
constructor();

// Handle the next recieved input event.
// Events only last for one tick.
handle-input: func() -> option<input-event>;
}
}

// Input method.
// Represents a single point of interaction (3D pointer, hand, finger tip).
interface method {}
1 change: 1 addition & 0 deletions spatial/wit/wired-scene/deps/wired-input
4 changes: 4 additions & 0 deletions spatial/wit/wired-scene/world.wit
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ interface mesh {

interface node {
use mesh.{mesh};
use wired:input/handler.{input-handler};
use wired:math/types.{transform};
use wired:physics/types.{collider, rigid-body};

Expand Down Expand Up @@ -92,6 +93,9 @@ interface node {

rigid-body: func() -> option<rigid-body>;
set-rigid-body: func(value: option<borrow<rigid-body>>);

input-handler: func() -> option<input-handler>;
set-input-handler: func(value: option<borrow<input-handler>>);
}

list-nodes: func() -> list<node>;
Expand Down

0 comments on commit e7b713e

Please sign in to comment.