{"id":2502,"date":"2020-01-12T11:47:43","date_gmt":"2020-01-12T08:47:43","guid":{"rendered":"http:\/\/demensdeum.com\/blog\/?p=2502"},"modified":"2024-12-16T22:32:30","modified_gmt":"2024-12-16T19:32:30","slug":"porting-cpp-sdl-app-on-android","status":"publish","type":"post","link":"https:\/\/demensdeum.com\/blog\/ja\/2020\/01\/12\/porting-cpp-sdl-app-on-android\/","title":{"rendered":"C++ SDL \u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u306e Android \u3078\u306e\u79fb\u690d"},"content":{"rendered":"<p>\u3053\u306e\u6295\u7a3f\u3067\u306f\u30013D \u30a8\u30c7\u30a3\u30bf\u306e\u30d7\u30ed\u30c8\u30bf\u30a4\u30d7\u3092\u79fb\u690d\u3057\u305f\u79c1\u306e\u7d4c\u9a13\u306b\u3064\u3044\u3066\u8aac\u660e\u3057\u307e\u3059 <a href=\"https:\/\/gitlab.com\/demensdeum\/cube-art-project-bootstrap\" target=\"_blank\" rel=\" Android \u4e0a\u306e noopener noreferrer\">\u30ad\u30e5\u30fc\u30d6 \u30a2\u30fc\u30c8 \u30d7\u30ed\u30b8\u30a7\u30af\u30c8<\/a><br \/>\u307e\u305a\u3001\u8d64\u3044 3D \u30ad\u30e5\u30fc\u30d6 \u30ab\u30fc\u30bd\u30eb\u3092\u6301\u3064\u30a8\u30c7\u30a3\u30bf\u304c\u30a8\u30df\u30e5\u30ec\u30fc\u30bf\u3067\u5b9f\u884c\u3055\u308c\u3066\u3044\u308b\u7d50\u679c\u3092\u898b\u3066\u307f\u307e\u3057\u3087\u3046\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-2509\" src=\"https:\/\/demensdeum.com\/blog\/wp-content\/uploads\/2020\/01\/emulator.png\" alt=\"\" width=\"460\" height=\"265\" srcset=\"https:\/\/demensdeum.com\/blog\/wp-content\/uploads\/2020\/01\/emulator.png 959w, https:\/\/demensdeum.com\/blog\/wp-content\/uploads\/2020\/01\/emulator-300x173.png 300w, https:\/\/demensdeum.com\/blog\/wp-content\/uploads\/2020\/01\/emulator-768x442.png 768w\" sizes=\"auto, (max-width: 460px) 100vw, 460px\" \/><\/p>\n<p>\u7d44\u307f\u7acb\u3066\u3092\u6210\u529f\u3055\u305b\u308b\u306b\u306f\u3001\u6b21\u306e\u3053\u3068\u3092\u884c\u3046\u5fc5\u8981\u304c\u3042\u308a\u307e\u3057\u305f:<\/p>\n<p><\u30aa\u30eb><\/p>\n<li>\u6700\u65b0\u306e Android SDK \u3068 NDK \u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u307e\u3059\uff08NDK \u30d0\u30fc\u30b8\u30e7\u30f3\u306f\u65b0\u3057\u3044\u307b\u3069\u826f\u3044\u3067\u3059\uff09<\/li>\n<li>SDL2 \u30bd\u30fc\u30b9 \u30b3\u30fc\u30c9\u3092\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u3057\u3001\u305d\u3053\u304b\u3089\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8\u3092\u53d6\u5f97\u3057\u3066 Android \u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3092\u69cb\u7bc9\u3057\u307e\u3059\u3002<\/li>\n<li>SDL \u30a4\u30e1\u30fc\u30b8\u3001SDL \u30df\u30ad\u30b5\u30fc\u3092\u30a2\u30bb\u30f3\u30d6\u30ea\u306b\u8ffd\u52a0\u3057\u307e\u3059\u3002<\/li>\n<li>\u30b2\u30fc\u30e0 \u30a8\u30f3\u30b8\u30f3\u3068\u30c4\u30fc\u30eb\u30ad\u30c3\u30c8\u306e\u30e9\u30a4\u30d6\u30e9\u30ea\u3001\u305d\u308c\u3089\u306e\u4f9d\u5b58\u95a2\u4fc2 (GLM\u3001\u30e2\u30c0\u30f3 C++ \u7528\u306e JSON) \u3092\u8ffd\u52a0\u3057\u307e\u3059<\/li>\n<li>\u30a2\u30bb\u30f3\u30d6\u30ea \u30d5\u30a1\u30a4\u30eb\u3092 Gradle \u306b\u9069\u5408\u3055\u305b\u308b\u3002<\/li>\n<li>Android \u3068\u306e\u4e92\u63db\u6027\u306e\u305f\u3081\u306b C++ \u30b3\u30fc\u30c9\u3092\u8abf\u6574\u3057\u3001\u5f71\u97ff\u3092\u53d7\u3051\u308b\u30d7\u30e9\u30c3\u30c8\u30d5\u30a9\u30fc\u30e0\u4f9d\u5b58\u30b3\u30f3\u30dd\u30fc\u30cd\u30f3\u30c8\uff08OpenGL ES\u3001\u30b0\u30e9\u30d5\u30a3\u30c3\u30af\u30b9 \u30b3\u30f3\u30c6\u30ad\u30b9\u30c8\u306e\u521d\u671f\u5316\uff09\u3092\u5909\u66f4\u3059\u308b<\/li>\n<li>\u30a8\u30df\u30e5\u30ec\u30fc\u30bf\u4e0a\u3067\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u3092\u30d3\u30eb\u30c9\u3057\u3066\u30c6\u30b9\u30c8\u3057\u307e\u3059\u3002<\/li>\n<\/ol>\n<h3>\u30d7\u30ed\u30b8\u30a7\u30af\u30c8 \u30c6\u30f3\u30d7\u30ec\u30fc\u30c8<\/h3>\n<p>\u30bd\u30fc\u30b9 SDL\u3001SDL \u30a4\u30e1\u30fc\u30b8\u3001SDL \u30df\u30ad\u30b5\u30fc\u306e\u8aad\u307f\u8fbc\u307f:<br \/><a href=\"https:\/\/www.libsdl.org\/download-2.0.php\" target=\"_blank\" rel=\"noopener noreferrer\">https:\/\/www.libsdl.org\/download-2.0.php<\/a><br \/>\ndocs \u30d5\u30a9\u30eb\u30c0\u30fc\u306b\u306f\u3001Android \u30d7\u30ed\u30b8\u30a7\u30af\u30c8 \u30c6\u30f3\u30d7\u30ec\u30fc\u30c8\u3092\u4f7f\u7528\u3059\u308b\u305f\u3081\u306e\u8a73\u7d30\u306a\u624b\u9806\u304c\u542b\u307e\u308c\u3066\u3044\u307e\u3059\u3002 android-project \u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u3092\u5225\u306e\u30d5\u30a9\u30eb\u30c0\u30fc\u306b\u30b3\u30d4\u30fc\u3059\u308b\u304b\u3001\u30b7\u30f3\u30dc\u30ea\u30c3\u30af\u30ea\u30f3\u30af\u3092\u4f5c\u6210\u3059\u308b\u304b\u3001SDL \u30d5\u30a9\u30eb\u30c0\u30fc\u3092 android-project\/app\/jni \u306b\u30b3\u30d4\u30fc\u3057\u307e\u3059\u3002<br \/>avd \u30d5\u30e9\u30b0\u3092\u6b63\u3057\u3044\u8b58\u5225\u5b50\u306b\u7f6e\u304d\u63db\u3048\u3066\u3001Sdk:<\/p>\n<p> \u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u304b\u3089 Android \u30a8\u30df\u30e5\u30ec\u30fc\u30bf\u3092\u8d77\u52d5\u3057\u307e\u3059\u3002<\/p>\n<div class=\"hcb_wrap\">\n<pre class=\"prism line-numbers lang-unknown\" data-lang=\"unknown\"><code>cd ~\/Android\/Sdk\/emulator\n.\/emulator -avd Pixel_2_API_24\n\n<\/code><\/pre>\n<\/div>\n<p>\u30b9\u30af\u30ea\u30d7\u30c8\u3067\u30d1\u30b9\u3092\u6307\u5b9a\u3057\u3001\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u3092\u30a2\u30bb\u30f3\u30d6\u30eb\u3057\u307e\u3059\u3002<\/p>\n<div class=\"hcb_wrap\">\n<pre class=\"prism line-numbers lang-unknown\" data-lang=\"unknown\"><code>rm -rf app\/build || true\nexport ANDROID_HOME=\/home\/demensdeum\/Android\/Sdk\/\nexport ANDROID_NDK_HOME=\/home\/demensdeum\/Android\/android-ndk-r21-beta2\/\n.\/gradlew clean build\n.\/gradlew installDebug\n\n<\/code><\/pre>\n<\/div>\n<p>\u30d5\u30a1\u30a4\u30eb\u304b\u3089\u306e C \u30b3\u30fc\u30c9\u3092\u542b\u3080 SDL \u30d7\u30ed\u30b8\u30a7\u30af\u30c8 \u30c6\u30f3\u30d7\u30ec\u30fc\u30c8\u3092\u30a2\u30bb\u30f3\u30d6\u30eb\u3059\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059<\/p>\n<div class=\"hcb_wrap\">\n<pre class=\"prism line-numbers lang-unknown\" data-lang=\"unknown\"><code>android-sdl-test-app\/cube-art-project-android\/app\/jni\/src\/YourSourceHere.c\n\n<\/code><\/pre>\n<\/div>\n<h3>\u4f9d\u5b58\u95a2\u4fc2<\/h3>\n<p>SDL_image\u3001SDL_mixer \u306e\u30bd\u30fc\u30b9 \u30b3\u30fc\u30c9\u3092\u30a2\u30fc\u30ab\u30a4\u30d6\u304b\u3089\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u3057\u307e\u3059\u3002<br \/><a href=\"https:\/\/www.libsdl.org\/projects\/SDL_image\/\" target=\"_blank\" rel=\"noopener noreferrer\">https:\/\/www.libsdl.org\/projects\/SDL_image\/<\/a><br \/>\n<a href=\"https:\/\/www.libsdl.org\/projects\/SDL_mixer\/\" target=\"_blank\" rel=\"noopener noreferrer\">https:\/\/www.libsdl.org\/projects\/SDL_mixer\/<\/a><\/p>\n<p>\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u306e\u4f9d\u5b58\u95a2\u4fc2\uff08\u5171\u6709\u30e9\u30a4\u30d6\u30e9\u30ea\u306a\u3069\uff09\u3092\u8aad\u307f\u8fbc\u307f\u307e\u3059\u3002<br \/><a href=\"https:\/\/gitlab.com\/demensdeum\/FlameSteelCore\/\" target=\"_blank\" rel=\"noopener noreferrer\">https:\/\/gitlab.com\/demensdeum\/FlameSteelCore\/<\/a><br \/>\n<a href=\"https:\/\/gitlab.com\/demensdeum\/FlameSteelCommonTraits\" target=\"_blank\" rel=\"noopener noreferrer\">https:\/\/gitlab.com\/demensdeum\/FlameSteelCommonTraits<\/a><br \/>\n<a href=\"https:\/\/gitlab.com\/demensdeum\/FlameSteelBattleHorn\" target=\"_blank\" rel=\"noopener noreferrer\">https:\/\/gitlab.com\/demensdeum\/FlameSteelBattleHorn<\/a><br \/>\n<a href=\"https:\/\/gitlab.com\/demensdeum\/FlameSteelEngineGameToolkit\/\" target=\"_blank\" rel=\"noopener noreferrer\">https:\/\/gitlab.com\/demensdeum\/FlameSteelEngineGameToolkit\/<\/a><br \/>\n<a href=\"https:\/\/gitlab.com\/demensdeum\/FlameSteelEngineGameToolkitFSGL\" target=\"_blank\" rel=\"noopener noreferrer\">https:\/\/gitlab.com\/demensdeum\/FlameSteelEngineGameToolkitFSGL<\/a><br \/>\n<a href=\"https:\/\/gitlab.com\/demensdeum\/FSGL\" target=\"_blank\" rel=\"noopener noreferrer\">https:\/\/gitlab.com\/demensdeum\/FSGL<\/a><br \/>\n<a href=\"https:\/\/gitlab.com\/demensdeum\/cube-art-project\" target=\"_blank\" rel=\"noopener noreferrer\">https:\/\/gitlab.com\/demensdeum\/cube-art-project<\/a><\/p>\n<p>\u3053\u308c\u3089\u3059\u3079\u3066\u3092 app\/jni \u306b\u30a2\u30c3\u30d7\u30ed\u30fc\u30c9\u3057\u3001\u5404\u300c\u30e2\u30b8\u30e5\u30fc\u30eb\u300d\u3092\u5225\u306e\u30d5\u30a9\u30eb\u30c0\u30fc (\u4f8b: app\/jni\/FSGL) \u306b\u30a2\u30c3\u30d7\u30ed\u30fc\u30c9\u3057\u307e\u3059\u3002\u6b21\u306b\u3001Application.mk \u304a\u3088\u3073 Android.mk \u30d5\u30a1\u30a4\u30eb\u306e\u52d5\u4f5c\u3059\u308b\u30b8\u30a7\u30cd\u30ec\u30fc\u30bf\u30fc\u3092\u898b\u3064\u3051\u308b\u30aa\u30d7\u30b7\u30e7\u30f3\u304c\u3042\u308a\u307e\u3059\u3002\u79c1\u306f\u305d\u308c\u3089\u3092\u898b\u3064\u3051\u3089\u308c\u307e\u305b\u3093\u3067\u3057\u305f\u304c\u3001\u304a\u305d\u3089\u304f CMake \u306b\u57fa\u3065\u304f\u7c21\u5358\u306a\u89e3\u6c7a\u7b56\u304c\u3042\u308b\u3067\u3057\u3087\u3046\u3002\u30ea\u30f3\u30af\u3092\u30af\u30ea\u30c3\u30af\u3057\u3066\u3001Android NDK \u306e\u30a2\u30bb\u30f3\u30d6\u30ea \u30d5\u30a1\u30a4\u30eb\u5f62\u5f0f\u306b\u3064\u3044\u3066\u5b66\u3073\u59cb\u3081\u3066\u304f\u3060\u3055\u3044\u3002<br \/><a href=\"https:\/\/developer.android.com\/ndk\/guides\/application_mk\" target=\"_blank\" rel=\"noopener noreferrer\">https:\/\/developer.android.com\/ndk\/guides\/application_mk<\/a><br \/>\n<a href=\"https:\/\/developer.android.com\/ndk\/guides\/android_mk\" target=\"_blank\" rel=\"noopener noreferrer\">https:\/\/developer.android.com\/ndk\/guides\/android_mk<\/a><\/p>\n<p>NDK \u306e\u3055\u307e\u3056\u307e\u306a APP_STL \u5b9f\u88c5\u306b\u3064\u3044\u3066\u3082\u304a\u8aad\u307f\u304f\u3060\u3055\u3044\u3002<br \/><a href=\"https:\/\/developer.android.com\/ndk\/guides\/cpp-support.html\" target=\"_blank\" rel=\"noopener noreferrer\">https:\/\/developer.android.com\/ndk\/guides\/cpp-support.html<\/a><\/p>\n<p>\u6163\u308c\u305f\u5f8c\u3001\u300c\u30e2\u30b8\u30e5\u30fc\u30eb\u300d\u3054\u3068\u306b Android.mk \u30d5\u30a1\u30a4\u30eb\u3092\u4f5c\u6210\u3057\u3001\u7d9a\u3044\u3066\u5171\u6709\u30e9\u30a4\u30d6\u30e9\u30ea Cube-Art-Project \u306e\u30b5\u30f3\u30d7\u30eb \u30a2\u30bb\u30f3\u30d6\u30ea \u30d5\u30a1\u30a4\u30eb\u3092\u4f5c\u6210\u3057\u307e\u3059\u3002<\/p>\n<div class=\"hcb_wrap\">\n<pre class=\"prism line-numbers lang-unknown\" data-lang=\"unknown\"><code>LOCAL_PATH := $(call my-dir)\ninclude $(CLEAR_VARS)\n\nAPP_STL := c++_static\nAPP_CPPFLAGS := -fexceptions\nLOCAL_MODULE := CubeArtProject\nLOCAL_C_INCLUDES := $(LOCAL_PATH)\/src $(LOCAL_PATH)\/..\/include $(LOCAL_PATH)\/..\/include\/FlameSteelCommonTraits\/src\/FlameSteelCommonTraits\nLOCAL_EXPORT_C_INCLUDES = $(LOCAL_PATH)\/src\/\n\ndefine walk\n$(wildcard $(1)) $(foreach e, $(wildcard $(1)\/*), $(call walk, $(e)))\nendef\n\nALLFILES = $(call walk, $(LOCAL_PATH)\/src)\nFILE_LIST := $(filter %.cpp, $(ALLFILES))\n$(info CubeArtProject source code files list)\n$(info $(FILE_LIST))\nLOCAL_SRC_FILES := $(FILE_LIST:$(LOCAL_PATH)\/%=%)\n\nLOCAL_SHARED_LIBRARIES += FlameSteelCore\nLOCAL_SHARED_LIBRARIES += FlameSteelBattleHorn\nLOCAL_SHARED_LIBRARIES += FlameSteelCommonTraits\nLOCAL_SHARED_LIBRARIES += FlameSteelEngineGameToolkit\nLOCAL_SHARED_LIBRARIES += FlameSteelEngineGameToolkitFSGL\nLOCAL_SHARED_LIBRARIES += FSGL\nLOCAL_SHARED_LIBRARIES += SDL2\nLOCAL_SHARED_LIBRARIES += SDL2_image\n\nLOCAL_LDFLAGS := -static-libstdc++\ninclude $(BUILD_SHARED_LIBRARY)\n\n<\/code><\/pre>\n<\/div>\n<p>\u7d4c\u9a13\u8c4a\u5bcc\u306a CMake \u30e6\u30fc\u30b6\u30fc\u306a\u3089\u6700\u521d\u306e\u884c\u304b\u3089\u3053\u306e\u69cb\u6210\u3092\u7406\u89e3\u3067\u304d\u308b\u3067\u3057\u3087\u3046\u3002\u5f62\u5f0f\u306f\u975e\u5e38\u306b\u4f3c\u3066\u304a\u308a\u3001Android.mk \u306b\u306f GLOB_RECURSIVE \u304c\u306a\u3044\u305f\u3081\u3001walk \u95a2\u6570\u3092\u4f7f\u7528\u3057\u3066\u30bd\u30fc\u30b9 \u30d5\u30a1\u30a4\u30eb\u3092\u518d\u5e30\u7684\u306b\u691c\u7d22\u3059\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002<\/p>\n<p>C \u30b3\u30fc\u30c9\u3067\u306f\u306a\u304f C++ \u3092\u30d3\u30eb\u30c9\u3059\u308b\u305f\u3081\u306b Application.mk\u3001Android.mk \u3092\u5909\u66f4\u3057\u307e\u3059\u3002<\/p>\n<div class=\"hcb_wrap\">\n<pre class=\"prism line-numbers lang-unknown\" data-lang=\"unknown\"><code>APP_ABI := armeabi-v7a arm64-v8a x86 x86_64\nAPP_PLATFORM=android-16\nAPP_STL := c++_static\nAPP_CPPFLAGS := -fexceptions\n\n<\/code><\/pre>\n<\/div>\n<p>YourSourceHere.c -> YourSourceHere.cpp \u306e\u540d\u524d\u3092\u5909\u66f4\u3057\u3001\u30a8\u30f3\u30c8\u30ea\u3092 grep \u3057\u3001\u30a2\u30bb\u30f3\u30d6\u30ea\u5185\u306e\u30d1\u30b9\u3092\u5909\u66f4\u3057\u307e\u3059\u3002<\/p>\n<div class=\"hcb_wrap\">\n<pre class=\"prism line-numbers lang-unknown\" data-lang=\"unknown\"><code>app\/jni\/src\/Android.mk:LOCAL_SRC_FILES := YourSourceHere.cpp\n\n<\/code><\/pre>\n<\/div>\n<p>\u6b21\u306b\u3001\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u3092\u30d3\u30eb\u30c9\u3057\u3066\u307f\u307e\u3059\u3002\u30d8\u30c3\u30c0\u30fc\u304c\u306a\u3044\u3053\u3068\u306b\u95a2\u3059\u308b\u30b3\u30f3\u30d1\u30a4\u30e9\u30fc\u304b\u3089\u306e\u30a8\u30e9\u30fc\u304c\u8868\u793a\u3055\u308c\u305f\u5834\u5408\u306f\u3001Android.mk \u5185\u306e\u30d1\u30b9\u304c\u6b63\u3057\u3044\u3053\u3068\u3092\u78ba\u8a8d\u3057\u3066\u304f\u3060\u3055\u3044\u3002 \u300c\u672a\u5b9a\u7fa9\u306e\u53c2\u7167\u300d\u306a\u3069\u306e\u30ea\u30f3\u30ab\u30fc\u304b\u3089\u306e\u30a8\u30e9\u30fc\u304c\u3042\u308b\u5834\u5408\u306f\u3001\u30a2\u30bb\u30f3\u30d6\u30ea\u5185\u306e\u30bd\u30fc\u30b9 \u30b3\u30fc\u30c9 \u30d5\u30a1\u30a4\u30eb\u304c\u6b63\u3057\u304f\u6307\u5b9a\u3055\u308c\u3066\u3044\u308b\u3053\u3068\u3092\u78ba\u8a8d\u3057\u3066\u304f\u3060\u3055\u3044\u3002\u30ea\u30b9\u30c8\u306f\u3001Android.mk \u30d5\u30a1\u30a4\u30eb\u3067 $(info $(FILE_LIST)) \u3092\u6307\u5b9a\u3059\u308b\u3053\u3068\u3067\u8ffd\u8de1\u3067\u304d\u307e\u3059\u3002 LOCAL_SHARED_LIBRARIES \u30ad\u30fc\u306e\u30e2\u30b8\u30e5\u30fc\u30eb\u3092\u4f7f\u7528\u3057\u3001FSGL \u306a\u3069\u306e LD \u3092\u4ecb\u3057\u3066\u6b63\u3057\u3044\u30ea\u30f3\u30af\u3092\u4f7f\u7528\u3059\u308b\u3001\u4e8c\u91cd\u30ea\u30f3\u30af \u30e1\u30ab\u30cb\u30ba\u30e0\u3092\u5fd8\u308c\u306a\u3044\u3067\u304f\u3060\u3055\u3044\u3002<\/p>\n<div class=\"hcb_wrap\">\n<pre class=\"prism line-numbers lang-unknown\" data-lang=\"unknown\"><code>LOCAL_LDLIBS := -lEGL -lGLESv2\n\n<\/code><\/pre>\n<\/div>\n<h3>\u9069\u5fdc\u3068\u767a\u58f2<\/h3>\n<p>\u3044\u304f\u3064\u304b\u306e\u70b9\u3092\u5909\u66f4\u3059\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3057\u305f\u3002\u305f\u3068\u3048\u3070\u3001iOS \u304a\u3088\u3073 Android \u306e\u30d3\u30eb\u30c9\u304b\u3089 GLEW \u3092\u524a\u9664\u3057\u3001\u4e00\u90e8\u306e OpenGL \u547c\u3073\u51fa\u3057\u306e\u540d\u524d\u3092\u5909\u66f4\u3057\u3001EOS \u30dd\u30b9\u30c8\u30d5\u30a3\u30c3\u30af\u30b9 (glGenVertexArrays -> glGenVertexArraysOES) \u3092\u8ffd\u52a0\u3057\u3001\u6b20\u843d\u3057\u3066\u3044\u308b\u6700\u65b0\u306e\u30c7\u30d0\u30c3\u30b0\u95a2\u6570\u7528\u306e\u30de\u30af\u30ed\u3092\u8ffd\u52a0\u3057\u307e\u3057\u305f\u3002\u304a\u307e\u3051\u306b\u3001\u30de\u30af\u30ed\u3092\u793a\u3059 GLES2 \u30d8\u30c3\u30c0\u30fc\u304c\u6697\u9ed9\u7684\u306b\u7d44\u307f\u8fbc\u307e\u308c\u3066\u3044\u308b\u3053\u3068\u3067\u3059\u3002 GL_GLEXT_PROTOTYPES 1:<\/p>\n<div class=\"hcb_wrap\">\n<pre class=\"prism line-numbers lang-unknown\" data-lang=\"unknown\"><code>#define GL_GLEXT_PROTOTYPES 1\n#include \"SDL_opengles2.h\"\n\n<\/code><\/pre>\n<\/div>\n<p>\u307e\u305f\u3001\u6700\u521d\u306e\u8d77\u52d5\u6642\u306b\u9ed2\u3044\u753b\u9762\u304c\u8868\u793a\u3055\u308c\u3001\u300cE\/libEGL: validate_display:255 error 3008 (EGL_BAD_DISPLAY)\u300d\u306e\u3088\u3046\u306a\u30a8\u30e9\u30fc\u304c\u8868\u793a\u3055\u308c\u3001SDL \u30a6\u30a3\u30f3\u30c9\u30a6\u306e\u521d\u671f\u5316\u3001OpenGL \u30d7\u30ed\u30d5\u30a1\u30a4\u30eb\u304c\u5909\u66f4\u3055\u308c\u3001\u3059\u3079\u3066\u304c\u6a5f\u80fd\u3057\u307e\u3057\u305f\u3002<\/p >\n<div class=\"hcb_wrap\">\n<pre class=\"prism line-numbers lang-unknown\" data-lang=\"unknown\"><code>SDL_DisplayMode mode;\nSDL_GetDisplayMode(0,0,&mode);\nint width = mode.w;\nint height = mode.h;\n\nwindow = SDL_CreateWindow(\n            title,\n            0,\n            0,\n            width,\n            height,\n            SDL_WINDOW_OPENGL | SDL_WINDOW_FULLSCREEN | SDL_WINDOW_RESIZABLE\n        );\n\nSDL_GL_SetAttribute( SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_ES );\n<\/code><\/pre>\n<\/div>\n<p>\u30a8\u30df\u30e5\u30ec\u30fc\u30bf\u3067\u306f\u3001\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u306f\u30c7\u30d5\u30a9\u30eb\u30c8\u3067 SDL \u30a2\u30a4\u30b3\u30f3\u3068\u300cGame\u300d\u3068\u3044\u3046\u540d\u524d\u3067\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3055\u308c\u307e\u3059\u3002<\/p>\n<p>CMake \u306b\u57fa\u3065\u3044\u3066\u30a2\u30bb\u30f3\u30d6\u30ea \u30d5\u30a1\u30a4\u30eb\u3092\u81ea\u52d5\u7684\u306b\u751f\u6210\u3059\u308b\u304b\u3001\u3059\u3079\u3066\u306e\u30d7\u30e9\u30c3\u30c8\u30d5\u30a9\u30fc\u30e0\u306e\u30a2\u30bb\u30f3\u30d6\u30ea\u3092 Gradle \u306b\u79fb\u884c\u3059\u308b\u53ef\u80fd\u6027\u3092\u691c\u8a0e\u3059\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002\u305f\u3060\u3057\u3001CMake \u306f\u73fe\u5728\u9032\u884c\u4e2d\u306e C++ \u958b\u767a\u306b\u304a\u3051\u308b\u4e8b\u5b9f\u4e0a\u306e\u9078\u629e\u80a2\u3067\u3042\u308a\u7d9a\u3051\u3066\u3044\u307e\u3059\u3002<\/p>\n<h3>\u30bd\u30fc\u30b9\u30b3\u30fc\u30c9<\/h3>\n<p><a href=\"https:\/\/gitlab.com\/demensdeum\/android-sdl-test-app\" target=\"_blank\" rel=\"noopener noreferrer\">https:\/\/gitlab.com\/demensdeum\/android- sdl-\u30c6\u30b9\u30c8-\u30a2\u30d7\u30ea<\/a><br \/><a href=\"https:\/\/gitlab.com\/demensdeum\/android-sdl-test-app\/tree\/master\/cube-art-project-android\" target=\"_blank\" rel=\"noopener noreferrer\">https:\/\/gitlab.com\/demensdeum\/android-sdl-test-app\/tree\/master\/cube-art-project-android<\/a><\/p>\n<h3>\u30bd\u30fc\u30b9<\/h3>\n<p><a href=\"https:\/\/developer.android.com\/ndk\/guides\/cpp-support.html\" target=\"_blank\" rel=\"noopener noreferrer\">https:\/\/developer.android.com\/ ndk\/guides\/cpp-support.html<\/a><br \/><a href=\"https:\/\/developer.android.com\/ndk\/guides\/application_mk\" target=\"_blank\" rel=\"noopener noreferrer\">https:\/\/developer.android.com\/ndk\/guides\/application_mk<\/a><br \/>\n<a href=\"https:\/\/developer.android.com\/ndk\/guides\/android_mk\" target=\"_blank\" rel=\"noopener noreferrer\">https:\/\/developer.android.com\/ndk\/guides\/android_mk<\/a><br \/>\n<a href=\"https:\/\/lazyfoo.net\/tutorials\/SDL\/52_hello_mobile\/android_windows\/index.php\" target=\"_blank\" rel=\"noopener noreferrer\">https:\/\/lazyfoo.net\/tutorials\/SDL\/52_hello_mobile\/android_windows\/index.php<\/a><br \/>\n<a href=\"https:\/\/medium.com\/androiddevelopers\/getting-started-with-c-and-android-native-activities-2213b402ffff\" target=\"_blank\" rel=\"noopener noreferrer\">https:\/\/medium.com\/androiddevelopers\/getting-started-with-c-and-android-native-activities-2213b402ffff<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u3053\u306e\u6295\u7a3f\u3067\u306f\u30013D \u30a8\u30c7\u30a3\u30bf\u306e\u30d7\u30ed\u30c8\u30bf\u30a4\u30d7\u3092\u79fb\u690d\u3057\u305f\u79c1\u306e\u7d4c\u9a13\u306b\u3064\u3044\u3066\u8aac\u660e\u3057\u307e\u3059 \u30ad\u30e5\u30fc\u30d6 \u30a2\u30fc\u30c8 \u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u307e\u305a\u3001\u8d64\u3044 3D \u30ad\u30e5\u30fc\u30d6 \u30ab\u30fc\u30bd\u30eb\u3092\u6301\u3064\u30a8\u30c7\u30a3\u30bf\u304c\u30a8\u30df\u30e5\u30ec\u30fc\u30bf\u3067\u5b9f\u884c\u3055\u308c\u3066\u3044\u308b\u7d50\u679c\u3092\u898b\u3066\u307f\u307e\u3057\u3087\u3046\u3002 \u7d44\u307f\u7acb\u3066\u3092\u6210\u529f\u3055\u305b\u308b\u306b\u306f\u3001\u6b21\u306e\u3053\u3068\u3092\u884c\u3046\u5fc5\u8981\u304c\u3042\u308a\u307e\u3057\u305f: \u6700\u65b0\u306e Android SDK \u3068 NDK \u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u307e\u3059\uff08NDK \u30d0\u30fc\u30b8\u30e7\u30f3\u306f\u65b0\u3057\u3044\u307b\u3069\u826f\u3044\u3067\u3059\uff09 SDL2 \u30bd\u30fc\u30b9 \u30b3\u30fc\u30c9\u3092\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u3057\u3001\u305d\u3053\u304b\u3089\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8\u3092\u53d6\u5f97\u3057\u3066 Android \u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3092\u69cb\u7bc9\u3057\u307e\u3059\u3002 SDL \u30a4\u30e1\u30fc\u30b8\u3001SDL \u30df\u30ad\u30b5\u30fc\u3092\u30a2\u30bb\u30f3\u30d6\u30ea\u306b\u8ffd\u52a0\u3057\u307e\u3059\u3002 \u30b2\u30fc\u30e0 \u30a8\u30f3\u30b8\u30f3\u3068\u30c4\u30fc\u30eb\u30ad\u30c3\u30c8\u306e\u30e9\u30a4\u30d6\u30e9\u30ea\u3001\u305d\u308c\u3089\u306e\u4f9d\u5b58\u95a2\u4fc2 (GLM\u3001\u30e2\u30c0\u30f3 C++ \u7528\u306e JSON) \u3092\u8ffd\u52a0\u3057\u307e\u3059 \u30a2\u30bb\u30f3\u30d6\u30ea \u30d5\u30a1\u30a4\u30eb\u3092 Gradle \u306b\u9069\u5408\u3055\u305b\u308b\u3002 Android \u3068\u306e\u4e92\u63db\u6027\u306e\u305f\u3081\u306b C++ \u30b3\u30fc\u30c9\u3092\u8abf\u6574\u3057\u3001\u5f71\u97ff\u3092\u53d7\u3051\u308b\u30d7\u30e9\u30c3\u30c8\u30d5\u30a9\u30fc\u30e0\u4f9d\u5b58\u30b3\u30f3\u30dd\u30fc\u30cd\u30f3\u30c8\uff08OpenGL ES\u3001\u30b0\u30e9\u30d5\u30a3\u30c3\u30af\u30b9 \u30b3\u30f3\u30c6\u30ad\u30b9\u30c8\u306e\u521d\u671f\u5316\uff09\u3092\u5909\u66f4\u3059\u308b \u30a8\u30df\u30e5\u30ec\u30fc\u30bf\u4e0a\u3067\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u3092\u30d3\u30eb\u30c9\u3057\u3066\u30c6\u30b9\u30c8\u3057\u307e\u3059\u3002 \u30d7\u30ed\u30b8\u30a7\u30af\u30c8 \u30c6\u30f3\u30d7\u30ec\u30fc\u30c8 \u30bd\u30fc\u30b9 SDL\u3001SDL \u30a4\u30e1\u30fc\u30b8\u3001SDL \u30df\u30ad\u30b5\u30fc\u306e\u8aad\u307f\u8fbc\u307f:https:\/\/www.libsdl.org\/download-2.0.php docs \u30d5\u30a9\u30eb\u30c0\u30fc\u306b\u306f\u3001Android \u30d7\u30ed\u30b8\u30a7\u30af\u30c8 \u30c6\u30f3\u30d7\u30ec\u30fc\u30c8\u3092\u4f7f\u7528\u3059\u308b\u305f\u3081\u306e\u8a73\u7d30\u306a\u624b\u9806\u304c\u542b\u307e\u308c\u3066\u3044\u307e\u3059\u3002 android-project \u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u3092\u5225\u306e\u30d5\u30a9\u30eb\u30c0\u30fc\u306b\u30b3\u30d4\u30fc\u3059\u308b\u304b\u3001\u30b7\u30f3\u30dc\u30ea\u30c3\u30af\u30ea\u30f3\u30af\u3092\u4f5c\u6210\u3059\u308b\u304b\u3001SDL \u30d5\u30a9\u30eb\u30c0\u30fc\u3092<a class=\"more-link\" href=\"https:\/\/demensdeum.com\/blog\/ja\/2020\/01\/12\/porting-cpp-sdl-app-on-android\/\">Continue reading <span class=\"screen-reader-text\">&#8220;C++ SDL \u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u306e Android \u3078\u306e\u79fb\u690d&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[61,52],"tags":[37,124,145,146,77,147,148],"class_list":["post-2502","post","type-post","status-publish","format-standard","hentry","category-techie","category-tutorials","tag-android","tag-c","tag-cpp","tag-opengl-es","tag-sdl","tag-sdl-image","tag-sdl-mixer","entry"],"translation":{"provider":"WPGlobus","version":"3.0.2","language":"ja","enabled_languages":["en","ru","zh","de","fr","ja","pt","hi"],"languages":{"en":{"title":true,"content":true,"excerpt":false},"ru":{"title":true,"content":true,"excerpt":false},"zh":{"title":true,"content":true,"excerpt":false},"de":{"title":true,"content":true,"excerpt":false},"fr":{"title":true,"content":true,"excerpt":false},"ja":{"title":true,"content":true,"excerpt":false},"pt":{"title":true,"content":true,"excerpt":false},"hi":{"title":false,"content":false,"excerpt":false}}},"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/demensdeum.com\/blog\/ja\/wp-json\/wp\/v2\/posts\/2502","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/demensdeum.com\/blog\/ja\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/demensdeum.com\/blog\/ja\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/demensdeum.com\/blog\/ja\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/demensdeum.com\/blog\/ja\/wp-json\/wp\/v2\/comments?post=2502"}],"version-history":[{"count":31,"href":"https:\/\/demensdeum.com\/blog\/ja\/wp-json\/wp\/v2\/posts\/2502\/revisions"}],"predecessor-version":[{"id":3923,"href":"https:\/\/demensdeum.com\/blog\/ja\/wp-json\/wp\/v2\/posts\/2502\/revisions\/3923"}],"wp:attachment":[{"href":"https:\/\/demensdeum.com\/blog\/ja\/wp-json\/wp\/v2\/media?parent=2502"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/demensdeum.com\/blog\/ja\/wp-json\/wp\/v2\/categories?post=2502"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/demensdeum.com\/blog\/ja\/wp-json\/wp\/v2\/tags?post=2502"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}