1 / 56

모바일 프로그래밍

JNI 와 NDK 의 사용목적 및 기타 게임 프로그램. 모바일 프로그래밍. 전병우 이종민. 목차. Engine Multi-Platform Engine 설명 Interface Function Game Game Concept Game Flow Game 기획 JNI & NDK Break Limitation of NDK JNI, NDK Sound Sensor. Engine. Multi-Platform. Windows. Linux. Symbian. Engine. Mac. Palm.

jirair
Télécharger la présentation

모바일 프로그래밍

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. JNI 와 NDK의 사용목적 및 기타 게임 프로그램 모바일 프로그래밍 전병우 이종민

  2. 목차 • Engine • Multi-Platform • Engine 설명 • Interface • Function • Game • Game Concept • Game Flow • Game 기획 • JNI & NDK • Break Limitation of NDK • JNI, NDK • Sound • Sensor

  3. Engine

  4. Multi-Platform Windows Linux Symbian Engine Mac Palm

  5. Multi-Platform Windows Interface Linux Symbian Engine Mac Palm

  6. Multi-Platform Windows Interface Linux Function Symbian Engine Mac Palm

  7. Engine 설명

  8. Interface Mark2Core Mark2Graphic Main.cpp Update Render Event Mark2RenderSystem

  9. Interface Android Mark2Core Windows Mark2Graphic Main.cpp Update Render Event Mark2RenderSystem WindowsMobile

  10. Interface Android Activity.Java Java NDK OpenGL ES Windows Main.cpp C++ main DirectX OpenGL WindowsMobile C++ WinMain DirectMobile OpenGL ES

  11. Interface Android JNI, NDK Activity.Java Java NDK OpenGL ES Windows Main.cpp C++ main DirectX OpenGL WindowsMobile C++ WinMain DirectMobile OpenGL ES

  12. Interface int APIENTRY WinMain() { MApplication app(MApplication::RENDERSYSTEM_DIRECTMOBILEFIXED); MWidget* pMainWidget = MNEW Galaxy3(); app.exec(); return 0; } int APIENTRY WinMain() { MApplication app(MApplication::RENDERSYSTEM_DIRECTX9); MWidget* pMainWidget = MNEW Galaxy3(); app.exec(); return 0; }

  13. Interface void init(const char* apkPath) { pApp = MNEW MApplication(MApplication::RENDERSYSTEM_OPENGLES); pMainWidget = MNEW Galaxy3; } bool update() { boolbRunning = true; pApp->FrameStart(); bRunning = pApp->FrameUpdate(); pApp->FrameEnd(); pApp->MessagePump(); return bRunning; }

  14. Function Instance Archieve Load Picture Mark2Core XML Parser Fixed Point Main.cpp Delegate Sound Mark2Graphic 3D Object Wrap Renderer Widget System Mark2RenderSystem Message System

  15. Function.Instance 이중 충돌 std::map<String, MObject*> Filename MObject* Filename MObject* Filename MObject*

  16. Function.Instance

  17. Function.Achieve http://www.nih.at/libzip/ Mesh Zip Sound User Interface Etc

  18. Function.Load Picture http://www.libpng.org/pub/png/libpng.html http://www.ijg.org/ RGB888 ARGB8888 Raw Image ColorConvert RGBA8888 RGB565

  19. Function.XMLParser http://www.grinninglizard.com/tinyxml/ • XMLFile • XMLMeshLoader • XMLAnimationLoader

  20. Function.FixedPoint

  21. Function.Delegate http://en.wikipedia.org/wiki/Signals_and_slots http://en.wikipedia.org/wiki/Delegate_(.NET) http://en.wikipedia.org/wiki/Observer_pattern http://www.codeproject.com/KB/cpp/fd.aspx JaeWookChoi

  22. Function.Sound MediaManager AudioManager MSoundWarpper WindowsMobile Windows Android

  23. Function.3DObject 3D ObjectXML 3ds MaxPlugin XMLParser 3D ObjectAnimationXML

  24. Function.WarpRenderer • CreateMaterial • CreateTexture • CreateLight • MessagePump • BeginScene • EndScene • Present Mark2Graphic Mark2RenderSystem Mark2RenderSystem

  25. Function.WidgetSystem S P A C E R A I L Start Game Credit Exit Game

  26. Function.MessageSystem Click~! S P A C E R A I L Start Game Credit Exit Game CompareUI Rect & ClickPosition Message Pumping

  27. MessageSystem • WidgetSystem Function.MessageSystem • Pop Event • Push Event

  28. Game • Windows Mobile • Windows Phone 7 • IOS • Symbian • Android • Palm 세종대학교

  29. Game • Windows Mobile • Windows Phone 7 • IOS • Symbian • Android • Palm 세종대학교

  30. Game

  31. Game Concept 스카이로드 남극탐험

  32. Game Concept Speed Speed 100 AU 100 AU 카메라와 캐릭터를 고정시켜 조작감 극대화

  33. Game Flow My Records 1. 2009/11/04 200012 2. 2009/11/04 200012 Windows 3. 2009/11/04 200012 4. 2009/11/04 200012 5. 2009/11/04 200012 Back Exit 선택 Information 선택 Back 선택 Back 선택 Option 선택 Space Rail Back선택 Help 선택 My Records 선택 Back 선택 Play Game Information My Records Information Options Exit Help Credits Option Back Back Credits 선택 Back선택 Help 선택 Help Credits How to Play? ~~~~~~~```` ~~~~~~~~``` ~~~~~~~~``` ~~~~~~~~``` ~~~~~~~~~~~ ~~~~~~~```` ~~~~~~~~``` ~~~~~~~~``` ~~~~~~~~``` 선택 Back Back Back Back 선택

  34. Game Flow Speed Back 선택 100 AU 선택 Play 선택 Play Game 선택 선택 Back 선택 Back 선택 Back Back Galaxy 행성 선택 화면 선택 Play Game My Records Information Options Exit 조건 1) 조건 2) 조건 3) Play Back

  35. Game 기획 분명한 Goal End 점프 스킬 사용 현재위치 무제한으로 점프 스킬을 사용할 수 있다. 시작점

  36. Game 기획 가속 일반 이동 미사일 발사 이동 동작 부스터 크기 최대 부스터 조금 발사 파란미사일 발사체 생성 점프 불가 점프 2배 감속 공중 동작 가스 분출구 봉쇄 보조 날개 생성 부스터 방출 없음

  37. Game 기획 이동속도 이동 방향 속도가 빨라질 수록 맵 내려오는 속도가 증가한다. 기본적으로 한 칸씩 좌우 이동이 가능하다.

  38. Game 기획 미사일 발사1칸당 1발 발사된 미사일과 NPC 충돌 시 사망 발사선 밟고 점프시 공중 발사 점프 2배 좌우로 2칸 이동 정면으로 2칸 이동 속도 상승 상승 속도 = 최도 속도 * 2 입장 시 급격한 상승(정상 속도부터) 퇴장 시 급격한 하강(정상 속도로) 무적 밟고 있는 동안 무적 미사일 발사 속도 상승 무적 점프 2배 일반 이동 게임 시작 - 최고 속도 도달 2초 좌우 점프 – 1칸 이동 정면 점프 - 1칸 이동 점프 불가 점프 불가능(통제 불가) 속도 하강 상승 속도 = 최도 속도 * (1/2) 입장 시 급격한 하강(정상 속도부터) 퇴장 시 급격한 상승(정상 속도로) 추락 시작 위치로 이동 일반 이동 속도 하강 점프 불가 추락

  39. Game 기획 Enemy 1 Enemy 1 Enemy 3 Enemy 4 Enemy 5 좌우로 이동 (끝까지 이동) 플레이어를 향해 돌진 등장 시 좌로 3칸 이동 후 정리 우로 3칸 M을 그리며 점프 이동 미사일 발사 이동 속도 이동 속도 이동 속도 이동 속도 이동 속도 이동 후 정지 시간 좌, 우 이동 칸 수 점프 후 정지 시간 Enemy 3 움직임 + 미사일 발사(턴전) 이동 후 정지 시간

  40. Game 기획 - 1 - - 1 - - 1 - - 1 - - 1 - - 1 - - 1 - - 1 - A Type(고정) B-1f Type C-1f Type(빠른 좌회전) D-1F Type E-1F Type (빠른 좌회전) B-1s Type E-1F Type (느린 좌회전) C-1s Type(느린 좌회전) D-1s Type C-2s Type(느린 우회전) E-1F Type (빠른 우회전) C-2f Type(빠른 우회전) D-2f Type D-2s Type E-1F Type (느린 우회전) - 1 - - 1 - F - Type G - Type

  41. JNI & NDK Java Native Interface JAVA C++

  42. JNI & NDK C - DynamicLink Java Native Interface Native Development Kit Cross-Compiler Dalvik

  43. JNI & NDK Software Development Kit JAVA Java Native Interface Dynamic Link Dynamic Link Static Link Static Link Android.mk Android.mk Android.mk Native Development Kit C Code Cygwin Windows

  44. Break Limitation of NDK

  45. Break Limitation of NDK http://www.crystax.net/android/ndk-r4.php

  46. JNI, NDK C++로 만들어둔 Library들 로드 static { System.loadLibrary("Mark2Core"); System.loadLibrary("Mark2Graphic"); //System.loadLibrary("Mark2RenderSystem_GLES"); System.loadLibrary("Makkolli"); } Java  C 로 통하는 함수 정의 public native void nativeInit(String apkPath); public native void nativeUpdate(); public native void nativeMousePush(intnX, intnY); public native void nativeMouseRelease(intnX, intnY);

  47. JNI, NDK • class MakkolliRenderer implements GLSurfaceView.Renderer{ • public void onSurfaceCreated(GL10 gl, EGLConfigconfig) { • m_SpaceRailAct.nativeInit(apkFilePath); • } • public void onDrawFrame(GL10 gl) { • m_SpaceRailAct.nativeUpdate(); • } • } Java  C 로의 실질적인 함수 호출 • class MakkolliGLview extends GLSurfaceView { • public booleanonTouchEvent(final MotionEvent event){ • switch( event.getAction() ) • { • case MotionEvent.ACTION_DOWN: • m_SpaceRailAct.nativeMousePush((int)event.getX(), (int)event.getY()); • break; • case MotionEvent.ACTION_UP: • m_SpaceRailAct.nativeMouseRelease((int)event.getX(), (int)event.getY()); • break; • } • return true; • } • }

  48. JNI, NDK Java  C Interface에서 C 함수 정의 자동 생성 ndk-build 를 이용한 C코드 컴파일

  49. JNI, NDK Android.mk include $(CLEAR_VARS) MARK2CORE = \ Mark2Core.cpp \ ……….. ../jni_tools.cpp LOCAL_C_INCLUDES := LOCAL_MODULE := Mark2Core LOCAL_SRC_FILES := $(MARK2CORE) LOCAL_CFLAGS := -DANDROID_NDK -DMARK2CORE_EXPORTS LOCAL_CPP_EXTENSION := .cpp LOCAL_LDLIBS := -L$(SYSROOT)/usr/lib -ldl -llog -lz LOCAL_STATIC_LIBRARIES := libjpegliblibpngliblibzliblibtinyxmllibzip include $(BUILD_SHARED_LIBRARY)

  50. JNI, NDK 자동으로 생성된 Java  C Interface 함수 /* DO NOT EDIT THIS FILE - it is machine generated */ #include <jni.h> JNIEXPORT void JNICALL Java_makkolli_spacerail_SpaceRailActivity_nativeInit (JNIEnv *, jobject, jstring); JNIEXPORT void JNICALL Java_makkolli_spacerail_SpaceRailActivity_nativeUpdate (JNIEnv *, jobject); JNIEXPORT void JNICALL Java_makkolli_spacerail_SpaceRailActivity_nativeMousePush (JNIEnv *, jobject, jint, jint); JNIEXPORT void JNICALL Java_makkolli_spacerail_SpaceRailActivity_nativeMouseRelease (JNIEnv *, jobject, jint, jint);

More Related