Zadbaj o dobrą organizację dzięki kolekcji
Zapisuj i kategoryzuj treści zgodnie ze swoimi preferencjami.
W sekcjach poniżej opisujemy, jak zintegrować bibliotekę Tuning Fork z zestawem narzędzi i jak korzystać z funkcji, które udostępnia ta biblioteka. Biblioteka jest dostępna jako biblioteka statyczna lub współdzielona w bibliotekach AGDK.
Po pobraniu pakietu SDK na komputer i zarejestrowaniu go w systemie kontroli wersji wprowadź w ustawieniach kompilacji projektu zmiany wymienione w sekcjach poniżej.
Zanim zaczniesz
Przed zintegrowaniem biblioteki Tuning Fork zintegruj bibliotekę Android Frame Pacing. W takim przypadku biblioteka Tuning Fork może automatycznie rejestrować czas klatki. Nie musisz samodzielnie wywoływać funkcji tick.
Więcej informacji znajdziesz w tych przewodnikach po integracji:
Czynności opisane w sekcji biblioteka statyczna statycznie łączą się z wersją biblioteki Tuning Fork skompilowaną dla danej kombinacji ABI, poziomu interfejsu API, NDK i STL. Jeśli ta kombinacja nie jest dostępna w Twoich ustawieniach, możesz zamiast tego utworzyć link do biblioteki udostępnionej:
Dodaj gamesdk/include do ścieżek dołączania kompilatora.
Dodaj do ścieżek biblioteki linkera ścieżkę w tym formacie:
Statyczne łączenie zapewnia znacznie mniejszy rozmiar kodu, ponieważ nie musisz dołączać biblioteki współdzielonej libtuningfork.so.
Używanie CMake (tylko biblioteka statyczna)
Jeśli używasz CMake, w pliku gamesdk/samples/tuningfork/insightsdemo/app/CMakeLists.txt znajdziesz przykładową konfigurację CMake. Zawiera on plik narzędziowy gamesdk/samples/gamesdk.cmake, który przeprowadza końcowe sprawdzenie, dodaje odpowiednie ścieżki dołączania kompilatora i generuje element docelowy, którego możesz użyć do połączenia biblioteki.
Aby użyć tego narzędzia:
Dołącz ten plik do pliku CMakeLists.txt:include("path/to/gamesdk/samples/gamesdk.cmake")
Wywołaj funkcję add_gamesdk_target z folderem zawierającym pakiet SDK do gier: add_gamesdk_target(PACKAGE_DIR
path/to/gamesdk)
W pliku target_link_libraries biblioteki natywnej dodaj tuningfork jako zależność (i swappy, jeśli zintegrowano bibliotekę Android Frame Pacing): target_link_libraries(native-lib swappy tuningfork ...)
Treść strony i umieszczone na niej fragmenty kodu podlegają licencjom opisanym w Licencji na treści. Java i OpenJDK są znakami towarowymi lub zastrzeżonymi znakami towarowymi należącymi do firmy Oracle lub jej podmiotów stowarzyszonych.
Ostatnia aktualizacja: 2025-08-26 UTC.
[[["Łatwo zrozumieć","easyToUnderstand","thumb-up"],["Rozwiązało to mój problem","solvedMyProblem","thumb-up"],["Inne","otherUp","thumb-up"]],[["Brak potrzebnych mi informacji","missingTheInformationINeed","thumb-down"],["Zbyt skomplikowane / zbyt wiele czynności do wykonania","tooComplicatedTooManySteps","thumb-down"],["Nieaktualne treści","outOfDate","thumb-down"],["Problem z tłumaczeniem","translationIssue","thumb-down"],["Problem z przykładami/kodem","samplesCodeIssue","thumb-down"],["Inne","otherDown","thumb-down"]],["Ostatnia aktualizacja: 2025-08-26 UTC."],[],[],null,["The following sections describe how to integrate the Tuning Fork library\ninto your toolchain and how to use the functions that the library provides. The\nlibrary is available as a static or shared library in the AGDK Libraries.\n\nAfter you've [downloaded the SDK](/games/sdk#download) to your machine and\nchecked it into your source control system, make the changes listed in the\nfollowing sections to your project's build settings.\n\nBefore you begin\n\nYou should integrate the [Android Frame Pacing library](/games/sdk/frame-pacing)\nbefore integrating the Tuning Fork library. If you do this, the\nTuning Fork library can automatically record frame time; there is no\nneed to explicitly call the tick functions yourself.\n\nSee the following integration guides for more information:\n\n- [Integrate Android Frame Pacing into your OpenGL renderer](/games/sdk/frame-pacing/opengl)\n- [Integrate Android Frame Pacing into your Vulkan renderer](/games/sdk/frame-pacing/vulkan)\n\nStatic library\n\nTo link your project to the static library, do the following:\n\n1. Add `gamesdk/include` to your compiler include paths.\n2. Add a path of the following form in your linker library paths:\n\n ```\n gamesdk/libs/architecture_APIapiLevel_NDKndkVersion_stlVersion_Release\n ```\n\n Look in `gamesdk/libs` and pick the one that best suits your toolchain (for\n example, `gamesdk/libs/arm64-v8a_API24_NDK17_cpp_static_Release`).\n3. Add `-ltuningfork_static` to your linker command (and `-lswappy_static` if\n you integrated the Android Frame Pacing library).\n\n4. Add the `INTERNET` permission to your `AndroidManifest.xml` file:\n\n \u003cuses-permission android:name=\"android.permission.INTERNET\" /\u003e\n\nShared library\n\nThe steps in the [static library](#static-library) section statically link\nagainst a version of the Tuning Fork library compiled for the given ABI,\nAPI level, NDK, and STL combination. If the combination is not available for\nyour settings, you can instead link against the shared library:\n\n1. Add `gamesdk/include` to your compiler include paths.\n2. Add a path of the following form in your linker library paths:\n\n ```\n gamesdk/libs/architecture_APIapiLevel_NDKndkVersion_stlVersion_Release/lib/tuningfork\n ```\n3. Add `-ltuningfork` to your linker command (and `-lswappy` if you integrated\n the Android Frame Pacing library).\n\n4. Add the `INTERNET` permission to your `AndroidManifest.xml` file:\n\n \u003cuses-permission android:name=\"android.permission.INTERNET\" /\u003e\n\nStatic linking gives you a much smaller code footprint as you don't need to\nbundle the `libtuningfork.so` shared library.\n\nUsing CMake (static library only)\n\nIf you are using CMake, see the\n`gamesdk/samples/tuningfork/insightsdemo/app/CMakeLists.txt` file for an example\nCMake configuration. It includes a utility file,\n`gamesdk/samples/gamesdk.cmake`, which performs final checks, adds the proper\ncompiler include paths, and generates a target that you can use to link the\nlibrary.\n\nTo use this utility, do the following:\n\n1. Include this file in your `CMakeLists.txt` file: `include(\"`\u003cvar translate=\"no\"\u003epath/to/gamesdk\u003c/var\u003e`/samples/gamesdk.cmake\")`\n2. Call the `add_gamesdk_target` function with the folder containing the gamesdk: `add_gamesdk_target(PACKAGE_DIR\n `\u003cvar translate=\"no\"\u003epath/to/gamesdk\u003c/var\u003e`)`\n3. In your `target_link_libraries` for your native library, add `tuningfork` as a dependency (and `swappy` if you integrated the Android Frame Pacing library): ` target_link_libraries(native-lib swappy tuningfork ...) `\n\n| **Note:** The path to the gamesdk used for `include` and `add_gamesdk_target` can either be absolute (for example, `/home/yourusername/gamesdk` or `C:\\Android\\gamesdk`) or relative to the `CMakeLists.txt` file.\n\nFor advanced usage of CMake, see the [`gamesdk.cmake` source file](https://android.googlesource.com/platform/frameworks/opt/gamesdk/+/refs/heads/master/samples/gamesdk.cmake)."]]