{"id":55442,"date":"2020-01-21T00:00:00","date_gmt":"2020-01-20T21:00:00","guid":{"rendered":"https:\/\/prohoster.info\/blog\/blog_prohoster\/podgotovka-sdl2-proekta-dlya-zapuska-na-android"},"modified":"2020-02-18T14:03:33","modified_gmt":"2020-02-18T11:03:33","slug":"podgotovka-sdl2-proekta-dlya-zapuska-na-android","status":"publish","type":"post","link":"https:\/\/prohoster.info\/sq\/blog\/administrirovanie\/podgotovka-sdl2-proekta-dlya-zapuska-na-android","title":{"rendered":"P\u00ebrgatitja e projektit SDL2 p\u00ebr ekzekutimin n\u00eb android","gt_translate_keys":[{"key":"rendered","format":"text"}]},"content":{"rendered":"<p>P\u00ebrsh\u00ebndetje t\u00eb gjith\u00ebve. Sot do t\u00eb shohim se si t\u00eb p\u00ebrgatisim nj\u00eb projekt duke p\u00ebrdorur bibliotek\u00ebn sdl2 p\u00ebr t\u00eb nisur nj\u00eb loj\u00eb n\u00eb android.<br \/>\n<noindex><a rel=\"nofollow\" name=\"habracut\"><\/a><\/noindex><br \/>\nFillimisht, duhet t\u00eb shkarkoni Android Studio, ta instaloni at\u00eb dhe gjith\u00e7ka q\u00eb k\u00ebrkohet n\u00eb k\u00ebt\u00eb mjedis p\u00ebr zhvillim. P\u00ebr shembull, tani kam Kde Neon, dhe n\u00eb k\u00ebt\u00eb sistem ekziston nj\u00eb skedar \/etc\/environment, nj\u00eb skedar i till\u00eb ka edhe ubuntu. Atje duhet t\u00eb regjistrohen k\u00ebto variabla.<\/p>\n<pre><code class=\"plaintext\">ANDROID_HOME=\/home\/username\/Android\/Sdk\nANDROID_NDK_HOME=\/home\/username\/ndk\n<\/code><\/pre>\n<p>\nGjithashtu, duhet t\u00eb shkarkoni NDK nga faqja zyrtare, ta shpaketoni n\u00eb katalogun tuaj t\u00eb sht\u00ebpis\u00eb dhe ta rinomini n\u00eb NDK. M\u00eb pas duhet t\u00eb shkarkoni bibliotek\u00ebn SDL2 nga faqja <noindex><a rel=\"nofollow\" href=\"https:\/\/www.libsdl.org\/\">libsdl.org<\/a><\/noindex>. P\u00ebr t\u00eb p\u00ebrdorur sdl2 p\u00ebr android, \u00ebsht\u00eb e r\u00ebnd\u00ebsishme t\u00eb mos e kompilohet p\u00ebr kompjuterin, sepse at\u00ebher\u00eb nuk do t\u00eb kompilohet p\u00ebr android. P\u00ebr t'u kompileuar, duhet t\u00eb krijoni nj\u00eb projekt n\u00eb android studio, ndonj\u00eb, p\u00ebr t\u00eb pranuar licenc\u00ebn, p\u00ebrndryshe gjat\u00eb nd\u00ebrtimit SDL2 do t\u00eb k\u00ebrkoj\u00eb licenc\u00ebn.<\/p>\n<p>P\u00ebr t\u00eb lexuar skedar\u00ebt n\u00eb android nga assets, duhet t\u00eb p\u00ebrdorni funksionet SDL_RWops. K\u00ebtu \u00ebsht\u00eb nj\u00eb shembull p\u00ebrdorimi n\u00eb kodin q\u00eb punon me shkrimin. N\u00eb k\u00ebt\u00eb rast ne nuk mund t\u00eb p\u00ebrdorim FT_New_Face, dhe n\u00eb vend t\u00eb saj do t\u00eb p\u00ebrdorim FT_New_Memory_Face, p\u00ebr t\u00eb p\u00ebrdorur t\u00eb dh\u00ebnat tashm\u00eb t\u00eb lexuara.<\/p>\n<pre><code class=\"cpp\">#ifdef __ANDROID__\n        snprintf ( path, 254, &quot;fonts\/%s&quot;, file );\n        SDL_RWops *rw = SDL_RWFromFile(path, &quot;r&quot; );\n        char *memory = ( char * ) calloc ( rw-&gt;hidden.androidio.size, 1 );\n        SDL_RWread(rw, memory, 1, rw-&gt;hidden.androidio.size );\n\n        FT_New_Memory_Face(*this-&gt;ft_library, ( const FT_Byte  * )memory, rw-&gt;hidden.androidio.size, 0, &this;-&gt;face );\n        SDL_RWclose(rw);\n        free ( memory );\n#else\n        snprintf ( path, 254, &quot;%s\/fonts\/%s&quot;, DEFAULT_ASSETS, file );\n        if ( access ( path, F_OK ) ) {\n                fprintf ( stderr, &quot;not found font: %sn&quot;, path );\n                exit ( EXIT_FAILURE );\n        }\n        struct stat st;\n        stat ( path, &st; );\n        FILE *rw = fopen ( path, &quot;r&quot; );\n        char *memory = ( char * ) calloc ( st.st_size, 1 );\n        fread ( memory, 1, st.st_size, rw );\n\n        FT_New_Memory_Face ( *this-&gt;ft_library, ( const FT_Byte * ) memory, st.st_size, 0, &this;-&gt;face );\n        fclose ( rw );\n        free ( memory );\n#endif\n\n<\/code><\/pre>\n<p>\nGjithashtu, krijova nj\u00eb sked\u00eb titulli p\u00ebr t\u00eb lidhur titujt e SDL2. NO_SDL_GLEXT \u00ebsht\u00eb i nevojsh\u00ebm p\u00ebr t\u00eb siguruar q\u00eb kompilatorja t\u00eb kaloj\u00eb me sukses p\u00ebr Android.<\/p>\n<pre><code class=\"cpp\">#ifdef __ANDROID__\n#include &quot;SDL.h&quot;\n#include &quot;SDL_video.h&quot;\n#include &quot;SDL_events.h&quot;\n#define NO_SDL_GLEXT \n#include &quot;SDL_opengl.h&quot;\n#include &quot;SDL_opengles2.h&quot;\n#else\n#include &lt;SDL2\/SDL.h&gt;\n#include &lt;SDL2\/SDL_video.h&gt;\n#include &lt;SDL2\/SDL_opengl.h&gt;\n#include &lt;SDL2\/SDL_opengles2.h&gt;\n#endif\n<\/code><\/pre>\n<p>\nPra, projekti \u00ebsht\u00eb gati, shader\u00ebt jan\u00eb gati p\u00ebr OpenGL ES 3.0. Tani duhet t\u00eb krijoni android-project. P\u00ebr k\u00ebt\u00eb, shpaketoni arkivin SDL2. Shkoni n\u00eb build-scripts. Dhe ekzekutoni k\u00ebshtu.<\/p>\n<pre><code class=\"bash\">.\/androidbuild.sh com.xverizex.test main.cpp\n<\/code><\/pre>\n<p>\nDo t\u00eb shfaqet nj\u00eb mesazh i till\u00eb.<\/p>\n<pre><code class=\"bash\">P\u00ebr t\u00eb nd\u00ebrtuar dhe instaluar n\u00eb nj\u00eb pajisje p\u00ebr testim, ekzekutoni t\u00eb following:\ncd \/home\/cf\/programs\/SDL2-2.0.10\/build\/com.xverizex.test\n.\/gradlew installDebug\n<\/code><\/pre>\n<p>\nShkoni n\u00eb com.xverizex.test. Shkoni n\u00eb com.xverizex.test\/app\/jni\/src. Kopjoni projektin tuaj t\u00eb loj\u00ebs. Dhe ndryshoni skedarin Android.mk, n\u00eb rastin tim duket k\u00ebshtu.<\/p>\n<pre><code class=\"cpp\">LOCAL_PATH := $(call my-dir)\n\ninclude $(CLEAR_VARS)\n\nLOCAL_MODULE := main\n\nSDL_PATH := ..\/SDL\nFREETYPE_PATH := ..\/Freetype2\n\nLOCAL_C_INCLUDES := $(LOCAL_PATH)\/$(SDL_PATH)\/include $(LOCAL_PATH)\/$(FREETYPE_PATH)\/include\n\n# Shtoni skedar\u00ebt tuaj t\u00eb burimeve t\u00eb aplikacionit k\u00ebtu...\nLOCAL_SRC_FILES := .\/engine\/lang.cpp .\/engine\/actor.cpp .\/engine\/sprite.cpp .\/engine\/shaders.cpp .\/engine\/box.cpp .\/engine\/menubox.cpp .\/engine\/load_manager.cpp .\/engine\/main.cpp .\/engine\/font.cpp .\/engine\/model.cpp .\/engine\/button.cpp .\/theme.cpp .\/level_manager.cpp .\/menu\/menu.cpp\n\nLOCAL_SHARED_LIBRARIES := SDL2 Freetype2\n\nLOCAL_LDLIBS := -lGLESv1_CM -lGLESv2 -llog \n\ninclude $(BUILD_SHARED_LIBRARY)\n<\/code><\/pre>\n<p>\nSi\u00e7 mund ta keni v\u00ebn\u00eb re, po lidh edhe bibliotek\u00ebn Freetype2. E kam gjetur tashm\u00eb t\u00eb gatshme n\u00eb github p\u00ebr android, por ajo nuk punonte, nevojitej t\u00eb ndryshohej disa gj\u00ebra. Gjithashtu krijoni katalogun app\/src\/main\/assets. N\u00eb t\u00eb vendosni burimet tona (fontet, sprite-t, modelet 3D).<\/p>\n<p>Tani, do t\u00eb konfiguroni Freetype2 p\u00ebr Android. Shkarkoni nga github-i im <noindex><a rel=\"nofollow\" href=\"https:\/\/github.com\/xverizex\/Android-Freetype2\">Link<\/a><\/noindex>, dhe kopjoni katalogun Freetype2 n\u00eb katalogun app\/jni\/. T\u00eb gjitha jan\u00eb gati. Tani ekzekutoni komand\u00ebn ..\/gradlew installDebug n\u00eb com.xverizex.test. Q\u00eb t\u00eb mund t\u00eb shtoni k\u00ebt\u00eb loj\u00eb n\u00eb android, duhet t\u00eb aktivizohet debugging n\u00eb android. P\u00ebr k\u00ebt\u00eb, shkoni te cil\u00ebsimet, pastaj te 'Sistemi', pastaj te 'P\u00ebr tabletin' dhe klikoni rreth gjasht\u00eb her\u00eb opsionin 'Numri i nd\u00ebrtimit'. Pastaj kthehuni prapa dhe do t\u00eb shfaqet opsioni p\u00ebr zhvilluesit. Hyni dhe aktivizoni, gjithashtu aktivizoni opsionin 'Debugging me USB'. Tani duhet t\u00eb merrni \u00e7el\u00ebsin p\u00ebr tabletin. P\u00ebr k\u00ebt\u00eb, shkarkoni programin adb. Ekzekutoni n\u00eb konsol\u00eb adb shell, dhe n\u00eb tablet do t\u00eb shfaqet \u00e7el\u00ebsi q\u00eb duhet ta pranoni. T\u00eb gjitha, tani mund t\u00eb shkarkoni loj\u00ebra n\u00eb tablet.<br \/>\n<br \/>Burimi: <a content=\"nofollow\" rel=\"nofollow\" href=\"https:\/\/habr.com\/ru\/post\/484526\/\">habr.com<\/a><\/p>","protected":false,"gt_translate_keys":[{"key":"rendered","format":"html"}]},"excerpt":{"rendered":"<p>\u0412\u0441\u0435\u043c \u043f\u0440\u0438\u0432\u0435\u0442. \u0421\u0435\u0433\u043e\u0434\u043d\u044f \u043c\u044b \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043a\u0430\u043a \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u0438\u0442\u044c \u043f\u0440\u043e\u0435\u043a\u0442 \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 sdl2 \u0434\u043b\u044f \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u0438\u0433\u0440\u044b \u043d\u0430 android. \u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u043d\u0430\u0434\u043e \u0441\u043a\u0430\u0447\u0430\u0442\u044c Android Studio, \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u0435\u0451 \u0438 \u0432\u0441\u0451 \u0447\u0442\u043e \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u0432 \u044d\u0442\u043e\u0439 \u0441\u0440\u0435\u0434\u0435 \u0434\u043b\u044f \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 \u0443 \u043c\u0435\u043d\u044f \u0441\u0435\u0439\u0447\u0430\u0441 Kde Neon, \u0438 \u0432 \u044d\u0442\u043e\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 \u0444\u0430\u0439\u043b \/etc\/environment, \u0442\u0430\u043a\u043e\u0439 \u0436\u0435 \u0444\u0430\u0439\u043b \u0435\u0441\u0442\u044c \u0438 \u0432 ubuntu. \u0422\u0430\u043c [&hellip;]<\/p>\n","protected":false,"gt_translate_keys":[{"key":"rendered","format":"html"}]},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[688],"tags":[],"class_list":["post-55442","post","type-post","status-publish","format-standard","hentry","category-administrirovanie"],"aioseo_notices":[],"aioseo_head":"\n\t\t<!-- All in One SEO 5.0.2 - aioseo.com -->\n\t<meta name=\"description\" content=\"\u0412\u0441\u0435\u043c \u043f\u0440\u0438\u0432\u0435\u0442.\" \/>\n\t<meta name=\"robots\" content=\"max-image-preview:large\" \/>\n\t<meta name=\"author\" content=\"Yuri Gagarin\"\/>\n\t<link rel=\"canonical\" href=\"https:\/\/prohoster.info\/sq\/blog\/administrirovanie\/podgotovka-sdl2-proekta-dlya-zapuska-na-android\" \/>\n\t<meta name=\"generator\" content=\"All in One SEO (AIOSEO) 5.0.2\" \/>\n\t\t<meta property=\"og:locale\" content=\"sq_AL\" \/>\n\t\t<meta property=\"og:site_name\" content=\"ProHoster | \u041a\u0443\u043f\u0438\u0442\u044c \u043d\u0430\u0434\u0435\u0436\u043d\u044b\u0439 \u0445\u043e\u0441\u0442\u0438\u043d\u0433 \u0434\u043b\u044f \u0441\u0430\u0439\u0442\u043e\u0432 \u0441 \u0437\u0430\u0449\u0438\u0442\u043e\u0439 \u043e\u0442 DDoS, VPS VDS \u0441\u0435\u0440\u0432\u0435\u0440\u044b\" \/>\n\t\t<meta property=\"og:type\" content=\"article\" \/>\n\t\t<meta property=\"og:title\" content=\"\ud83e\udd47\u041f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043a\u0430 SDL2-\u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u0434\u043b\u044f \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u043d\u0430 android | ProHoster\" \/>\n\t\t<meta property=\"og:description\" content=\"\u0412\u0441\u0435\u043c \u043f\u0440\u0438\u0432\u0435\u0442.\" \/>\n\t\t<meta property=\"og:url\" content=\"https:\/\/prohoster.info\/sq\/blog\/administrirovanie\/podgotovka-sdl2-proekta-dlya-zapuska-na-android\" \/>\n\t\t<meta property=\"og:image\" content=\"https:\/\/prohoster.info\/wp-content\/uploads\/2021\/11\/logo-350.jpg\" \/>\n\t\t<meta property=\"og:image:secure_url\" content=\"https:\/\/prohoster.info\/wp-content\/uploads\/2021\/11\/logo-350.jpg\" \/>\n\t\t<meta property=\"og:image:width\" content=\"350\" \/>\n\t\t<meta property=\"og:image:height\" content=\"350\" \/>\n\t\t<meta property=\"article:published_time\" content=\"2020-01-20T21:00:00+00:00\" \/>\n\t\t<meta property=\"article:modified_time\" content=\"2020-02-18T11:03:33+00:00\" \/>\n\t\t<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/prohoster\" \/>\n\t\t<meta property=\"article:author\" content=\"https:\/\/www.facebook.com\/prohoster\" \/>\n\t\t<!-- All in One SEO -->\n\n","aioseo_head_json":{"title":"\ud83e\udd47P\u00ebrgatitja e projektit SDL2 p\u00ebr ekzekutimin n\u00eb android | ProHoster","description":"P\u00ebrsh\u00ebndetje t\u00eb gjith\u00ebve.","canonical_url":"https:\/\/prohoster.info\/sq\/blog\/administrirovanie\/podgotovka-sdl2-proekta-dlya-zapuska-na-android","robots":"max-image-preview:large","keywords":"","webmasterTools":{"miscellaneous":""},"schema":null,"og:locale":"sq_AL","og:site_name":"ProHoster | \u041a\u0443\u043f\u0438\u0442\u044c \u043d\u0430\u0434\u0435\u0436\u043d\u044b\u0439 \u0445\u043e\u0441\u0442\u0438\u043d\u0433 \u0434\u043b\u044f \u0441\u0430\u0439\u0442\u043e\u0432 \u0441 \u0437\u0430\u0449\u0438\u0442\u043e\u0439 \u043e\u0442 DDoS, VPS VDS \u0441\u0435\u0440\u0432\u0435\u0440\u044b","og:type":"article","og:title":"\ud83e\udd47\u041f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043a\u0430 SDL2-\u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u0434\u043b\u044f \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u043d\u0430 android | ProHoster","og:description":"\u0412\u0441\u0435\u043c \u043f\u0440\u0438\u0432\u0435\u0442.","og:url":"https:\/\/prohoster.info\/sq\/blog\/administrirovanie\/podgotovka-sdl2-proekta-dlya-zapuska-na-android","og:image":"https:\/\/prohoster.info\/wp-content\/uploads\/2021\/11\/logo-350.jpg","og:image:secure_url":"https:\/\/prohoster.info\/wp-content\/uploads\/2021\/11\/logo-350.jpg","og:image:width":350,"og:image:height":350,"article:published_time":"2020-01-20T21:00:00+00:00","article:modified_time":"2020-02-18T11:03:33+00:00","article:publisher":"https:\/\/www.facebook.com\/prohoster","article:author":"https:\/\/www.facebook.com\/prohoster"},"aioseo_meta_data":{"post_id":"55442","title":null,"description":null,"keywords":null,"keyphrases":null,"primary_term":null,"canonical_url":null,"og_title":null,"og_description":null,"og_object_type":"default","og_image_type":"default","og_image_url":null,"og_image_width":null,"og_image_height":null,"og_image_custom_url":null,"og_image_custom_fields":null,"og_video":null,"og_custom_url":null,"og_article_section":null,"og_article_tags":null,"twitter_use_og":false,"twitter_card":"default","twitter_image_type":"default","twitter_image_url":null,"twitter_image_custom_url":null,"twitter_image_custom_fields":null,"twitter_title":null,"twitter_description":null,"schema":{"blockGraphs":[],"customGraphs":[],"default":{"data":{"Article":[],"Course":[],"Dataset":[],"FAQPage":[],"Movie":[],"Person":[],"Product":[],"ProductReview":[],"Car":[],"Recipe":[],"Service":[],"SoftwareApplication":[],"WebPage":[]},"graphName":"","isEnabled":true},"graphs":[]},"schema_type":null,"schema_type_options":null,"pillar_content":false,"robots_default":true,"robots_noindex":false,"robots_noarchive":false,"robots_nosnippet":false,"robots_nofollow":false,"robots_noimageindex":false,"robots_noodp":false,"robots_notranslate":false,"robots_max_snippet":null,"robots_max_videopreview":null,"robots_max_imagepreview":"large","priority":null,"frequency":null,"local_seo":null,"seo_analyzer_scan_date":null,"breadcrumb_settings":null,"limit_modified_date":false,"reviewed_by":null,"ai":null,"created":"2021-02-28 19:44:25","updated":"2022-10-04 17:24:27","focus_keyword":null,"additional_keywords":null,"truseo_locale":null},"gt_translate_keys":[{"key":"link","format":"url"}],"_links":{"self":[{"href":"https:\/\/prohoster.info\/sq\/wp-json\/wp\/v2\/posts\/55442","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/prohoster.info\/sq\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/prohoster.info\/sq\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/prohoster.info\/sq\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/prohoster.info\/sq\/wp-json\/wp\/v2\/comments?post=55442"}],"version-history":[{"count":0,"href":"https:\/\/prohoster.info\/sq\/wp-json\/wp\/v2\/posts\/55442\/revisions"}],"wp:attachment":[{"href":"https:\/\/prohoster.info\/sq\/wp-json\/wp\/v2\/media?parent=55442"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/prohoster.info\/sq\/wp-json\/wp\/v2\/categories?post=55442"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/prohoster.info\/sq\/wp-json\/wp\/v2\/tags?post=55442"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}