-
Notifications
You must be signed in to change notification settings - Fork 2
Getting started
Janzku edited this page Oct 10, 2014
·
2 revisions
This page is step by step tutorial how to get started with this engine cleanly, without importing your project into game-engine solution, but use your own solution for your own game.
- If you are missing NDK, download it from https://developer.android.com/tools/sdk/ndk/index.html (android-ndk32-r10b-windows-x86_64.zip).
- Extract it somewhere.
- Download latest engine and build it in both RELEASE and DEBUG.
- Bear in mind that we want engine and your solution folders to be in same folder.
- Copy android folder from engine to root folder, where both engine and your game solution folders will be.
- Copy BuildAndroid.bat and CopyAssets.bat to root folder. We will modify them later to match your project.
- After this, you don't need to touch engine anymore, but whenever you update engine, rebuild it in both configurations.
- Create your solution in root folder, where engine solution folder resides
- Folder structure is up to you, but let's make include and source folders to your project.
- Copy main.cpp and Scenes.hpp from engine's TestProject and include them into your project.
- Create your scene (or copy from TestProject) and modify Scenes.hpp to match it.
- Create assets folder at root folder. You will put every assets you use in here.
- Your game project folder should look like in picture
Window
- Configure your project as shown in images.
http://imgur.com/laOmwa1,0QfXAx0,swCBsyQ,FeAuA4u
Android
- Go to copied android folder at root folder and delete bin and obj folders as we want to do clean compilation.
- Open Android.mk in text-editor and edit source and include paths to match correct folder structure.
- Remember to include all classes you are using in this make-file.
include $(CLEAR_VARS)
LOCAL_MODULE := libopenal
LOCAL_SRC_FILES := ../../UtH-Engine/ext/lib/android/libopenal.so
include $(PREBUILT_SHARED_LIBRARY)
include $(CLEAR_VARS)
LOCAL_MODULE := libsndfile
LOCAL_SRC_FILES := ../../UtH-Engine/ext/lib/android/libsndfile.so
include $(PREBUILT_SHARED_LIBRARY)
include $(CLEAR_VARS)
LOCAL_MODULE := uthengine
LOCAL_SRC_FILES := main.cpp \
../../MyGame/MyGame/source/MyScene.cpp \
../../MyGame/MyGame/source/MySecondClass.cpp \
.
.
.
../../MyGame/MyGame/source/MyNthClass.cpp
LOCAL_LDLIBS := -llog -landroid -lEGL -lGLESv2 -lOpenSLES
LOCAL_STATIC_LIBRARIES := android_native_app_glue engine
LOCAL_SHARED_LIBRARIES :=
LOCAL_C_INCLUDES += $(LOCAL_PATH)/../../MyGame/MyGame/include/
LOCAL_C_INCLUDES += $(LOCAL_PATH)/../../UtH-Engine/include/
LOCAL_C_INCLUDES += $(LOCAL_PATH)/../../UtH-Engine/ext/include/
LOCAL_C_INCLUDES += $(LOCAL_PATH)/../../UtH-Engine/ext/include/freetype_include/
- Next open Platform.mk in text-editor and modify correct source paths.
LOCAL_PATH := $(call my-dir)
SRC_PATH := ../../UtH-Engine/src/
include $(CLEAR_VARS)
include $(CLEAR_VARS)
LOCAL_MODULE := freetype
LOCAL_SRC_FILES := ../../UtH-Engine/ext/lib/android/libfreetype.a
include $(PREBUILT_STATIC_LIBRARY)
include $(CLEAR_VARS)
LOCAL_MODULE := libfreetypegl
LOCAL_SRC_FILES := ../../UtH-Engine/ext/lib/android/libfreetypegl_static.a
include $(PREBUILT_STATIC_LIBRARY)
include $(CLEAR_VARS)
LOCAL_MODULE := libbox2d
LOCAL_SRC_FILES := ../../UtH-Engine/ext/lib/android/libbox2d_static.a
include $(PREBUILT_STATIC_LIBRARY)
LOCAL_MODULE := engine
LOCAL_STATIC_LIBRARIES := android_native_app_glue engine libbox2d libfreetypegl freetype
LOCAL_SHARED_LIBRARIES := libopenal libsndfile
LOCAL_C_INCLUDES += $(LOCAL_PATH)/../../UtH-Engine/include/
LOCAL_C_INCLUDES += $(LOCAL_PATH)/../../UtH-Engine/ext/include/
LOCAL_C_INCLUDES += $(LOCAL_PATH)/../../UtH-Engine/ext/include/freetype_include/
- Open BuildAndroid.bat in text-editor and modify correct NDK path.
@echo off
start CopyAssets.bat
set NDK_PROJECT_PATH=android
start C:\Users\Public\ndk\ndk-build.cmd
exit
- Open CopyAssets.bat in text-editor and modify it to match your project.
@echo off
robocopy /NJS /NJH /S assets MyGame/MyGame/assets
robocopy /NJS /NJH /S assets android/assets
exit
- Run BuildAndroid.bat
- Start eclipse.
- Go to File -> Import...
- Select Android -> Existing Android Code Into Workspace.
- Browse android folder that was in game projects root folder and finish importing.
- Rename project name and package name to match your game project.
- DO NOT RENAME GAMEACTIVITY-CLASS IN JAVA-CODE.
- Open AndroidManifest.xml.
- Correct package name to match your new package name.
- Select Application tab.
- Write your application / game name into Label
- At icon, select browse and create new icon for your game.



