"COCOS2D-X"에 해당되는 글 - 4건
Post
android 가로모드에서 세로로 변경
android 프로젝트를 키고 app폴더에서 AndroidManifest.xml 파일 열기
android 앱 아이콘 변경
하려고했는데...아어...나 바보같이 GRADLE 업그레이드했다ㅠㅠㅠ
아무튼
build.gradle에서 dependencies { classpath 를 변경해주니까 해결!!
gradle 다운 그레이드 쉽다!
아무튼 이제 진짜 아이콘 변경!!!
왼쪽창 Android 모드에서 app>>res>>폴더에 가면 mipmap-hdpi, mipmap-mdpi 등....
각각 화소에 맞는 아이콘이 있다. png 이미지를 원하는대로 바꿔주면 된다.
프로젝트 이름 변경
한글 글자 깨짐
cocos2dx는 한글 출력하는 것도 어렵다.
윈도우 빌드는 잘되었는데 앱 빌드 후 apk 실행 시 한글이 와장창 깨진다 ㅠㅠ
검색해보니 나처럼 한글 출력이 잘 안되는 경우가 많았다.
일단 좀 특이한 한글 폰트를 사용하고 있어서 네이버 나눔 고딕으로 변경해봤는데 안됨!!!
그 후 검색으로....
https://cafe.naver.com/cocos2dxusers/26663
char testString[30];
WideCharToMultiByte(CP_UTF8, 0, L"테스트 테스트", -1, testString , 30, NULL, NULL);
auto label = Label::createWithTTF(MyString, "fonts/fontname.ttf". 24);
를 하면된다고 했는데 android 앱 빌드시 에러.
illegal character encoding in string literal
아마 WideCharToMultiByte 이라는게 윈도우 함수여서 앱 빌드에서는 그게 안되는거 같다. 찾아보니까 android에서는 utf 관련 변환이 자동적으로 안된다고 하는것 같기도 하고...?
그렇게 더 찾아보다가
페이지 인코딩을 바꿔주라고 적혀 있었다.
VS2017 파일생성 인코딩 UTF-8 기본값으로 설정하기
이글을 작성하게된 계기는 VS2017에서 clang 컴파일러 사용시 error : illegal character encoding in string literal 오류를 경험하시는분들에게 해결책이 되지않을까 싶어서 올려봅니다 저같이 15시간정도 고통
grr1.tistory.com
https://m.blog.naver.com/raveneer/221755491661
그러고보니 예전에 한글 출력안되어서 페이지 인코딩 바꾸었는뎅...
새 프로젝트 만들어서 그런지 페이지 인코딩이 한국어다.
notepad로 cpp 한글 나오는 파일만 utf-8 bom으로 바꾸었다.(노가다ㅠ)
아무튼 그렇게 하고 빌드하니까 잘된다!!
android 앱 이름 변경
projectname\proj.android\app\res\values
폴더에서 strings.xml 을 연 다음에 프로젝트 이름을 변경해주면 된다.
'이전게시판 > cocos-2d' 카테고리의 다른 글
cocos2dx app keytool keystore 서명 (0) | 2025.01.04 |
---|---|
Cococs2dx build Failed (CMakeLists.txt 수정) (0) | 2025.01.03 |
Cocos2dx Change Scene 화면전환 예제 (0) | 2025.01.02 |
Cocos2d NULL 아니라 nullptr (0) | 2024.10.30 |
Cocos2dx 소멸자 CCLog 에러 (0) | 2024.10.30 |
Cocos2d Director::getInstance()->getVisibleSize(); (0) | 2024.10.07 |
cocos2d-x android 빌드방법 (0) | 2024.09.25 |
cocos2d-x apk 빌드 성공!!!!(+Failed to read key AndroidDebugKey from store 에러) (0) | 2024.02.29 |
Post
Cococs2dx build Failed (CMakeLists.txt 수정)
오랜만에 빌드했는데 에러가 났다
Build MyGame armeabi-v7a
externalNativeBuildDebug: Executable : C:\Users\user\AppData\Local\Android\Sdk\cmake\3.6.4111459\bin\cmake.exe
arguments :
--build
H:\CocosProject\project\proj.android\app\.externalNativeBuild\cmake\debug\armeabi-v7a
--target
MyGame
jvmArgs :
Executable : C:\Users\user\AppData\Local\Android\Sdk\cmake\3.6.4111459\bin\cmake.exe
arguments :
--build
H:\CocosProject\project\proj.android\app\.externalNativeBuild\cmake\debug\armeabi-v7a
--target
MyGame
jvmArgs :
:project:externalNativeBuildDebug (Thread[Task worker for ':',5,main]) completed. Took 3.45 secs.
FAILURE: Build failed with an exception.
clang++.exe: error: linker command failed with exit code 1 (use -v to see invocation)
ninja: build stopped: subcommand failed.
BUILD FAILED in 4s
41 actionable tasks: 1 executed, 40 up-to-date
VCS Checkout Cache (proj.android\.gradle\vcsWorkingDirs) has not been cleaned up in 0 days
Error running command, return code: 1.
일단 블로그에서 안드로이드 세팅했던기억이 있어서 이거보구있음
https://m.blog.naver.com/karlose7/221484046370
[Cocos2d-x] 안드로이드 스튜디오 포팅에 관하여
안녕하세요, 마그입니다. "Cocos2d-x"엔진 게시글을 첫 글로 저를 굉장히 괴롭혔던 "안드...
blog.naver.com
그러다가 가장중요한거!!
프로젝트 폴더 바로 안에 CMakeLists.txt 파일
# add cross-platforms source files and header files
list(APPEND GAME_SOURCE
소스코드에 내가 만든 소스코드 전부 넣어줘야하는거 깜빡함!!
헤더 cpp 각자 소스 코드 이름 넣어줘야함
이 방법이 번거롭다면 재귀로 불러오는 방법이 있다고한다
https://blog.naver.com/njh0602/221507313152)
[Cocos2d-x 3.x] 안드로이드 빌드 설정 시 CMakeLists.txt에 빌드할 소스 한 번에 추가하기
현재 cocos2d-x 측에서 안드로이드 스튜디오를 통한 C++ 소스 빌드를 하기 위한 방법으로 ndk +...
blog.naver.com
다음과 같은 형태로 사용하라고 하심
file (GLOB_RECURSE MY_SOURCES Classes/*.cpp)
file (GLOB_RECURSE MY_SOURCES Classes/*.h)
list(APPEND GAME_SOURCE ${MY_SOURCES})
list(APPEND GAME_HEADER $MY_HEADERS})
파일 많아지면 시도해보는걸로!!
H:\CocosProject\project\bin\debug\android 폴더 안에 apk 빌드 확인!
(그런데 안드로이드 서명은 어떻게 하는거지???? 나 android studio는 전혀 사용안하는데...옛날에 서명했던거 같은데 다 까먹었다 ㅠㅠ)
'이전게시판 > cocos-2d' 카테고리의 다른 글
cocos2dx app keytool keystore 서명 (0) | 2025.01.04 |
---|---|
cocos2dx android 한글 깨짐, 화면 세로로 변경, 앱 아이콘 변경, 앱 이름 변경 (0) | 2025.01.03 |
Cocos2dx Change Scene 화면전환 예제 (0) | 2025.01.02 |
Cocos2d NULL 아니라 nullptr (0) | 2024.10.30 |
Cocos2dx 소멸자 CCLog 에러 (0) | 2024.10.30 |
Cocos2d Director::getInstance()->getVisibleSize(); (0) | 2024.10.07 |
cocos2d-x android 빌드방법 (0) | 2024.09.25 |
cocos2d-x apk 빌드 성공!!!!(+Failed to read key AndroidDebugKey from store 에러) (0) | 2024.02.29 |
Post
cocos2d-x apk 빌드 성공!!!!(+Failed to read key AndroidDebugKey from store 에러)
[ 이전게시판/cocos-2d ] 2024. 2. 29. 19:54이전 포스팅에 이어서 또 새로운 에러 발발...
에러를 고치면?
새로운 에러가 나타나지.
짤빵생각나ㅠㅠㅋㅋㅋㅋㅋㅋㅋ
> Task :test4:packageDebug FAILED
Task ':test4:packageDebug' is not up-to-date because:
No history is available.
All input files are considered out-of-date for incremental task ':test4:packageDebug'.
Unable do incremental execution: full task run
:test4:packageDebug (Thread[Task worker for ':' Thread 11,5,main]) completed. Took 0.015 secs.
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':test4:packageDebug'.
> com.android.ide.common.signing.KeytoolException: Failed to read key AndroidDebugKey from store "C:\Users\user\.android\debug.keystore": Invalid keystore format
* Try:
Run with --stacktrace option to get the stack trace. Run with --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 2m 15s
55 actionable tasks: 55 executed
VCS Checkout Cache (H:\CocosProject\test4\proj.android\.gradle\vcsWorkingDirs) has not been cleaned up in 0 days
Error running command, return code: 1.
H:\CocosProject\test4\proj.android>
Failed to read key AndroidDebugKey from store 가 문제인건가?
찾아보니까 keystore삭제하라고 해서
내 local 상 C:\Users\user\.android\debug.keystore를 삭제.
그리고 시도하면 역시나 에러가 나오...
BUILD SUCCESSFUL in 12s
55 actionable tasks: 4 executed, 51 up-to-date
VCS Checkout Cache (H:\CocosProject\test4\proj.android\.gradle\vcsWorkingDirs) has not been cleaned up in 0 days
Move apk to H:\CocosProject\test4\bin\debug\android
Build succeed.
어???
apk 빌드 성공???헐???
H:\CocosProject\test4\bin\debug\android
에서 debug 모드로 apk 나옴...........
헐...대박..........
일단 내 휴대폰에 넣어보기 ㄱㄱㄱ
근데 내 앱이 서명이 없다고 안전하지 않다고 설치 자체가 안됨...ㄷㄷ...
하지만 자세히를 눌러서 무시하고 설치하면된다!!
아무튼 우여곡절 끝에 apk 설치 완료! 휴대폰에서 Helloworld보고 마무리했당 ㅎㅎㅎ
앞으로 해야할 건 아래와 같다.
- 게임 만들기(넘나 당연한 것)
- apk 서명하는법
- 애드몹 다는 거 찾아보기
- 게임 애널리스트 찾아보기
- 마케팅 관련해서 찾아보기
할 거 많다ㅏㅏㅏㅏ
'이전게시판 > cocos-2d' 카테고리의 다른 글
Cocos2d NULL 아니라 nullptr (0) | 2024.10.30 |
---|---|
Cocos2dx 소멸자 CCLog 에러 (0) | 2024.10.30 |
Cocos2d Director::getInstance()->getVisibleSize(); (0) | 2024.10.07 |
cocos2d-x android 빌드방법 (0) | 2024.09.25 |
cocos2d apk 빌드 NDK not configured 에러 (0) | 2024.02.29 |
Android cocos2d-x 빌드 에러 Gradle DSL method not found: 'ndkVersion()' (0) | 2024.02.29 |
c++ 알 수 없는 재정의 지정자입니다 (0) | 2024.02.24 |
cocos2dx bool onTouchBegan(Touch* touch, Event* unused_event); 오버로드 된 멤버함수가 없습니다 (0) | 2024.02.24 |
Post
cocos2d github에서 cpp-tests 폴더 안에 있는 샘플들은 공부하는데 꽤나 유용해보였다.
그래서 이 샘플 가지고 공부를 하기로 결정!
cocos2d github cpp-tests 프로젝트 빌드 파일 실행하기
cocos2d-x-4\cocos2d-x-4\tests
다운받은 코코스 파일 안에 테스트 파일 있는 거 확인(tests폴더)
그래서 해당 프젝을 옮겨서 cmake로 빌드 파일 만들려고 하니까 에러가 난다.
H:\CocosProject\cpp-tests\build>cmake . -G "Visual Studio 17 2022" -A Win32
-- Selecting Windows SDK version 10.0.22621.0 to target Windows 10.0.19045.
CMake Error at CMakeLists.txt:17 (include):
include could not find requested file:
CocosBuildSet
CMake Error at CMakeLists.txt:18 (add_subdirectory):
add_subdirectory given source "H:/CocosProject/cpp-tests/../../cocos" which
is not an existing directory.
CMake Error at CMakeLists.txt:403 (setup_cocos_app_config):
Unknown CMake command "setup_cocos_app_config".
-- Configuring incomplete, errors occurred!
H:\CocosProject\cpp-tests\build>
관련해서 검색해보니까 같은 이슈 발견
https://github.com/cocos2d/cocos2d-x/issues/18696
Missing Cmake references · Issue #18696 · cocos2d/cocos2d-x
Hi! I'm trying to build a cocos2d-x3.17 project on Ubuntu 16.04. What I did: > git clone --recursive https://github.com/cocos2d/cocos2d-x. > cd cocos2d- > python download-deps. > git submodule upda...
github.com
Modules 에 있는 CocosBuildSet.cmake를 복사하라고 한다.
일단 기본프로젝트는 실행이 잘되어서 기본프젝에서 cocosBuildSet 위치를 검색해봤더니
test(프젝)\cocos2d\cmake\Modules에 존재한다.
\test\cocos2d 폴더를 통째로 cpp-tests 폴더에 복사했다.
근데 안된다. 그래서 빌드되는 프로젝트 CMakeLists.txt 와 안되는 프로젝트 CMakeLists.txt의 차이점을 비교함.
cocosBuildSet를 못찾는 거 보니 둘의 기본 경로가 다른 거 같음.
그리고 역시나 경로가 달랐음.
test프로젝트: set(COCOS2DX_ROOT_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cocos2d)
cpp test 프로젝트: set(COCOS2DX_ROOT_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../..)
그래서 CMakeLists 복사본 만들고 위치를 test프로젝트처럼 수정.
그러니까 sln 프로젝트 파일 만들어짐!!!! 성공 ㅠㅠㅠㅠㅠㅠ
근데 빌드하니까 에러 발생...
그런데 에러들을 보니까...함수 인자 갯수가 맞지 않는다고 하는 걸 보니
이거 설마 최근 함수 적용이 안된건가 싶다;;;끄으응;;;;
이 프로젝트는 그래도 simple sample이 많은 거 같아서 꼭 돌려보고 싶었는데...;;;;
전부 최신화 시켜줘야 돌아가는건가 싶다;; 일단 보니까 빌드 실패해서 exe파일도 bin 폴더에 안만들어져있음.
(수정중)
일단 에러 하나하나 뜯어보기로 했음
에러 목록
1. 'spine/Debug.h'
오류 C1083 포함 파일을 열 수 없습니다. 'spine/Debug.h': No such file or directory
일단 쓰는 곳이 없어서 주석 처리.
Label::createWithBMFont("fonts/geneva-32.fnt", "And this is Geneva", TextHAlignment::LEFT, 0, Rect(0, 128, 0, 0));
일단 createWithBMFont 함수 레퍼런스 찾아봄.
Cocos2d-x: Label Class Reference
Label is a subclass of Node that knows how to render text labels. More... Inherits Node, LabelProtocol, and BlendProtocol. Inherited by TextFieldTTF. virtual void setString (const std::string &text) override Sets the text that this Label is to display.
docs.cocos2d-x.org
static Label* createWithBMFont | ( | const std::string & | bmfontPath, |
const std::string & | text, | ||
const TextHAlignment & | hAlignment = TextHAlignment::LEFT, | ||
int | maxLineWidth = 0, | ||
const Vec2 & | imageOffset = Vec2::ZERO | ||
) |
Allocates and initializes a Label, with a bitmap font file.
Parameters
bmfontPath | A bitmap font file, it's a FNT format. |
text | The initial text. |
hAlignment | Text horizontal alignment. |
maxLineWidth | The max line width. |
imageOffset |
ReturnsAn automatically released Label object.See alsosetBMFontFilePath setMaxLineWidth
Cocos2d-x: Label Class Reference
Label is a subclass of Node that knows how to render text labels. More... Inherits Node, LabelProtocol, and BlendProtocol. Inherited by TextFieldTTF. virtual void setString (const std::string &text) override Sets the text that this Label is to display.
docs.cocos2d-x.org
5개 인자라서 false 빼주고 rect 대신 vector 해줌. 어차피 밑에서 벡터 set해주길래 그냥 0, 0으로 넣음. 그리고 어차피 실행이 목적이라 아무 값이나 넣거나 주석 처리 ㄱㄱ
auto label2 = Label::createWithBMFont("fonts/geneva-32.fnt", "And this is Geneva", TextHAlignment::LEFT, 0, Vec2(0, 0));
그랬더니 오류 133개가 튀어나왔다 아...........
으앙...더해보고 안되면 뭐 레퍼런스나 다른 프로젝트 참고를 해야겠어ㅠㅠ
근데 일단 에러나는 파일을 보면
SpineTest.h
SpineTest.cpp
CCConsole.h
ccUTF8.h
이 4개라서 이걸 제외하기로 결정. 일단 CCConsole.h, ccUTF8.h는 하나씩만 에러가 나고
몇백개 대부분 에러는 SpineTest.h, SpineTest.cpp에서 발생.
그래서 SpineTest.h, SpineTest.cpp 사용하는 부분 싹 다 주석처리.
갹!!!성공!!!!
다양한 예제가 있었다.
그리고 이제 또 분석하면 된다...
버그해결>분석>버그해결>분석>버그해결>분석
ㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋ
'이전게시판 > cocos-2d' 카테고리의 다른 글
cocos2dx bool onTouchBegan(Touch* touch, Event* unused_event); 오버로드 된 멤버함수가 없습니다 (0) | 2024.02.24 |
---|---|
CallFunc::create 함수에서 CC_CALLBACK_0 매크로 인자로 원하는 인수 넘기기 (0) | 2024.02.22 |
cocos2d-x Text와 효과 정리 (0) | 2024.02.17 |
cocos2d-x4 Rect, Scale, Rotation, Flipp, Opacity, Visible, Color (0) | 2024.02.17 |
cocos2d-x 에러 수정하기 (0) | 2024.02.16 |
Cocos2d Anchor 좌표 설정(with cocos2d 기본 프로젝트) (0) | 2024.02.15 |
cocos-2d 4.0 visual studio basic project 실행 (0) | 2024.02.14 |
cocos-2d 4.0 설치 방법 (0) | 2024.02.13 |