Skip to content

Commit

Permalink
Add documentation on ARENA UI elements
Browse files Browse the repository at this point in the history
  • Loading branch information
hi-liang committed Sep 1, 2023
1 parent 5ae3865 commit ee5d5c4
Show file tree
Hide file tree
Showing 6 changed files with 60 additions and 1 deletion.
Binary file added assets/img/3dcontent/ui-button-panel.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/img/3dcontent/ui-card.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/img/3dcontent/ui-prompt.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
38 changes: 38 additions & 0 deletions content/3d-content/ui.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
---
title: UI Elements
layout: default
parent: 3D Content
---
# ARENA UI Elements

You can use several UI elements in the ARENA, including text and image panels, button panels, and
popup prompts.

## ARENAUI Card - a text and image panel

A card is a rectangular panel that can contain text and/or an image. It can be used to display
information or act as a sign. Its layout will dynamic adjust according to the optional parameters
that are provided: for instance, if no image is provided, then only text will be displayed. If only
a title is provided, it will serve more as a label or sign. An optional close button may also added.

![img](/assets/img/3dcontent/ui-card.png)

See the full [ARENAUI Card schema](/content/schemas/message/arenaui-card) for more details.

## ARENAUI Button Panel
A button panel is a horizontal or vertical panel that contains buttons. Each button can have a
text or image label. When a button is clicked, a message is sent over pubsub with
the `buttonName` and `buttonIndex`.

![img](/assets/img/3dcontent/ui-button-panel.png)

See the full [ARENAUI Button Panel schema](/content/schemas/message/arenaui-button-panel) for more details.

## ARENAUI Prompt
Similar to a button panel, this prompt is intended to be used a quick confirmation popup.
Its buttons may be customized and an additional text description can be included, similar
to what one may see in traditional 2D web interfaces.

![img](/assets/img/3dcontent/ui-prompt.png)

See the full [ARENAUI Prompt schema](/content/schemas/message/arenaui-prompt) for more details.
4 changes: 3 additions & 1 deletion content/python/events.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,14 @@ Below is how you access attributes of the `Event` object.
# [msg] is the raw JSON message as a dict
def click_handler(scene, evt, msg):
## Get Event type
evt.type # == "mousedown", "mouseup", "mouseenter", "mouseleave", etc.
evt.type # == "buttonClick", "mousedown", "mouseup", "mouseenter", "mouseleave", etc.

## Get Event data
evt.data.clickPos
evt.data.position
evt.data.source
evt.data.buttonName
evt.data.buttonIndex
# etc.

box = Box(..., evt_handler=click_handler) # note the use of "evt_handler=click_handler"
Expand Down
19 changes: 19 additions & 0 deletions content/python/objects.md
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,25 @@ Particle(...)
Camera(object_id, ...)
```

## Card
Create an ARENAUI Card
```python
Card(...)
```

## ButtonPanel
Create an ARENAUI Button Panel
```python
ButtonPanel(buttons=[Button(...), ...], ...)
```

## Prompt
Create an ARENAUI Prompt
```python
Prompt(...)
```


## Generic Object
For objects that might not exist yet (but may exist in AFRAME). Inherit from this class to create custom objects.
```python
Expand Down

0 comments on commit ee5d5c4

Please sign in to comment.