ios\u514d\u7b7e\u5c01\u88c5<\/a>0);<\/p>\n SDL_DestroyRenderer(renderer);<\/p>\n
SDL_DestroyWindow(window);<\/p>\n
SDL_Quit();<\/p>\n
return 0;<\/p>\n
}<\/p>\n
“`<\/p>\n
\u8fd9\u4e2a\u7a0b\u5e8f\u521b\u5efa\u4e86\u4e00\u4e2a\u7a97\u53e3\uff0c\u5e76\u5728\u7a97\u53e3\u4e2d\u7ed8\u5236\u4e86\u4e00\u4e2a\u7ea2\u8272\u7684\u77e9\u5f62\uff0c\u7136\u540e\u7b49\u5f853\u79d2\u949f\u540e\u9000\u51fa\u3002<\/p>\n
5. \u7f16\u5199CMakeLists.txt\u6587\u4ef6<\/p>\n
\u5728\u9879\u76ee\u6839\u76ee\u5f55\u4e0b\u521b\u5efa\u4e00\u4e2a\u540d\u4e3aCMakeLists.txt\u7684\u6587\u4ef6\uff0c\u7528\u4e8e\u914d\u7f6eCMake\u7684\u6784\u5efa\u8fc7\u7a0b\u3002\u4ee5\u4e0b\u662f\u4e00\u4e2a\u7b80\u5355\u7684CMakeLists.txt\u6587\u4ef6\uff1a<\/p>\n
“`cmake<\/p>\n
cmake_minimum_required(VERSION 3.4.1)<\/p>\n
add_library(SDL2 SHARED IMPORTED)<\/p>\n
set_target_properties(SDL2 PROPERTIES IMPORTED_LOCATION<\/p>\n
${CMAKE_CURRENT_SOURCE_DIR}\/src\/main\/jniLibs\/${ANDROID_ABI}\/libSDL2.so)<\/p>\n
add_library(SDLTest SHARED src\/main\/cpp\/main.cpp)<\/p>\n
target_include_directories(SDLTest PRIVATE src\/main\/cpp)<\/p>\n
target_link_libraries(SDLTest SDL2 log android)<\/p>\n
“`<\/p>\n
\u8fd9\u4e2a\u6587\u4ef6\u6307\u5b9a\u4e86SDL2\u5e93\u7684\u4f4d\u7f6e\uff0c\u5e76\u5c06main.cpp\u7f16\u8bd1\u4e3a\u4e00\u4e2a\u5171\u4eab\u5e93\u3002\u540c\u65f6\uff0c\u8fd8\u5c06SDL2\u5e93\u548cAndroid\u7cfb\u7edf\u5e93\u94fe\u63a5\u5230\u5171\u4eab\u5e93\u4e2d\u3002<\/p>\n
6. \u6784\u5efaAPK\u6587\u4ef6<\/p>\n
\u4f7f\u7528Android Studio\u6216\u547d\u4ee4\u884c\u5de5\u5177\u6784\u5efaAPK\u6587\u4ef6\u3002\u6784\u5efa\u8fc7\u7a0b\u4f1a\u81ea\u52a8\u5c06C\/C++\u4ee3\u7801\u7f16\u8bd1\u4e3a\u672c\u5730\u4ee3\u7801\uff0c\u5e76\u5c06\u5171\u4eab\u5e93\u6253\u5305\u5230APK\u6587\u4ef6\u4e2d\u3002<\/p>\n
7. \u8fd0\u884cAPK\u6587\u4ef6<\/p>\n
\u5c06APK\u6587\u4ef6\u5b89\u88c5\u5230Android\u8bbe\u5907\u6216\u6a21\u62df\u5668\u4e2d\uff0c\u5e76\u8fd0\u884c\u5e94\u7528\u7a0b\u5e8f\u3002\u5982\u679c\u4e00\u5207\u6b63\u5e38\uff0c\u5e94\u8be5\u80fd\u591f\u770b\u5230\u4e00\u4e2a\u7ea2\u8272\u7684\u77e9\u5f62\u5728\u5c4f\u5e55\u4e2d\u592e\u95ea\u70c13\u79d2\u949f\u540e\u6d88\u5931\u3002<\/p>\n
\u603b\u7ed3\uff1a<\/p>\n
\u5c06SDL\u5e94\u7528\u7a0b\u5e8f\u8f6c\u6362\u4e3aAPK\u6587\u4ef6\u9700\u8981\u501f\u52a9\u4e8eAndroid NDK\u548cAndroid SDK\u3002\u901a\u8fc7\u521b\u5efa\u4e00\u4e2aAndroid\u9879\u76ee\uff0c\u914d\u7f6ebuild.gradle\u6587\u4ef6\u3001\u7f16\u5199C\/C++\u4ee3\u7801\u3001\u7f16\u5199CMakeLists.txt\u6587\u4ef6\u3001\u6784\u5efaAPK\u6587\u4ef6\u548c\u8fd0\u884cAPK\u6587\u4ef6\u8fd9\u51e0\u4e2a\u6b65\u9aa4\uff0c\u5c31\u53ef\u4ee5\u5c06SDL\u5e94\u7528\u7a0b\u5e8f\u8f6c\u6362\u4e3aAndroid\u5e94\u7528\u7a0b\u5e8f\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"
SDL\uff08Simple DirectMedia Layer\uff09\u662f\u4e00\u79cd\u8de8\u5e73\u53f0\u7684\u591a\u5a92\u4f53\u5e94\u7528\u7a0b\u5e8f\u63a5\u53e3\uff0c\u5b83\u63d0\u4f9b\u4e86\u5e95\u5c42\u7684\u97f3\u9891\u3001\u89c6\u9891\u3001\u8f93\u5165\u548c\u56fe\u5f62\u5904\u7406\u529f\u80fd\uff0c\u53ef\u4ee5\u7528\u6765\u5f00\u53d1\u6e38\u620f\u3001\u5a92\u4f53\u64ad\u653e\u5668\u7b49\u5e94\u7528\u3002SDL\u53ef\u4ee5\u5728\u591a\u79cd\u64cd\u4f5c\u7cfb\u7edf<\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[24962,27313,38,116,12],"topic":[],"class_list":["post-30265","post","type-post","status-publish","format-standard","hentry","category-kaifaapp","tag-debipa","tag-ios--","tag-38","tag-116","tag-12"],"_links":{"self":[{"href":"https:\/\/www.zhidianwl.net\/zhidianwl\/wp-json\/wp\/v2\/posts\/30265","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.zhidianwl.net\/zhidianwl\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.zhidianwl.net\/zhidianwl\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.zhidianwl.net\/zhidianwl\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/www.zhidianwl.net\/zhidianwl\/wp-json\/wp\/v2\/comments?post=30265"}],"version-history":[{"count":1,"href":"https:\/\/www.zhidianwl.net\/zhidianwl\/wp-json\/wp\/v2\/posts\/30265\/revisions"}],"predecessor-version":[{"id":30281,"href":"https:\/\/www.zhidianwl.net\/zhidianwl\/wp-json\/wp\/v2\/posts\/30265\/revisions\/30281"}],"wp:attachment":[{"href":"https:\/\/www.zhidianwl.net\/zhidianwl\/wp-json\/wp\/v2\/media?parent=30265"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.zhidianwl.net\/zhidianwl\/wp-json\/wp\/v2\/categories?post=30265"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.zhidianwl.net\/zhidianwl\/wp-json\/wp\/v2\/tags?post=30265"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.zhidianwl.net\/zhidianwl\/wp-json\/wp\/v2\/topic?post=30265"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}