يتم توزيع مكتبة Game Controller بتنسيقَين: مكتبة Jetpack للألعاب التي تستخدم نظام إنشاء يستند إلى Gradle (بما في ذلك "استوديو Android")، وملفات منفصلة للألعاب التي تستخدم أنظمة إنشاء مخصّصة.
تحتوي صفحة ألعاب Android على Jetpack على تعليمات الدمج لإضافة تبعية مكتبة Game Controller إلى ملف build.gradle الخاص بلعبتك.
إصدار مكتبة Game Controller من Jetpack هو مكتبة ثابتة تم إنشاؤها باستخدام المكتبة المشتركة لوقت التشغيل بلغة C++.
بعد تعديل ملف build.gradle، عليك إضافة السطر التالي إلى ملف CMakeLists.txt الرئيسي للعبة:
find_package(games-controllerREQUIREDCONFIG)
عليك أيضًا إضافة الإدخال التالي إلى قائمة المكتبات
في الأمر target_link_libraries الخاص بالمكتبة الرئيسية المشتركة
في لعبتك:
games-controller::paddleboat_static
الملفات المنفصلة
يتضمّن توزيع الأرشيف .zip لحزمة Android Game Development Kit ملفات العناوين وملفات المكتبة الخاصة بمكتبة Game Controller. يجب تضمين الملفات التالية في مشروعك لاستخدام مكتبة Game Controller:
ملف classes.jar يحتوي على أجزاء من رمز Dalvik الثانوي الخاص بمكتبة "وحدة التحكّم في الألعاب". يقع هذا الملف في libs/classes.jar
ملف رأس واجهة paddleboat.h يقع هذا الملف في
include/paddleboat/paddleboat.h
إما ملف المكتبة المشتركة libpaddleboat.so أو ملف المكتبة الثابتة libpaddleboat-static.a يمكن العثور على هذه الملفات في الأدلة الفرعية الخاصة بإعدادات الإصدار ضمن الدليل libs.
يتم تصنيف الأدلة الفرعية لإعدادات الإنشاء ضمن الدليل الجذر libs حسب ما يلي:
بنية ABI
أدنى مستوى لواجهة Android API
إصدار Android NDK
إصدار مكتبة وقت التشغيل C++
إعدادات إصدار أو تصحيح أخطاء البنية
على سبيل المثال، يحتوي الدليل الفرعي arm64-v8a_API16_NDK21_cpp_shared_Release على ملفات مكتبة خاصة بما يلي:
ARM 64-bit ABI
الحد الأدنى لمستوى واجهة برمجة التطبيقات هو 16
تم إنشاؤه باستخدام الإصدار 21 من NDK
تم إنشاؤه باستخدام إصدار المكتبة المشتركة من وقت تشغيل C++
إعدادات بنية الإصدار
يقع الملف libpaddleboat_static.a مباشرةً في الدليل الفرعي. يقع الملف libpaddleboat.so في lib/paddleboat/ ضمن الدليل الفرعي.
الخطوات التالية
راجِع الأدلة التالية لمواصلة دمج مكتبة Game Controller في لعبتك:
يخضع كل من المحتوى وعيّنات التعليمات البرمجية في هذه الصفحة للتراخيص الموضحّة في ترخيص استخدام المحتوى. إنّ Java وOpenJDK هما علامتان تجاريتان مسجَّلتان لشركة Oracle و/أو الشركات التابعة لها.
تاريخ التعديل الأخير: 2025-08-26 (حسب التوقيت العالمي المتفَّق عليه)
[[["يسهُل فهم المحتوى.","easyToUnderstand","thumb-up"],["ساعَدني المحتوى في حلّ مشكلتي.","solvedMyProblem","thumb-up"],["غير ذلك","otherUp","thumb-up"]],[["لا يحتوي على المعلومات التي أحتاج إليها.","missingTheInformationINeed","thumb-down"],["الخطوات معقدة للغاية / كثيرة جدًا.","tooComplicatedTooManySteps","thumb-down"],["المحتوى قديم.","outOfDate","thumb-down"],["ثمة مشكلة في الترجمة.","translationIssue","thumb-down"],["مشكلة في العيّنات / التعليمات البرمجية","samplesCodeIssue","thumb-down"],["غير ذلك","otherDown","thumb-down"]],["تاريخ التعديل الأخير: 2025-08-26 (حسب التوقيت العالمي المتفَّق عليه)"],[],[],null,["Game Controller Library\nPart of [Android Game Development Kit](/games/agdk/overview).\n\nThe Game Controller library, also known as Paddleboat, helps you implement robust support\nfor game controllers. The library provides the following:\n\n- Callbacks for detecting controller connections and disconnections\n- Controller device information, including button style and layout\n- Controller input data, standardized around modern dual-stick controller designs\n- Extended features on supported controllers, including vibration, lights, motion axis data, and battery status\n- Ability to read input from virtual and physical mouse devices\n- Ability to specify custom controller mapping data for particular devices\n\nCompatibility requirements\n\nThe Game Controller library has minimum compatibility requirements of:\n\n- Android 4.4 (API level 19) or higher\n- [Android NDK](/ndk) version 21 or higher\n\nIntegrate\n\nThe Game Controller library is distributed in two formats: As a [Jetpack](/jetpack)\nlibrary for games using a Gradle-based build system (including Android Studio),\nand as discrete files for games using custom build systems.\n\nFor a sample that integrates the Game Controller library, see the\n[games-samples repository](https://github.com/android/games-samples).\n\nJetpack library\n\nThe [Jetpack Android Games](/jetpack/androidx/releases/games) page has\nintegration instructions to add the Game Controller library dependency to your\ngame's `build.gradle` file.\n\nThe Jetpack library release of Game Controller is a static\nlibrary built against the C++ runtime shared library.\n\nAfter updating your `build.gradle` file, you will need to add the following\nline to your game's main `CMakeLists.txt` file: \n\n find_package(games-controller REQUIRED CONFIG)\n\nYou will also need to add the following entry to the list of libraries\nin the `target_link_libraries` command of your game's main shared\nlibrary: \n\n games-controller::paddleboat_static\n\nDiscrete files\n\nThe `.zip` archive distribution of the Android Game Development Kit includes\nheader and library files for the Game Controller library. The following files\nmust be included in your project to use the Game Controller library:\n\n- The `classes.jar` file containing the Dalvik bytecode portions of the Game Controller library. This file is located at `libs/classes.jar`\n- The `paddleboat.h` interface header file. This file is located at `include/paddleboat/paddleboat.h`\n- Either the `libpaddleboat.so` shared library file or the `libpaddleboat-static.a` static library file. These files are found in the build configuration subdirectories under the `libs` directory.\n\nThe build configuration subdirectories under the root `libs` directory are\ncategorized by:\n\n- ABI architecture\n- Minimum Android API level\n- Android NDK version\n- C++ runtime library version\n- Release or debug build configuration\n\nAs an example, the `arm64-v8a_API16_NDK21_cpp_shared_Release` subdirectory\ncontains library files for:\n\n- ARM 64-bit ABI\n- Minimum API level 16\n- Built against NDK version 21\n- Built against shared library version of C++ runtime\n- Release build configuration\n\nThe `libpaddleboat_static.a` file is located directly in the subdirectory. The\n`libpaddleboat.so` file is located at `lib/paddleboat/` within the subdirectory.\n\nNext steps\n\nSee the following guides to continue integrating the Game Controller library into your game:\n\n- [Use the Game Controller library](/games/sdk/game-controller/controller)\n- [Add mouse support](/games/sdk/game-controller/mouse)\n- [Add custom controller device mappings](/games/sdk/game-controller/custom-mapping)"]]