Run and modify Breakout
Build and run Breakout unchanged first, then copy it into your own plugin. This avoids debugging code and environment problems at the same time.
Prerequisites and completion criteria#
To play the supplied Breakout first, follow Run existing examples and open it directly in Studio. The steps below rebuild it from source before copying and modifying it into your own game.
Run the original Breakout once on the computer and once on real glasses, then copy it into your own plugin. Complete steps 1–4 in order on your first pass. Change code only after the full path works.
Prepare the complete toolkit, Python, source-packaging dependencies and Studio for your OS. Device steps also need the matching MemoMind App and plugin-compatible glasses. Confirm that the App connects to the glasses first.
Step 1: automatically build the glasses plugins#
Open a terminal in the complete plugin-open-platform root. The commands below enter GlassSDK and build automatically, including Breakout. Copy only the command group for your OS.
You do not need to list examples individually. The script discovers valid projects under examples, and the build system uses source and header dependencies to decide what needs recompiling.
Even if the repository includes GMPs, run a build first to verify the local environment and complete source-review sidecars. If you already built successfully using the environment guide, continue to step 2.
macOS / Linux
cd GlassSDK
./build.pyWindows PowerShell
cd GlassSDK
py build.pyStep 2: check the generated files#
The GMP runs the plugin; the other two files add this build's source and build information to the complete ZIP. Keep all three together. Do not copy only the GMP and then expect Studio to generate a new source-inclusive package.
On Windows, paste the full output directory into File Explorer's address bar. In macOS Finder, press Command + Shift + . to show the hidden .build directory; on Linux, enable hidden files in the file manager. Fix terminal errors before packaging, even if an old GMP already exists.
GlassSDK/
├── examples/game/breakout/
│ ├── manifest.json
│ ├── breakout.c
│ └── breakout_translations.h
└── build-host/.build/game/breakout/
├── breakout.gmp
├── breakout.review.json
└── breakout.review-source.encStep 3: run in Studio#
- Open desktop Studio and import the complete toolkit root containing GlassSDK, PhoneSDK and Studio. On a Mac, import it after each fresh launch. Use the installation link below if Studio is not installed.
- Refresh the glasses-plugin list and select GM Breakout. Set the phone plugin to No phone plugin (glasses debugging only).
- Confirm that the virtual screen shows bricks, a ball and a bottom paddle; the ball starts moving automatically. This example has no phone Web page. Try the controls below first.
Step 3, continued: control and exit Breakout#
| Actions | In Studio | On real glasses |
|---|---|---|
| Move the paddle | Drag left/right in the Head movement area, or use the simulated accessory's left/right buttons. | Turn your head left/right, or use an accessory's left/right buttons if available. |
| Pause and resume | Click the main button; click again to resume. | Click the main button to pause; click again to resume. |
| Restart after winning or losing | Click the main button. | Click the main button. |
| Exit the example | Hold the main button until the exit countdown finishes. Release early to cancel. | Hold the main button until the exit countdown finishes, or look upward continuously for about 3 seconds to exit. |
Step 4: run on real glasses#
- Wear the glasses and keep them powered on. Confirm the connection in MemoMind App and mutually reachable LAN connections for the computer and phone. System Bluetooth pairing alone is insufficient.
- Keep GM Breakout selected in Studio. Wait for packaging and the current QR code. Keep Studio open and prevent the computer from sleeping during download.
- Sign in to the App with the developer account that owns the application. Open Settings → Memo Lab → Developer Workspace → Scan to open app. Grant required permissions, scan the current QR code and wait for download, validation and Bluetooth installation/startup.
- Verify the game display, left/right movement and pause/resume on real glasses. The glasses-only example has no phone application page. Stop and restart it from the App list; after success, continue to step 5 to modify the code.
Step 5: copy the example directory#
After validating the original example, return to the terminal used for the build, still in GlassSDK. Make sure the hello_glass directory does not already exist, then copy the example:
macOS / Linux
cp -R examples/game/breakout examples/hello_glassWindows PowerShell
Copy-Item -Recurse examples/game/breakout examples/hello_glassStep 6: modify your example#
- Open examples/hello_glass/manifest.json in a code editor and replace its contents with the following. Keep version and abi_version as numbers, and do not add comments to the JSON.
- Open breakout.c and change #define PADDLE_W 80 to #define PADDLE_W 100. Use the visibly wider paddle to verify the new code. The file can still be named breakout.c.
{
"id": "com.example.hello-glass",
"name": "Hello Glass",
"version": 1,
"abi_version": 256
}Step 7: build and verify the new plugin#
With the terminal still in GlassSDK, run the same build command again. The script discovers hello_glass and writes build-host/.build/hello_glass/hello_glass.gmp.
- After a successful build, refresh Studio and select Hello Glass. Make sure GM Breakout is no longer selected.
- Compare Hello Glass with the original and check that the paddle at the bottom is wider. Wait for the new ZIP to finish packaging, then follow Step 4 to scan it on your phone and verify the same change.
- Keep the source, build attachments, and verified ZIP. For future changes, follow this order: save → build → refresh/select → wait for packaging → verify on the phone.
macOS / Linux
./build.pyWindows PowerShell
py build.pyReference files in the toolkit#
- GlassSDK/examples/game/breakout/README.md
- GlassSDK/include/gm_plugin.h
- GlassSDK/README.md