Forge Draggable Windowsのロゴ

Forge Draggable Windows

コミュニティ
Nebulavenus
forge-draggable-windows

Add draggable, z-ordered, collapsible windows to a ForgeUiContext application. Wraps the existing immediate-mode UI context with deferred draw ordering and input routing by z-order.

概要

公開者Nebulavenus
リポジトリforge-gpu
スキル名forge-draggable-windows
スター
46
フォーク
7
同梱ファイル
指示のみ
ライセンスZlib
リンク
  • Markdown形式の指示

    モデルが必要に応じて読み込むSKILL.mdファイルです。関連するリクエストがあったときだけトークンを消費します。

  • どのLLMでも利用可能

    AIスキルはプロバイダー固有のコードではなく、通常のMarkdownなので、GPT、Claude、Gemini、Grok、ローカルモデルで利用できます。

  • 指示だけで完結

    モデルに必要なものはすべて指示に含まれているため、別途同期するファイルはありません。

  • オープンソース

    NebulavenusがGitHubで公開しています。インストールする前にソースを確認してください。

インストール

AIスキル「Forge Draggable Windows」をTypingMindにインストールすれば、どのLLMでも利用できます。SKILL.mdを読み取れる別のAIエージェントに追加することもできます。

1

TypingMindにインストール

TypingMindはGitHubフォルダから直接スキルをインストールします。SKILL.mdを読み取り、リソースファイルをまとめてローカルに保存します。

  1. アプリを開き、「プラグイン」→「スキル」に移動します。
  2. 「GitHubからインストール」を選択します。
  3. 以下のスキルフォルダのURLを貼り付けて確定します。
    https://github.com/Nebulavenus/forge-gpu/tree/main/.claude/skills/forge-draggable-windows
  4. スキルを利用したいチャットごとに、そのスキルを有効にしてください。
「プラグイン」→「スキル」→「スキルを追加」→「GitHubのURLから」を選択し、フォルダのURLを貼り付けて「続行」を押します。
2

別のAIエージェントにインストール

Agent Skills形式を読み取れるAIエージェントなら、このスキルを利用できます。フォルダをそのAIエージェントのスキルディレクトリにコピーしてください。

Claude Code — .claude/skills
git clone --depth 1 https://github.com/Nebulavenus/forge-gpu.git /tmp/forge-gpu
mkdir -p .claude/skills
cp -r /tmp/forge-gpu/.claude/skills/forge-draggable-windows .claude/skills/forge-draggable-windows
コピー後、新しいスキルを読み込むためにClaude Codeを再起動してください。

TypingMindで使用

TypingMindのチャットでForge Draggable Windowsを有効にするだけで、あとはモデルが対応します。名前と説明がシステムプロンプトに含まれ、関連するリクエストがあると、モデルが指示の全文を自動で読み込みます。手動で呼び出す必要はなく、実際に使用されるまでトークンを消費しません。

関連するリクエストがあるとすぐに、モデルが自動的にForge Draggable Windowsを読み込みます。

どのAIモデルでも利用可能

AIスキルはプロバイダー固有のコードではなく、通常のMarkdownで書かれた指示です。そのため、Forge Draggable Windowsは作成時に想定されたモデルに縛られません。TypingMindに一度インストールすれば、ご自身のAPIキーを使って、GPT-5、Claude、Gemini、Grok、DeepSeek、Mistral、Llama、またはご自身で実行するローカルモデルで利用できます。

  • 必要なときだけ読み込み

    システムプロンプトには名前と説明だけが含まれます。関連するリクエストが初めてあったときに指示を取得するため、スキルを使わない間は指示の読み込みにトークンを消費しません。

  • チャットの途中でモデルを切り替え

    スキルはコードではなく指示なので、モデルを切り替えてもそのまま使えます。次のモデルも同じSKILL.mdを読み込みます。

スキルの指示

モデルが読み込むSKILL.mdの内容です。スキルはモデルが従う指示なので、インストールする前に確認してください。

Add draggable windows with z-ordering and collapse/expand to any application that uses ForgeUiContext. Based on UI Lesson 10.

When to use

  • You need draggable floating panels that users can rearrange
  • You need z-ordering so overlapping windows draw and receive input correctly
  • You need a collapse toggle to let users minimize windows to their title bar
  • You want deferred draw ordering (per-window draw lists sorted by z at frame end)
  • You need input routing that respects z-order (foreground windows block clicks to background windows in overlap regions)

Key API calls

  • forge_ui_wctx_init(wctx, ctx) -- initialize a window context wrapping an existing ForgeUiContext
  • forge_ui_wctx_free(wctx) -- free per-window draw list buffers
  • forge_ui_wctx_begin(wctx) -- begin a frame (determines hovered window from previous frame data, resets per-frame state)
  • forge_ui_wctx_end(wctx) -- end a frame (sorts draw lists by z_order, appends to main buffers in back-to-front order)
  • forge_ui_wctx_window_begin(wctx, id, title, state) -- begin a window (returns true if expanded, false if collapsed or invalid)
  • forge_ui_wctx_window_end(wctx) -- end a window (computes content height, draws scrollbar, restores main buffers)

Correct order

  1. Initialize a ForgeUiWindowContext wrapping your ForgeUiContext
  2. Each frame: call forge_ui_ctx_begin(), then forge_ui_wctx_begin()
  3. Declare windows: window_begin / widgets / window_end blocks
  4. End frame: call forge_ui_wctx_end(), then forge_ui_ctx_end()

Widget IDs must be unique and each window reserves three IDs: id for the window/drag handle, id+1 for the scrollbar, id+2 for the collapse toggle.

When window_begin returns false (collapsed or invalid), skip all child widgets and do not call window_end.

Key concepts

  1. ForgeUiWindowState -- application-owned persistent state: rect (position/size, updated by drag), scroll_y (content scroll offset), collapsed (toggled by clicking the collapse button), z_order (draw priority, higher = on top, updated on click)
  2. Grab offset -- stored on the press frame as (mouse - rect.origin); used during drag to maintain the relative click position
  3. Bring-to-front -- on any mouse press inside a window, set z_order = max(all z) + 1
  4. Deferred draw -- per-window vertex/index buffers assembled at frame end in back-to-front z-order
  5. Input routing pre-pass -- wctx_begin scans previous frame's window rects to find the topmost window under the mouse; widgets in other windows silently fail hit tests
  6. Keyboard suppression -- widgets in covered windows preserve visual focus but do not process keyboard input (games can suppress window input for game controls without the window appearing unfocused)

Common mistakes

  1. Forgetting wctx_end() -- without it, per-window draw lists are never appended to the main buffer and nothing renders
  2. Calling window_end when collapsed -- window_begin returns false for collapsed windows; calling window_end in that case corrupts state
  3. ID collisions -- each window needs 3 contiguous IDs (id, id+1, id+2); overlapping ranges cause unpredictable hot/active behavior
  4. Not checking wctx_init return -- returns false if the context pointer is null or allocation fails
  5. Resetting grab offset -- the ForgeUiWindowContext grab offset must persist across frames (not reset by wctx_begin) because drags span multiple frames
  6. Ignoring one-frame lag -- hovered_window_id uses previous frame data; z-order changes take effect on the next frame's input routing

Ready-to-use template

Three overlapping windows

c
#include "ui/forge_ui.h"
#include "ui/forge_ui_window.h"

/* Window IDs (each reserves id, id+1, id+2) */
#define ID_WIN_A  100
#define ID_WIN_B  200
#define ID_WIN_C  300

/* Widget IDs inside windows */
#define ID_CB_1   110
#define ID_SLIDER 120

/* Widget dimensions */
#define LABEL_HEIGHT     26.0f
#define CHECKBOX_HEIGHT  28.0f
#define SLIDER_HEIGHT    30.0f
#define SLIDER_MIN        0.0f
#define SLIDER_MAX      100.0f

/* Application-owned window state (persists across frames) */
ForgeUiWindowState win_a = {
    .rect = { 30.0f, 30.0f, 260.0f, 280.0f },
    .scroll_y = 0.0f,
    .collapsed = false,
    .z_order = 0
};
ForgeUiWindowState win_b = {
    .rect = { 200.0f, 80.0f, 260.0f, 200.0f },
    .scroll_y = 0.0f,
    .collapsed = false,
    .z_order = 1
};

/* Application-owned widget state */
bool option_a = true;
float slider_val = 50.0f;

/* --- Frame loop --- */

ForgeUiContext ctx;
forge_ui_ctx_init(&ctx, &atlas);

ForgeUiWindowContext wctx;
forge_ui_wctx_init(&wctx, &ctx);

/* Each frame: */
forge_ui_ctx_begin(&ctx, mouse_x, mouse_y, mouse_down);
ctx.scroll_delta = scroll_delta;
forge_ui_wctx_begin(&wctx);

/* Window A: settings */
if (forge_ui_wctx_window_begin(&wctx, ID_WIN_A, "Settings", &win_a)) {
    (void)forge_ui_ctx_checkbox_layout(
        wctx.ctx, ID_CB_1, "Option A", &option_a, CHECKBOX_HEIGHT);
    (void)forge_ui_ctx_slider_layout(
        wctx.ctx, ID_SLIDER, &slider_val,
        SLIDER_MIN, SLIDER_MAX, SLIDER_HEIGHT);
    forge_ui_wctx_window_end(&wctx);
}

/* Window B: status */
if (forge_ui_wctx_window_begin(&wctx, ID_WIN_B, "Status", &win_b)) {
    forge_ui_ctx_label_layout(wctx.ctx, "Hello, windows!",
                              LABEL_HEIGHT, 0.9f, 0.9f, 0.9f, 1.0f);
    forge_ui_wctx_window_end(&wctx);
}

forge_ui_wctx_end(&wctx);   /* sorts and assembles draw lists */
forge_ui_ctx_end(&ctx);      /* finalizes hot/active state */

/* Use ctx.vertices, ctx.indices, ctx.vertex_count, ctx.index_count
 * for rendering — vertices are in correct z-sorted draw order. */

Key observations

  • Pass wctx.ctx (not &ctx) to widget functions inside a window -- the window context redirects the vertex/index pointers
  • window_begin returns false for both collapsed windows and validation failures -- never call window_end when it returns false
  • Widget return values (checkbox_layout, slider_layout) indicate whether the value changed, not success/failure -- (void) cast is fine when the result is not needed
  • Set ctx.scroll_delta before wctx_begin so the input routing pre-pass can associate the scroll with the correct window

Reference

よくある質問

AIスキル「Forge Draggable Windows」では何ができますか?

Add draggable, z-ordered, collapsible windows to a ForgeUiContext application. Wraps the existing immediate-mode UI context with deferred draw ordering and input routing by z-order.

TypingMindでForge Draggable Windowsを使うメリットは何ですか?

一度インストールすれば、どのモデルでも使えるからです。Forge Draggable Windowsはプロバイダー固有のコードではなく、通常のMarkdownで記述されているため、同じスキルをGPT-5、Claude、Gemini、Grok、ローカルモデルで利用できます。チャットの途中でモデルを切り替えても、そのまま使い続けられます。TypingMindは自分のAPIキーで動作するため、シート単位のサブスクリプションではなく、プロバイダーに直接料金を支払います。スキルとチャットは自分のストレージに保持されます。

TypingMindにForge Draggable Windowsをインストールするにはどうすればよいですか?

TypingMindで「プラグイン」→「スキル」→「GitHubからインストール」を開き、https://github.com/Nebulavenus/forge-gpu/tree/main/.claude/skills/forge-draggable-windowsを貼り付けてください。TypingMindがSKILL.mdを読み込み、チャットごとに有効にできるスキルとしてインストールします。

Forge Draggable Windowsを使えるAIモデルはどれですか?

TypingMindに接続したどのモデルでも利用できます。AIスキルはプロバイダー固有のコードではなく、通常のMarkdownで書かれた指示です。そのため、GPT、Claude、Gemini、Grok、ローカルモデルのいずれも、リクエストの内容がこのスキルの用途に合ったときに、このスキルを読み込めます。

Forge Draggable Windowsで使えるAIモデルの数に制限はありますか?

数に制限はありません。スキルに対応したモデルであれば、GPT、Claude、Gemini、Grok、DeepSeek、Mistral、Llamaなど、どのモデルでもForge Draggable Windowsを利用できます。すべてTypingMind上で、自分のAPIキーを使って利用できます。

AIスキル「Forge Draggable Windows」は無料ですか?

はい。NebulavenusがZlibライセンスのもとでGitHubに公開しています。ご利用のAIプロバイダーに支払うのは、使用したトークンの料金だけです。

AIスキルとは何ですか?

AIスキルは、特定のタスクの実行方法をAIモデルに教える、再利用可能な指示のセットです。オープンなAgent Skills形式に従い、名前と説明を含むSKILL.mdファイルに加え、モデルが必要とするスクリプト、テンプレート、参照ファイルで構成されます。モデルはリクエストがスキルに合致したときだけ指示を読み込むため、インストール済みのスキルも、使うまでは費用がかかりません。

AIスキルは、プラグインやMCPサーバーとどう違いますか?

プラグインやMCPサーバーは、モデルが呼び出せる新しいツールを提供します。ツールとは、どこかで実行され、結果を返すコードです。一方、AIスキルは、タスクへの取り組み方、従うべき手順、望ましい出力の例といった知識や進め方をモデルに伝えます。スキルは通常のMarkdownで記述されているため、サーバー、APIキー、実行環境は不要で、どのモデルでも利用できます。

すべて見る

今すぐ自分専用のAIワークスペースを作成

ニュースレターに登録すると、新機能や今後のプレゼント企画のお知らせが届きます👇