Chuyển đến nội dung
Skillpedia
Website và giao diện (frontend)48k · #5151

makepad-platform

Skill này làm gì

Công cụ này giúp bạn hiểu và viết mã cho các hệ điều hành khác nhau (như Windows, macOS, Linux, Android, iOS và Web) bằng nền tảng Makepad. Nó giải thích hệ thống nào được hỗ trợ và mã thích nghi với từng hệ thống như thế nào.

Khi nào nên dùng

  • ✓Khi bạn muốn biết ứng dụng Makepad có thể chạy trên hệ thống nào (di động, máy tính, web).
  • ✓Khi bạn cần viết đoạn mã chỉ chạy trên một hệ thống cụ thể, ví dụ chỉ trên Windows.
  • ✓Khi bạn muốn hiểu cách Makepad dùng các công nghệ đồ họa khác nhau (như Metal, OpenGL) trên mỗi hệ thống.

Liên kết skill

https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/makepad-platform/SKILL.md

Sao chép rồi dán vào AI của bạn (Claude, ChatGPT hoặc Cursor) và nhờ nó làm theo hướng dẫn.

Cách dùng

Cách dễ nhất: sao chép tin nhắn và dán vào AI của bạn. AI sẽ đọc skill và làm theo hướng dẫn.

Tin nhắn có sẵn để dán

Hãy dùng skill này để giúp tôi: https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/makepad-platform/SKILL.md Đọc tệp SKILL.md tại liên kết đó và làm theo hướng dẫn cho việc của tôi.
Bạn muốn AI tự tìm những skill như thế này?Cài MCP Skillpedia miễn phí: chỉ một dòng, và AI sẽ tìm trong 15.000+ skill trước mỗi việc.Cài đặt trong 1 phút →

Ví dụ cách nhờ AI

“Làm sao để ứng dụng Makepad của tôi chạy trên Android và cũng chạy được trong trình duyệt web?”

5 skill mới mỗi tuần. Đọc chỉ 1 phút.

Cách hoạt động

AI kiểm tra thông tin về các nền tảng Makepad hỗ trợ và cách mã có thể thích nghi. Nó dùng cả kiến thức chung về Makepad và thông tin cụ thể từ các file tài liệu, nếu có.

Nội dung kỹ thuật (SKILL.md gốc)

Lấy nguyên văn từ GitHub, do tác giả viết bằng tiếng Anh.

Supporting material availability

This catalog copy contains the inline guidance below, but does not include the following supporting paths. They are external prerequisites, not bundled files:

  • ./references/platform-support.md

Ask for the original supporting material or an existing installation before using a step that depends on these paths; this catalog does not identify a verified download source for them. Resolve each path relative to that installation, inspect its contents, and verify any applicable license and execution prerequisites. Do not run a command or claim a referenced procedure was followed until its required file exists. Do not fabricate the missing scripts or treat an unrelated file with the same name as equivalent. Independent steps fully documented here can proceed within the user’s authorized scope; report any dependent step as unavailable.

Makepad Platform Skill

Version: makepad-widgets (dev branch) | Last Updated: 2026-01-19

Check for updates: https://crates.io/crates/makepad-widgets

You are an expert at Makepad cross-platform development. Help users by:

  • Understanding platforms: Explain supported platforms and backends
  • Platform-specific code: Help with conditional compilation and platform APIs

When to Use

  • You need to understand or target specific platforms and graphics backends in Makepad.
  • The task involves platform compatibility, conditional compilation, or OS-specific behavior across desktop, mobile, or web.
  • You need guidance on backend differences such as Metal, D3D11, OpenGL, WebGL, or platform modules.

Documentation

Refer to the local files for detailed documentation:

  • ./references/platform-support.md - Platform details and OsType

IMPORTANT: Documentation Completeness Check

Before answering questions, Claude MUST:

  1. Read the relevant reference file(s) listed above
  2. If file read fails or file is empty:
    • Inform user: "本地文档不完整,建议运行 /sync-crate-skills makepad --force 更新文档"
    • Still answer based on SKILL.md patterns + built-in knowledge
  3. If reference file exists, incorporate its content into the answer

Supported Platforms

Platform Graphics Backend OS Module
macOS Metal apple/metal_*.rs, apple/cocoa_*.rs
iOS Metal apple/metal_*.rs, apple/ios_*.rs
Windows D3D11 mswindows/d3d11_*.rs, mswindows/win32_*.rs
Linux OpenGL linux/opengl_*.rs, linux/x11*.rs, linux/wayland*.rs
Web WebGL2 web/*.rs, web_browser/*.rs
Android OpenGL ES android/*.rs
OpenHarmony OHOS open_harmony/*.rs
OpenXR VR/AR open_xr/*.rs

OsType Enum

pub enum OsType {
    Unknown,
    Windows,
    Macos,
    Linux { custom_window_chrome: bool },
    Ios,
    Android(AndroidParams),
    OpenHarmony,
    Web(WebParams),
    OpenXR,
}

// Check platform in code
fn handle_event(&mut self, cx: &mut Cx, event: &Event) {
    match cx.os_type() {
        OsType::Macos => { /* macOS-specific */ }
        OsType::Windows => { /* Windows-specific */ }
        OsType::Web(_) => { /* Web-specific */ }
        _ => {}
    }
}

Platform Detection

// In Cx
impl Cx {
    pub fn os_type(&self) -> OsType;
    pub fn gpu_info(&self) -> &GpuInfo;
    pub fn xr_capabilities(&self) -> &XrCapabilities;
    pub fn cpu_cores(&self) -> usize;
}

Conditional Compilation

// Compile-time platform detection
#[cfg(target_os = "macos")]
fn macos_only() { }

#[cfg(target_os = "windows")]
fn windows_only() { }

#[cfg(target_os = "linux")]
fn linux_only() { }

#[cfg(target_arch = "wasm32")]
fn web_only() { }

#[cfg(target_os = "android")]
fn android_only() { }

#[cfg(target_os = "ios")]
fn ios_only() { }

Platform-Specific Features

Desktop (macOS/Windows/Linux)

  • Window management (resize, minimize, maximize)
  • File dialogs
  • System menu
  • Drag and drop
  • Multiple monitors

Mobile (iOS/Android)

  • Touch input
  • Virtual keyboard
  • Screen orientation
  • App lifecycle (foreground/background)

Web (WebGL2)

  • DOM integration
  • Browser events
  • Local storage
  • HTTP requests

Entry Point

// App entry macro
app_main!(App);

pub struct App {
    ui: WidgetRef,
}

impl LiveRegister for App {
    fn live_register(cx: &mut Cx) {
        // Register components
        crate::makepad_widgets::live_design(cx);
    }
}

impl AppMain for App {

…
Câu hỏi thường gặp

“Graphics backends” là gì?

Đây là các công nghệ Makepad dùng để vẽ lên màn hình trên mỗi hệ thống. Ví dụ gồm Metal (cho Apple), D3D11 (cho Windows) và OpenGL (cho Linux và Android).

Làm sao mã biết nó đang chạy trên hệ thống nào?

Có hai cách: mã có thể kiểm tra khi chương trình đang chạy (runtime) bằng `cx.os_type()`, hoặc khi biên dịch (trước khi build) bằng `#[cfg(target_os = '...')`.

“Makepad cross-platform” nghĩa là gì?

Nghĩa là Makepad cho phép bạn viết mã chạy trên nhiều hệ điều hành khác nhau (máy tính, di động, web) mà không cần viết lại từ đầu cho từng hệ thống.

Chi tiết

Mô tả gốc của tác giả

CRITICAL: Use for Makepad cross-platform support. Triggers on: makepad platform, makepad os, makepad macos, makepad windows, makepad linux, makepad android, makepad ios, makepad web, makepad wasm, makepad metal, makepad d3d11, makepad opengl, makepad webgl, OsType, CxOs, makepad 跨平台, makepad 平台支持

repo: sickn33/agentic-awesome-skills

Độ phổ biến

Sao GitHub
48k
Vị trí xếp hạng
#5151
Giấy phép
MIT
Cập nhật
15/10/2026

Skill này có hữu ích không?

0

Đăng nhập để bình chọn.

Bình luận

  • …

Thêm skill từ kho mã này

Skill tương tự