Skip to content

Quick Start#

Build your first Xenon plugin in under 5 minutes.

Step 1: Create the Plugin File#

Create a file called my_plugin.cpp in the plugin-sdk/examples/ directory (or anywhere you like):

#include <xenon/SDK.hpp>
using namespace xenon;

// Define plugin metadata
XENON_PLUGIN_INFO(
    "my_plugin",
    "My First Plugin",
    "YourName",
    "Hello world plugin",
    "1.0",
    0,
    PluginFlags::HasOverlay | PluginFlags::HasMenu
)

// Called once when the plugin loads
extern "C" void on_load()
{
    Log("My plugin loaded!");
}

// Called every render frame — draw things here
extern "C" void on_render()
{
    Draw::Text(100, 100, Color::Green(), "Hello from my plugin!");
}

// Called when the menu is open — add UI here
extern "C" void on_menu()
{
    if (ImGui::CollapsingHeader("My Plugin"))
    {
        ImGui::Text("It works!");
    }
}

Step 2: Build#

Open a terminal in the plugin-sdk/ directory and run:

build.bat examples\my_plugin.cpp

If successful, you'll see:

Building plugin: examples\my_plugin.cpp
  OK: output\my_plugin.wasm

Step 3: Load#

Copy output/my_plugin.wasm into Xenon's plugin directory and it will be loaded automatically.

What Just Happened?#

  1. XENON_PLUGIN_INFO defined an on_get_info function that tells Xenon your plugin's name, author, and capabilities.

  2. on_load ran once when the plugin was loaded. Good place for initialization and loading config.

  3. on_render is called every frame during the render phase. Anything you draw here appears as an overlay.

  4. on_menu is called when the Xenon menu is open. Your ImGui widgets appear in the plugin's settings panel.

Next Steps#