'2014/01'에 해당되는 글 185건
- 2014.01.08 [Animations] cocos2d-x 에니메이션 적용하기
- 2014.01.08 [디자인패턴] cocos2d-x 싱글톤 싱글턴 패턴 구현
- 2014.01.08 [Action] cocos2d-x 액션 사용법
- 2014.01.07 strncpy 로 메모리 복사
- 2014.01.07 C언어 배열 초기화 방법
- 2014.01.07 [디버깅] GDB 사용하기
- 2014.01.07 [디버깅] ndk stack 사용법
- 2014.01.07 adb 패스 설정
- 2014.01.07 [디버깅] visual studio에서 GDB 실행?
- 2014.01.07 [디버깅] cocos2d-x Debug 팁
Animations
Frame Animation
아래와 같이 여러개의 이미지 파일로 애니메이션을 만들 수 있다.
Note that CCAnimation is composed by sprite frames, delay time per frame, durations etc, it's a pack of "data". While CCAnimate is an action, it is created base on CCAnimation object.
Sprite Sheet Animation
위 에니메이션 방식은 이해하기 쉽지만, 실제 게임에서는 잘 사용되지 않습니다, 대신 스프라이트 시트 에니메이션을 일반적으로 사용합니다.
다음은 일반적인 스프라이트 시트입니다. 그것은 애니메이션 스프라이트 프레임 시퀀스이거나 같은 장면에서 사용될 이미지 팩이 될 수있다.
Creating from .png and .plist file
그다음에 너는 CCSpriteFrameCache 싱글톤 클래스를 사용하여 plist 파일을 로드합니다.
CCSpriteBatchNode와 프레임이로드 및 스프라이트 시트를 장면에 추가되면, 당신은 "createWithSpriteFrameName"방법을 사용하고, CCSpriteBatchNode 자식으로 추가하여 이러한 프레임을 사용 스프라이트를 만들 수 있습니다 :
createWithSpriteFrameName이 메서드는 posit 파일을 이용하여 해당되는 사각형 영역을 찾을수 있습니다.
CCArray 오브젝트에 에니메이션 프레임을 더합니다. 에니메이션 사이즈는 14 프레임이고 우리는 이것을 사용하면 됩니다.
마지막으로 우리는 CCAnimate 만들고 CCSprite에 runAction을 해줍니다. CCRepeatForever를 이용해서 무한으로 에니메이션을 돌릴수 있습니다.
File animation
CCAnimationCache can load a xml/plist file which well describes the batch node, sprite frame names and their rectangles. The interfaces are much easier to use.
'잡다한것들전부 > Basic Concepts' 카테고리의 다른 글
| [Effects] cocos2-dx 이펙트에 대해서 알아보자! (0) | 2014.01.09 |
|---|---|
| [Basic Concepts] Director, Scene, Layer, Sprite 개념 정리 (0) | 2014.01.09 |
| [Coordinate System] cocos2d-x 좌표 시스템 (0) | 2014.01.09 |
| [Animations] cocos2d-x 에니메이션 적용하기 (0) | 2014.01.08 |
| [Action] cocos2d-x 액션 사용법 (0) | 2014.01.08 |
| cocos2d-x 기본 컨셉 (0) | 2013.09.23 |
#ifndef __SINGLETON_H__
#define __SINGLETON_H__
#include "cocos2d.h"
class SingletonClass{
private:
static SingletonClass * instance ;
~SingletonClass(){/*empty*/};
SingletonClass(){
value = 10;};
public:
static SingletonClass * getInstance();
static void releaseInstance();
int value;
};
#endif
#include "Singleton.h"
SingletonClass * SingletonClass::instance = NULL ;
SingletonClass * SingletonClass::getInstance()
{
if (!instance)
{
instance = new SingletonClass();
}
return instance;
}
void SingletonClass::releaseInstance()
{
if(instance) delete instance;
}
사용법
#include "Singleton.h"
CCLOG("VALUE %d", SingletonClass::getInstance()->value);
이런식으로 접근가능
'잡다한것들전부 > 팁' 카테고리의 다른 글
| 숫자에 세자리마다 콤마를 찍는 알고리즘 (0) | 2014.01.10 |
|---|---|
| [좌표] 좌표에 대해서 알아봅시다(convertToWorldSpace) 절대좌표 (0) | 2014.01.10 |
| [디자인패턴] cocos2d-x 싱글톤 싱글턴 패턴 구현 (0) | 2014.01.08 |
| [디버깅] GDB 사용하기 (0) | 2014.01.07 |
| [디버깅] ndk stack 사용법 (0) | 2014.01.07 |
| [디버깅] visual studio에서 GDB 실행? (0) | 2014.01.07 |
Actions
Actions 클래스는 CCNode 를 상속받는 모든 객체에 명령을 부여합니다. 액션은 오브젝트의 위치, 회전, 크기 기타등등 값들을 수정합니다
일정기간동안 수정하는 작업이면 -> CCIntervalAction actions 그렇지 않으면 -> CCInstantAction 입니다.
예를들면 CCMoveBy는 일정기간동안 수정합니다. CCIntervalAction 액션입니다.
액션의 사용 예:
가속 관련된 액션들 (점점 빨라지거나 느려지는등)
- CCEaseIn
- CCEaseOut
- CCEaseInOut
- CCSpeed
Etc. (See the ActionsEaseTest.cpp example for more info)
CCActionManager를 사용하면 중간에 액션을 일시정지 하고 재시작 할수도있다.(해당객체의)
Basic Actions
Basic actions are the ones that modify basic properties like:
Position(위치수정관련)
CCMoveBy
CCMoveTo
CCJumpBy
CCJumpTo
CCBezierBy
CCBezierTo
CCPlace
Scale(크기수정관련)
Rotation(회전)
Visibility(보이는거)
CCShow
CCHide
CCBlink
CCToggleVisibility
Opacity(알파값)
Color(색깔)
Example:
The act1 will be a CCMoveBy action of duration 0.5, but with the position value of ccp(100,0).
뒤에 By 붙는거와 To 붙는거 차이
By는 현재 값 기준으로 변경 To는 그냥 그런거 상관없이 변경
만약 현재 캐릭터 위치가 120 .30 이면
만약 CCMoveBy::create(2, ccp(50,10)); //현재 캐릭터 위치 기준으로 50,10만큼 이동 -> 170,40
CCMoveTo::create(2, ccp(50,10)); //좌표값에 50, 10으로 이동 -> 50,10
'잡다한것들전부 > Basic Concepts' 카테고리의 다른 글
| [Effects] cocos2-dx 이펙트에 대해서 알아보자! (0) | 2014.01.09 |
|---|---|
| [Basic Concepts] Director, Scene, Layer, Sprite 개념 정리 (0) | 2014.01.09 |
| [Coordinate System] cocos2d-x 좌표 시스템 (0) | 2014.01.09 |
| [Animations] cocos2d-x 에니메이션 적용하기 (0) | 2014.01.08 |
| [Action] cocos2d-x 액션 사용법 (0) | 2014.01.08 |
| cocos2d-x 기본 컨셉 (0) | 2013.09.23 |
The strncpy() function is similar, except that not more than n bytes of
src are copied. Thus, if there is no null byte among the first n bytes
of src, the result will not be null-terminated.
이렇게 명시되어 있으니까요...
strncpy( dst, src, n ); dst[n] = '\0';
정도면 되지 않을까 싶은데요 :)
길이가 n보다 짧다면 null 까지 복사될테고... 아니라면 null terminated 라는 보장이 없으니까 후자일 경우에 한해서 문제를 일으키지 않도록 해주면 되겠죠
'잡다한것들전부 > C, C++, C#' 카테고리의 다른 글
| 추상 클래스 (C++) (0) | 2014.01.10 |
|---|---|
| Duff's Device (0) | 2014.01.10 |
| c++ 11 이란?? (0) | 2014.01.09 |
| strncpy 로 메모리 복사 (0) | 2014.01.07 |
| C언어 배열 초기화 방법 (0) | 2014.01.07 |
| c++ stl 관련 자료 (0) | 2014.01.06 |
1. int a[10] = { 0 };
2. int a[10] = { 0, };
3. int a[10];
memset ( a, 0, 10 );
1번이나 2번을 사용하자. (처음선언시) 나중에 초기화시는 무조건 MEMSET 사용
'잡다한것들전부 > C, C++, C#' 카테고리의 다른 글
| 추상 클래스 (C++) (0) | 2014.01.10 |
|---|---|
| Duff's Device (0) | 2014.01.10 |
| c++ 11 이란?? (0) | 2014.01.09 |
| strncpy 로 메모리 복사 (0) | 2014.01.07 |
| C언어 배열 초기화 방법 (0) | 2014.01.07 |
| c++ stl 관련 자료 (0) | 2014.01.06 |
ndk gdb 를 연결해서 디버깅 하셔야 합니다.
android manifest 에서 debuggable true 로 주는 옵션이 있는데
댓글로 설명하긴 조금 복잡하네요.
ndk gdb 연결해서 debug 하는 방법을 한번 찾아보셔요
에뮬에서만 되고 단말기에서는 안되나봄?
'잡다한것들전부 > 팁' 카테고리의 다른 글
| [좌표] 좌표에 대해서 알아봅시다(convertToWorldSpace) 절대좌표 (0) | 2014.01.10 |
|---|---|
| [디자인패턴] cocos2d-x 싱글톤 싱글턴 패턴 구현 (0) | 2014.01.08 |
| [디버깅] GDB 사용하기 (0) | 2014.01.07 |
| [디버깅] ndk stack 사용법 (0) | 2014.01.07 |
| [디버깅] visual studio에서 GDB 실행? (0) | 2014.01.07 |
| [디버깅] cocos2d-x Debug 팁 (0) | 2014.01.07 |
I made a bit of a progress and I want to share what I did.
When you get errors like this on the LogCat, they are saved on $PROJECT_PATH/obj/local/armeabi where $PROJECT_PATH is the path to your cocos2d-x android project. To symbolicate the messages to something understandable, you can use the ndk-stack tool.
Open up the Terminal (or Cygwin, not sure though) and type in
where:
$ANDROID_NDK is the path to your android NDK
PROJECT_PATH is the path to your cocos2d-x android project
After that, you will get a stack trace which points to certain files and line number where the crash occurred. Something like this:
From the dump above, you can see that on Stack frame #01 points to TowerObj.cpp:150, so I can now go to TowerObj.cpp at line 150 and fix stuff.
Hope this helps.
'잡다한것들전부 > 팁' 카테고리의 다른 글
| [디자인패턴] cocos2d-x 싱글톤 싱글턴 패턴 구현 (0) | 2014.01.08 |
|---|---|
| [디버깅] GDB 사용하기 (0) | 2014.01.07 |
| [디버깅] ndk stack 사용법 (0) | 2014.01.07 |
| [디버깅] visual studio에서 GDB 실행? (0) | 2014.01.07 |
| [디버깅] cocos2d-x Debug 팁 (0) | 2014.01.07 |
| cocos2d-x 소스 코드 주소 (0) | 2014.01.07 |
C:\Android\adt-bundle-windows-x86-20130729\adt-bundle-windows-x86-20130729\sdk\platform-tools
ADB(Android Debug Bridge)
http://developer.android.com/tools/help/adb.html
adb 는 Android Debug Bridge 의 약자로 안드로이드 디버그 기능을 한다고 보면 됩니다.
adb를 사용해서 에뮬레이터 및 장치를 이용할 수 있습니다.
adb 명령을 알아보기 위해 우선 adb.exe 가 있는 곳으로 이동합니다.
제가 테스트하는 환경에서 Android SDK 는 아래와 같습니다.
adbshell 에서 쓸수 있는 명령어 모음 입니다.
adb logcat -v time [filter]
시스템 기본정보: 하드웨어, 커널 등
cat /proc/version : 커널 버전
cat /proc/cpuinfo : 프로세서 정보, CPU타입, 모델 제조사 등
cat /porc/meminfo : 메모리 정보, 실제 메모리 및 가상 메모리
cat /proc/devices : 현재 커널에 설정되어 있는 장치 목록
mount : 마운트된 모든 장치 정보
df : 하드디스크 사용량
cat /porc/filesystems : 커널에 설정되어 있는 파일시스템 목록
cat /proc/swaps : 스왑 파티션의 크기와 사용량
cat /proc/interrupts : 장치가 사용중인 인터럽트(IRQ)목록 표시
cat /proc/ioports : 현재 사용중인 input/output 포트
cat /proc/partitions : 파티션 정보
cat /proc/uptime : 시스템이 얼마나 살아있었는지
cat /proc/stat : 시스템 상태에 관한 다양한 정보, CPU 사용 통계, 부팅이후 page fault 발생 횟수 등
cat /proc/zoneinfo : ZONEINFO
dmesg : 시스템 부팅시 나왔던 메시지
ps : 실행중인 프로세스 정보
ps -p - t : 프로세스와 쓰레드 목록
set or printenv : 환경설정값 출력
시스템 리소스 사용 현황
vmstat : 시스템 리소스 상황 모니터, CPU, I/O, Memory 등
cat /proc/diskstats : 디스크 utilization과 throughput. 즉 디스크 I/O현황
top : 시스템 프로세스 상황 모니터링/ 프로세스별 CPU사용량, 메모리와 스왑 사용량 등
procrank : 프로세스별 메모리
dumpsys meminfo [PID] : 해당 프로세스 메모리 상세 정보
cat /proc/[PID]/stat : 해당 프로세스에 대한 정보, 시작시간, 상태, CPU 사용량 등
cat /proc/[PID]/maps : 해당 프로세스의 메모리 맵 정보
cat /proc/vmstat : 버추얼 메모리 통계?
librank : 라이브러리별 메모리 사용량?
네트워크 관련
cat /proc/net/netlink : 네트워크 정보
netcfg : 네트워크 인터페이스와 IP주소 목록
netstat : 네트워크 연결상태 확인
nc : 네트워크용 cat 명령어(netcat)
ifconfig : 네트워크 인터페이스 설정 정보. 장치명을 파라미터로 받음. ip 주소. 서브넷마스크 등
tcpdump : 실시간 패킷 모니터링
iftop : 네트워크를 위한 top
route : 해당 호스트까지 연결하는 중간 경로 정보인 라우팅 테이블 표시
ping : 원격 호스트와의 연결 테스트
cat /proc/net/route : Route
안드로이드 제공
logcat : 로그캣 보기
pm : package manager의 약자. 패키지/permission/instrumentation/feature 목록, 패키지 설치/제거 등
am : activity manager의 약자, 액티비티 시작, Intent 브로드캐스팅, Instrumentation 시작, profiling 시작 / 중지 등
service : 안드로이드 서비스 목록 표시, 서비스에 명령 전달
monkey : 애플리케이션에 랜덤 이벤트 발생시킴. 사용자 이벤트, 시스템 이벤트의 무작위 발행
cat /data/anr/traces.txt : VM TRACES (쓰레드 덤프)
cat /proc/binder/proc/[PID] : 바인더 프로세스 상태
cat /proc/binder/xxx : 바인더 관련 정보(xxx은 transaction, transaction_log, failed_transaction_log, stats 등)
cat /data/system/packages.xml : 설치된 패키지 세팅 정보
setprop : system property 셋팅
getprop : 셋팅된 system property 목록 출력
종합 리포트
dumpsys [service] : app/service 상태정보 덤프, 서비스별로 추가 파라미터 받을 수 있음
dumpstate : device 상태정보 덤프. 상태정보를 추출하는 여러 명령어들의 조합으로 구성
dumpcrash : 애플리케이션이 crach될 때의 상태정보 덤프
bugreport : logcat + dumpsys + dumpstat
---------------------------------------------------------------------------------------------
ADB Shell Command - 15가지 팁
Basic Android Terminal and ADB Shell Command List
1. How to open a cmd in Android Phone
Method 1: “Start” ? “”Program”-” “Accessories” ? “” Command Prompt ”
Method 2: “Start” ? “” Run “, type cmd ENTER
2. How to restart Android Phone
When the phone and Computer is connected to the data cable, you can enter the following command
adb shell reboot === ENTER
3. Restart Android into Recovery Mode
With the data cable connected to your phone and computer, enter the following command
adb shell reboot recovery === ENTER
4. Convert back to ext2 partition
Restart the phone into Recovery mode, press “Alt + X” into the console. Open cmd and enter the following command
adb shell === ENTER
tune2fs-O ^ has_journal / dev/block/mmcblk0p2 === carriage return
e2fsck / dev/block/mmcblk0p2 === carriage return (optional, can be a problem area in section 2, when used)
5. Pulling applications from Android phone to computer
adb pull /system/sd/app app
adb pull /system/sd/app-private app-private
6. Pushing applications back to android phone from the computer
adb push app /system/sd/app
adb push app-private /system/sd/app-private
7. Delete existing apps on Android SD
adb shell rm -r /system/sd/app
adb shell rm -r /system/sd/app-private
8. Repair gravity System or switch to screen
Sometimes frequent brushing of phone can cause gravity system or switch to screen failure. Just follow the steps below-
Restart the phone into Recovery mode, press “Alt + X” into the console
Open cmd and enter the following command
mount / data === carriage return
rm / data / misc / akmd * / data / misc / rild * === ENTER
9. Ext2/ext3/ext4 formatted partition
Enter the following command in the cmd
adb remount === ENTER
adb shell === ENTER
rm-r / system / sd / * === carriage return
10. Remove/ system / app under the application
Under normal circumstances / system / app is not under an application. Use the following methods to remove these applications.
Open cmd and enter the following command
adb remount === ENTER
adb rm / system / app / Stocks.apk === Enter
11. If the start Time is too Long
Just enter the following command in order to view the boot process.
adb logcat === ENTER
12. Through Terminal Partition SD card
It will erase everything on your SD card
$ su
# cd /data
# wget http://64.105.21.209/bin/lib/droid/sdsplit
# chmod 555 sdsplit
# /data/sdsplit -fs *size* (add -nc to the end for JFv1.5ADP)
13. From the Recovery Screen, send an update file to your SD card.
adb shell mount /sdcard
adb shell rm /sdcard/update.zip
adb push *filename* /sdcard/update.zip
14. Restoring a nandroid backup via Fastboot
Start command-prompt/terminal cd to the nandroid folder and enter following commands
fastboot erase boot
fastboot erase recovery
fastboot flash system system.img
fastboot flash boot boot.img
fastboot flash userdata data.img
fastboot flash recovery recovery.img
fastboot reboot
15. Clear Search History in Android
Search History is accounted for Mobile Memory. It can also leak your privacy information as well. Just follow the steps below to clear android history.
Steps are as follows:
1. Make sure your mobile phone has Root authority.
2. Open the super-terminal.
3. Enter the following command
su
rm / data / data / com.android.vending / databases / suggestions.db
4. Exit Hyper Terminal and restart the phone.
---------------------------------------------------------------------------------------------
adb devices
adb 서버가 인식한 휴대폰과 에뮬레이터 목록을 보여준다.
연결된 devices의 TCP/IP 포트 번호를 알아낼 때 도움이 된다.
다른 명령어를 사용할 때, -s나 -e 옵션은 여러 개의 장치를 연결했을 때 특정한 디바이스를 지정할 때 사용한다.
예)
디바이스 검색
adb devices
adb shell
타겟 시스템의 쉘에 연결하고 # 프롬프트를 띄운다. 쉘은 간소한 유닉스 쉘 같아서 간단한 명령으로 타겟 시스템을 탐색하고 수정할 수 있다.
예)
여러 단말기 중에 하나를 선택해서 접속할 때,
adb -s emulator-5554 shell
adb install [-l][-r] file_spec
app을 설치하거나 재설치할 때 사용한다.
-l : 다른 장치로 복사돼 넘어가는 것을 막는다.
-r: 이미 존재하는 app 데이터를 지우지 않은 채 어플리케이션을 재설치 한다.
file_spec: 설치할 app의 .apk 파일
예)
파일 설치시
adb install c:\download\HangulKeyboard.apk
adb uninstall [-k] package
패키지 이름을 가진 app을 제거하다.
-k : app의 데이터를 보존한다.
package: 패키지의 전체 경로, .apk 확장자는 빼야 한다.
예)
패키지 삭제시
adb unstall com.falinux.android.hello
adb push local remote
개발자 컴퓨터에 있는 local이란 이름을 가진 파일을 타겟 시스템에 remote란 이름으로 복사한다.
예)
com.falinux.android.rose.apk 파일을 안드로이드 기기 /data/app/ 폴더 안으로 집어넣을 때,
adb push c:\com.falinux.android.rose.apk /data/app/
adb pull remote local
타겟 시스템에 있는 remote라는 파일을 개발자 컴퓨터에 local이란 이름으로 복사한다.
예)
안드로이드 기기 /data/app/com.falinux.android.rose.apk 파일을 C 드라이브로 가져올 때,
adb pull /data/app/com.falinux.android.rose.apk c:\com.falinux.android.rose.apk
adb reboot
안드로이드 시스템을 리부팅 시킨다.
adb kill-server
adb 에 문제가 있을 경우, adb를 종료시킨다.
adb start-server
종료된 adb를 실행 시킨다.
'잡다한것들전부 > 안드로이드' 카테고리의 다른 글
| 구글 인앱 빌링 ver 3 item already owned 오류시 해결방법 (0) | 2014.01.13 |
|---|---|
| 구글 안드로이드 인앱결제 관련 인앱빌링 ver3 적용 (0) | 2014.01.13 |
| adb 패스 설정 (0) | 2014.01.07 |
| 안드로이드 동적 생성 view button progressbar 등 (0) | 2014.01.06 |
| 뒤로가기 버튼 클릭시 종료 팝업후 종료 하기 (0) | 2013.12.30 |
| INSTALL_FAILED_INSUFFICIENT_STORAGE 오류시 (0) | 2013.12.30 |
http://visualgdb.com/tutorials/android/
'잡다한것들전부 > 팁' 카테고리의 다른 글
| [디버깅] GDB 사용하기 (0) | 2014.01.07 |
|---|---|
| [디버깅] ndk stack 사용법 (0) | 2014.01.07 |
| [디버깅] visual studio에서 GDB 실행? (0) | 2014.01.07 |
| [디버깅] cocos2d-x Debug 팁 (0) | 2014.01.07 |
| cocos2d-x 소스 코드 주소 (0) | 2014.01.07 |
| [디버깅] cocos2d-x Ant 사용법 (0) | 2014.01.07 |
NFIsNOT//최근 버전에서는 ndkgdb.sh 파일이 추가되었습니다.
환경변수만 복사해서 이클립스에 추가하고 디버깅 걸어주면 디버깅이 뙇!!
ndk-stack 한번 써보세요
네이티브에서 뻗으면 스택이 찍혀요
'잡다한것들전부 > 팁' 카테고리의 다른 글
| [디버깅] ndk stack 사용법 (0) | 2014.01.07 |
|---|---|
| [디버깅] visual studio에서 GDB 실행? (0) | 2014.01.07 |
| [디버깅] cocos2d-x Debug 팁 (0) | 2014.01.07 |
| cocos2d-x 소스 코드 주소 (0) | 2014.01.07 |
| [디버깅] cocos2d-x Ant 사용법 (0) | 2014.01.07 |
| [팁] 안드로이드 cocos2d-x 디버깅 시 (0) | 2014.01.07 |


