30 Commits

Author SHA1 Message Date
Túlio Henrique
50180b594d Added preprocessor directive on mobilefacade.cpp 2015-08-16 13:54:46 -03:00
Túlio Henrique
2fbd29ff8b Added preprocessor directive on mobilefacade.cpp 2015-08-16 13:48:35 -03:00
Túlio Henrique
7cb1c9fae8 Merge branch 'mobile_port' of https://github.com/edubart/otclient into mobile_port 2015-08-16 13:40:30 -03:00
Túlio Henrique
0deeabbfda Removed SDL2 and created JNI interface (Android Only) 2015-08-16 13:39:27 -03:00
Túlio Henrique
01992aae7e Merge branch 'master' of https://github.com/edubart/otclient into mobile_port 2015-08-13 10:05:00 -03:00
Túlio Henrique
90ff929291 Update README.md 2015-08-05 09:14:33 -03:00
Túlio Henrique
0e87c8355b Improved input handler 2015-07-28 07:55:27 -03:00
Túlio Henrique
57b9ad88eb Added 'strings.xml' on android project 2015-07-07 10:52:05 -03:00
Túlio Henrique
2d65a0a3ed Merge with 'master' 2015-07-07 10:43:18 -03:00
Túlio Henrique
b18c60eb77 Added .bat file to compile on windows 2015-07-07 10:35:09 -03:00
Ben Dol
d0a365144e Added 'Compiling for Android' wiki page 2015-04-24 15:44:55 +12:00
Ben Dol
d88505bf8d Temporarily change the travis branch to 'mobile_port' will change this back later. 2015-04-24 15:25:20 +12:00
BenDol
789f86a778 Merge branch 'master' of https://github.com/Tulioh/otclient into mobile_port 2015-04-24 15:16:28 +12:00
Túlio Henrique
eecf8beb2f Update README.md 2015-04-23 21:20:53 -03:00
Túlio Henrique
121e6b29ef Update README.md 2015-04-23 20:53:03 -03:00
Túlio Henrique
c2b25abd37 Update README.md 2015-04-23 20:52:46 -03:00
Túlio Henrique
6016c87337 Update README.md 2015-04-23 20:51:45 -03:00
Tulioh
11a81650e4 Added SDLActivity on project folder 2015-04-23 14:45:12 -03:00
Tulioh
44ddbc34e8 Fix on android finger 2015-04-23 14:40:24 -03:00
Tulioh
4605c72546 Fix on android finger 2015-04-23 14:40:18 -03:00
Tulioh
2b96ae7f09 Merge https://github.com/edubart/otclient 2015-04-19 12:22:16 -03:00
Tulioh
fcf545133b Merge branch 'master' of https://github.com/Tulioh/otclient 2015-01-11 13:25:29 -02:00
Tulioh
fd97ccd402 Implemented some event handlers in SDL 2015-01-11 13:24:54 -02:00
Túlio Henrique
4807c4a19d Removed the line that delete the build folder 2015-01-02 07:31:58 -02:00
Tulioh
15b3d439d6 Compiling and running on android, but the window is black when run (bug) 2014-12-30 23:36:42 -02:00
Tulioh
389c7f2a60 Compiling for android but have some bugs 2014-12-25 14:22:37 -02:00
Tulioh
c28d2c1555 Compiling for android but have some bugs 2014-12-25 14:20:38 -02:00
Tulioh
7e34c452a1 Added some files to this commit 2014-12-22 00:37:07 -02:00
Tulioh
b3b314f01b Android compilation added. 2014-12-19 00:56:55 -02:00
Tulioh
997daa2d49 Starting to create CMakeLists to android 2014-12-18 00:31:28 -02:00
51 changed files with 3330 additions and 125 deletions

14
.gitignore vendored
View File

@@ -4,12 +4,26 @@ CMakeFiles
cmake_install.cmake
Makefile
/otclient
/android/project/build.xml
/android/project/proguard-project.txt
/android/project/gen
/android/project/bin
/android/project/libs
/android/project/.settings
/android/project/.classpath
/android/project/.project
/android/project/.cproject
/android/project/local.properties
/android/project/project.properties
libs*
.idea*
/*.h
/*.cxx
*.o
*.gch
*.a
*.exe
*.so
*.spr
*.dat
*.kdev*

View File

@@ -19,10 +19,6 @@ endif()
option(USE_PCH "Use precompiled header (speed up compile)" OFF)
set(executable_SOURCES
src/main.cpp
)
# add executable icon for win32 platforms
if(WIN32)
add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/otcicon.o
@@ -35,8 +31,18 @@ endif()
add_definitions(-D"VERSION=\\"${VERSION}\\"")
set(executable_SOURCES
src/main.cpp
)
if(ANDROID)
# add shared library for android
add_library(${PROJECT_NAME} SHARED ${framework_SOURCES} ${client_SOURCES} ${executable_SOURCES})
else()
# add client executable
add_executable(${PROJECT_NAME} ${framework_SOURCES} ${client_SOURCES} ${executable_SOURCES})
endif()
target_link_libraries(${PROJECT_NAME} ${framework_LIBRARIES})
if(USE_PCH)

View File

@@ -1,4 +1,4 @@
[![Build Status](https://secure.travis-ci.org/edubart/otclient.svg?branch=master)](http://travis-ci.org/edubart/otclient) [![Join the chat at https://gitter.im/edubart/otclient](https://img.shields.io/badge/GITTER-join%20chat-green.svg)](https://gitter.im/edubart/otclient?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
[![Build Status](https://secure.travis-ci.org/edubart/otclient.svg?branch=mobile_port)](http://travis-ci.org/edubart/otclient) [![Join the chat at https://gitter.im/edubart/otclient](https://img.shields.io/badge/GITTER-join%20chat-green.svg)](https://gitter.im/edubart/otclient?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
### What is otclient?
Otclient is an alternative Tibia client for usage with otserv. It aims to be complete and flexible,
@@ -8,6 +8,17 @@ that each functionality is a separated module, giving the possibility to users m
anything easily. Users can also create new mods and extend game interface for their own purposes.
Otclient is written in C++2011, the upcoming C++ standard and heavily scripted in lua.
## The Mobile Project
This is a fork of edubart's otclient. The objective of this fork it's to develop a runnable otclient on mobiles devices.
Tasks that need to do:
- [X] Compile on Android devices
- [ ] Compile on Apple devices
- [ ] Adapt the UI reusing the existing lua code
Current compiling tutorials:
* [Compiling for Android](https://github.com/edubart/otclient/wiki/Compiling-for-Android)
### Where do I download?
The latest commits compiled for Windows can be found here.
@@ -44,7 +55,6 @@ In short, if you need to compile OTClient, follow these tutorials:
* [Compiling on OS X](https://github.com/edubart/otclient/wiki/Compiling-on-Mac-OS-X)
### Need help?
Try to ask questions in [otland](http://otland.net/f494/), now we have a board for the project there,

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,18 @@
#!/bin/sh
mkdir -p ../build_android && cd ../build
cmake -DCMAKE_TOOLCHAIN_FILE=../android/android.toolchain.cmake -DANDROID_ABI=armeabi-v7a -DANDROID_NATIVE_API_LEVEL=android-16 -DANDROID_TOOLCHAIN_NAME=arm-linux-androideabi-4.6 ..
make
cd ../
cp -r libs android/project/
cp $ANDROID_NDK/libraries/lib/libSDL2.so android/project/libs/armeabi-v7a
cd android/project
android update project -p . --name OTClientMob --target android-16
ant debug
cd bin
adb install -r OTClientMob-debug.apk

View File

@@ -0,0 +1,18 @@
cd ..
mkdir build_android
cd build_android
cmake -G "Unix Makefiles" -DCMAKE_TOOLCHAIN_FILE=../android/android.toolchain.cmake -DANDROID_ABI=armeabi-v7a -DANDROID_NATIVE_API_LEVEL=android-16 -DANDROID_TOOLCHAIN_NAME=arm-linux-androideabi-4.6 ..
make
cd ../
xcopy /E /Y libs android\project\libs
cd android\project
call android update project -p . --name OTClient --target android-16
call ant debug
cd bin
adb install -r OTClient-debug.apk

View File

@@ -0,0 +1,21 @@
cd ..
mkdir build_android
cd build_android
cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Debug -DCMAKE_TOOLCHAIN_FILE=../android/android.toolchain.cmake -DANDROID_ABI=armeabi-v7a -DANDROID_NATIVE_API_LEVEL=android-16 -DANDROID_TOOLCHAIN_NAME=arm-linux-androideabi-4.6 ..
make
cd ../
ECHO D|xcopy /E /Y android\project\jni\libSDL2.so android\project\libs\armeabi-v7a
xcopy /E /Y libs\armeabi-v7a\libotclient.so android\project\jni
cd android\project
call android update project -p . --name OTClient --target android-16
call ndk-build.cmd all NDK_DEBUG=1
call ant clean
call ant debug
cd bin
adb install -r OTClient-debug.apk

View File

@@ -0,0 +1,36 @@
<?xml version="1.0"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.otclient.mobile" android:versionCode="1" android:versionName="1.0">
<application
android:debuggable="true"
android:label="@string/app_name"
android:icon="@drawable/ic_launcher"
android:hardwareAccelerated="true" >
<activity android:name="MainActivity"
android:label="@string/app_name"
android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
android:configChanges="orientation|keyboardHidden"
android:screenOrientation="landscape">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
<meta-data android:name="android.app.lib_name" android:value="otclient"/>
</activity>
</application>
<!-- Android 2.3.3 -->
<uses-sdk android:minSdkVersion="9" android:targetSdkVersion="16"/>
<!-- OpenGL ES 2.0 -->
<uses-feature android:glEsVersion="0x00020000"/>
<!-- Allow writing to external storage -->
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<!-- Allow make internet connections -->
<uses-permission android:name="android.permission.INTERNET" />
</manifest>

View File

@@ -0,0 +1,6 @@
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := libotclient
LOCAL_SRC_FILES := libotclient.so
include $(PREBUILT_SHARED_LIBRARY)

View File

@@ -0,0 +1,2 @@
APP_PLATFORM := android-9
APP_ABI := armeabi-v7a

Binary file not shown.

After

Width:  |  Height:  |  Size: 538 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 429 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 822 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

View File

@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">OTClient</string>
</resources>

View File

@@ -0,0 +1,52 @@
package com.otclient.mobile;
import android.view.KeyEvent;
import android.view.View;
import android.view.inputmethod.EditorInfo;
import android.view.inputmethod.InputConnection;
public class FakeEditText extends View implements View.OnKeyListener {
InputConnection ic;
public FakeEditText() {
super(MainActivity.getInstance());
setFocusableInTouchMode(true);
setFocusable(true);
setOnKeyListener(this);
}
@Override
public boolean onCheckIsTextEditor() {
return true;
}
@Override // This handles the hardware keyboard input
public boolean onKey(View v, int keyCode, KeyEvent event) {
if (event.isPrintingKey()) {
if (event.getAction() == KeyEvent.ACTION_DOWN) {
ic.commitText(String.valueOf((char) event.getUnicodeChar()), 1);
}
return true;
}
if (event.getAction() == KeyEvent.ACTION_DOWN) {
onNativeKeyDown(keyCode);
return true;
} else if (event.getAction() == KeyEvent.ACTION_UP) {
onNativeKeyUp(keyCode);
return true;
}
return false;
}
@Override
public InputConnection onCreateInputConnection(EditorInfo outAttrs) {
ic = new InputConnectionForNative(this, true);
return ic;
}
public static native void onNativeKeyDown(int keyCode);
public static native void onNativeKeyUp(int keyCode);
}

View File

@@ -0,0 +1,47 @@
package com.otclient.mobile;
import android.view.KeyEvent;
import android.view.View;
import android.view.inputmethod.BaseInputConnection;
public class InputConnectionForNative extends BaseInputConnection {
public InputConnectionForNative(View targetView, boolean fullEditor) {
super(targetView, fullEditor);
}
@Override // This handles the keycodes from soft keyboard
public boolean sendKeyEvent(KeyEvent event) {
int keyCode = event.getKeyCode();
if (event.getAction() == KeyEvent.ACTION_DOWN) {
if (event.isPrintingKey()) {
commitText(String.valueOf((char) event.getUnicodeChar()), 1);
}
FakeEditText.onNativeKeyDown(keyCode);
return true;
} else if (event.getAction() == KeyEvent.ACTION_UP) {
FakeEditText.onNativeKeyUp(keyCode);
return true;
}
return super.sendKeyEvent(event);
}
@Override // Typed text
public boolean commitText(CharSequence text, int newCursorPosition) {
nativeCommitText(text.toString(), newCursorPosition);
return super.commitText(text, newCursorPosition);
}
@Override // Workaround to capture backspace key
public boolean deleteSurroundingText(int beforeLength, int afterLength) {
if (beforeLength == 1 && afterLength == 0) {
return super.sendKeyEvent(new KeyEvent(KeyEvent.ACTION_DOWN, KeyEvent.KEYCODE_DEL))
&& super.sendKeyEvent(new KeyEvent(KeyEvent.ACTION_UP, KeyEvent.KEYCODE_DEL));
}
return super.deleteSurroundingText(beforeLength, afterLength);
}
public static native void nativeCommitText(String text, int newCursorPosition);
}

View File

@@ -0,0 +1,33 @@
package com.otclient.mobile;
import android.content.Context;
import android.view.View;
import android.view.inputmethod.InputMethodManager;
public class KeyboardSoftHandler{
private View editText;
public KeyboardSoftHandler() {
editText = new FakeEditText();
MainActivity.getInstance()
.addViewToLayout(editText);
}
public void showKeyboardSoft() {
editText.setVisibility(View.VISIBLE);
editText.requestFocus();
InputMethodManager imm = (InputMethodManager) MainActivity
.getInstance().getSystemService(Context.INPUT_METHOD_SERVICE);
imm.showSoftInput(editText, 0);
}
public void hideKeyboardSoft() {
editText.setVisibility(View.GONE);
InputMethodManager imm = (InputMethodManager) MainActivity
.getInstance().getSystemService(
Context.INPUT_METHOD_SERVICE);
imm.hideSoftInputFromWindow(editText.getWindowToken(), 0);
}
}

View File

@@ -0,0 +1,110 @@
package com.otclient.mobile;
import android.app.Activity;
import android.os.Bundle;
import android.util.Log;
import android.view.KeyEvent;
import android.view.View;
import android.widget.RelativeLayout;
import android.widget.RelativeLayout.LayoutParams;
public class MainActivity extends Activity {
public static final String APP_TAG = "OTClientMob";
private static MainActivity instance;
private RelativeLayout layout;
private static boolean started;
static {
started = false;
//android.os.Debug.waitForDebugger();
System.loadLibrary("otclient");
}
@Override
protected void onCreate(Bundle savedInstanceState) {
Log.v(APP_TAG, "onCreate()");
super.onCreate(savedInstanceState);
initialize();
}
private void initialize() {
instance = this;
layout = new RelativeLayout(this);
RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(
LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
layout.setLayoutParams(params);
setContentView(layout);
if( !started ) {
nativeInit();
started = true;
}
NativeFacadeCalls.initialize();
}
@Override
protected void onPause() {
Log.v(APP_TAG, "onPause()");
super.onPause();
nativePause();
}
@Override
protected void onResume() {
Log.v(APP_TAG, "onResume()");
super.onResume();
if( NativeFacadeCalls.isSurfaceReady() )
nativeResume();
}
@Override
protected void onDestroy() {
Log.v(APP_TAG, "onDestroy()");
super.onDestroy();
if(isFinishing()) {
NativeFacadeCalls.destroy();
destroy();
nativeDestroy();
}
}
private void destroy() {
instance = null;
layout = null;
}
@Override // Ignore certain special keys so they're handled by Android
public boolean dispatchKeyEvent(KeyEvent event) {
int keyCode = event.getKeyCode();
if (keyCode == KeyEvent.KEYCODE_VOLUME_DOWN ||
keyCode == KeyEvent.KEYCODE_VOLUME_UP ||
keyCode == KeyEvent.KEYCODE_CAMERA ||
keyCode == 168 || /* API 11: KeyEvent.KEYCODE_ZOOM_IN */
keyCode == 169 /* API 11: KeyEvent.KEYCODE_ZOOM_OUT */
) {
return false;
}
return super.dispatchKeyEvent(event);
}
public static MainActivity getInstance() {
return instance;
}
public void addViewToLayout(View view) {
layout.addView(view);
}
public native void nativeInit();
public native void nativePause();
public native void nativeResume();
public native void nativeDestroy();
}

View File

@@ -0,0 +1,45 @@
package com.otclient.mobile;
import android.os.Handler;
import android.os.Looper;
import android.view.Surface;
public class NativeFacadeCalls {
private static NativeSurfaceView nativeSurfaceView;
private static KeyboardSoftHandler keyboardSoftHandler;
private static Handler handler;
public static void initialize() {
handler = new Handler(Looper.getMainLooper());
keyboardSoftHandler = new KeyboardSoftHandler();
nativeSurfaceView = new NativeSurfaceView();
MainActivity.getInstance().addViewToLayout(nativeSurfaceView);
}
public static void destroy() {
handler = null;
nativeSurfaceView = null;
keyboardSoftHandler = null;
}
public static boolean isSurfaceReady() {
return nativeSurfaceView.isSurfaceReady();
}
/*
* Static methods called from JNI
*/
public static Surface getNativeSurface() {
return nativeSurfaceView.getSurface();
}
public static void showKeyboardSoft() {
handler.post(new Runnable() {
@Override
public void run() {
keyboardSoftHandler.showKeyboardSoft();
}
});
}
}

View File

@@ -0,0 +1,38 @@
package com.otclient.mobile;
public class NativeMainThread {
private static final NativeMainThread instance;
private Thread nativeThread;
static {
instance = new NativeMainThread();
}
private NativeMainThread() {}
public void start() {
if( nativeThread == null ) {
nativeThread = new Thread(
new NativeThread(), "NativeThread" );
nativeThread.start();
}
}
public static NativeMainThread getInstance() {
return instance;
}
/*
* Native methods implemented on C++
*/
public native void nativeStartApp();
private class NativeThread implements Runnable {
@Override
public void run() {
nativeStartApp();
}
}
}

View File

@@ -0,0 +1,130 @@
package com.otclient.mobile;
import android.util.Log;
import android.view.GestureDetector;
import android.view.KeyEvent;
import android.view.MotionEvent;
import android.view.Surface;
import android.view.SurfaceHolder;
import android.view.SurfaceView;
import android.view.View;
public class NativeSurfaceView extends SurfaceView implements
SurfaceHolder.Callback, View.OnTouchListener {
private Surface surface;
private GestureDetector gestureDetector;
private int currentWidth;
private int currentHeight;
private boolean surfaceReady;
private final int LONGPRESS_EVENT = 3;
public NativeSurfaceView() {
super(MainActivity.getInstance());
getHolder().addCallback(this);
setFocusable(true);
setFocusableInTouchMode(true);
requestFocus();
setOnTouchListener(this);
currentWidth = 0;
currentHeight = 0;
surfaceReady = false;
gestureDetector = new GestureDetector(
new GestureDetector.SimpleOnGestureListener() {
public void onLongPress(MotionEvent event) {
onNativeTouch(LONGPRESS_EVENT, event.getX(), event.getY());
}
});
}
@Override
public void surfaceCreated(SurfaceHolder holder) {
Log.d(MainActivity.APP_TAG, "surfaceCreated");
}
@Override
public void surfaceChanged(SurfaceHolder holder, int format, int width,
int height) {
Log.d(MainActivity.APP_TAG, "surfaceChanged");
surface = holder.getSurface();
currentWidth = width;
currentHeight = height;
surfaceReady = true;
onNativeResize(width, height);
onNativeSurfaceChanged();
NativeMainThread.getInstance().start();
}
@Override
public void surfaceDestroyed(SurfaceHolder holder) {
Log.d(MainActivity.APP_TAG, "surfaceDestroyed");
surface = null;
surfaceReady = false;
onNativeSurfaceDestroyed();
}
@Override
public boolean onTouch(View view, MotionEvent event) {
gestureDetector.onTouchEvent(event);
/* Ref: http://developer.android.com/training/gestures/multi.html */
final int pointerCount = event.getPointerCount();
int action = event.getActionMasked();
int i = -1;
float x,y;
switch(action) {
case MotionEvent.ACTION_MOVE:
for (i = 0; i < pointerCount; i++) {
x = event.getX(i);
y = event.getY(i);
onNativeTouch(action, x, y);
}
break;
case MotionEvent.ACTION_UP:
case MotionEvent.ACTION_DOWN:
// Primary pointer up/down, the index is always zero
i = 0;
case MotionEvent.ACTION_POINTER_UP:
case MotionEvent.ACTION_POINTER_DOWN:
// Non primary pointer up/down
if (i == -1) {
i = event.getActionIndex();
}
x = event.getX(i);
y = event.getY(i);
onNativeTouch(action, x, y);
break;
default:
break;
}
return true;
}
public Surface getSurface() {
return surface;
}
public boolean isSurfaceReady() {
return surfaceReady;
}
/*
* Native methods implemented on C++
*/
public native void onNativeSurfaceChanged();
public native void onNativeSurfaceDestroyed();
public native void onNativeResize(int width, int height);
public native void onNativeTouch(int actionType, float x, float y);
}

View File

@@ -21,68 +21,62 @@
*/
#include "client.h"
#include <framework/core/modulemanager.h>
#include <framework/core/resourcemanager.h>
#include <framework/graphics/graphics.h>
#include "game.h"
#include "map.h"
#include "shadermanager.h"
#include "spritemanager.h"
#include "minimap.h"
#include <framework/luaengine/luainterface.h>
#include <framework/core/application.h>
#include <framework/core/modulemanager.h>
#include <framework/core/resourcemanager.h>
#include <framework/core/configmanager.h>
#include <framework/graphics/graphics.h>
Client g_client;
Client::Client(int argc, char* argv[]) {
std::vector<std::string> args(argv, argv + argc);
initAppFrameworkAndOTClient(args);
}
void Client::init(std::vector<std::string>& args)
void Client::initAppFrameworkAndOTClient(std::vector<std::string>& args)
{
// register needed lua functions
registerLuaFunctions();
setupAppNameAndVersion();
g_app.init(args);
g_map.init();
g_minimap.init();
g_game.init();
g_shaders.init();
g_things.init();
//TODO: restore options
/*
if(g_graphics.parseOption(arg))
continue;
registerLuaFunctions();
findLuaInitScript();
if(arg == "-version" || arg == "--version" || arg == "-v") {
stdext::print(
m_appName, " ", m_appVersion, "\n"
"Buitt on: ", BUILD_DATE, "\n",
"Commit: ", BUILD_COMMIT, "\n",
"Compiled by: ", BUILD_COMPILER, "\n",
"Build type: ", BUILD_TYPE, "\n");
return;
} else if(arg == "-help" || arg == "--help" || arg == "-h" || arg == "-?" || arg == "/?") {
stdext::print(
"Usage: ", args[0], " [options]\n"
"Options:\n"
" -help Display this information and exit\n"
" -version Display version and exit\n"
" \n"
" -no-fbos Disable usage of opengl framebuffer objects\n"
" -no-mipmaps Disable texture mipmaping\n"
" -no-smooth Disable texture smoothing (bilinear filter)\n"
" -no-non-power-of-two-textures Use only power of two textures\n"
" -no-clamp-to-edge Don't use GL_CLAMP_TO_EDGE\n"
" -no-backbuffer-cache Don't allow backbuffer caching\n"
" -hardware-buffers Cache vertex arrays in hardware\n"
" -opengl1 Use OpenGL 1.x painter\n"
" -opengl2 Use OpenGL 2.0 painter\n");
return;
} else {
stdext::println("Unrecognized option '", arg, "', please see -help for available options list");
return;
}
*/
g_app.runAppMainLoop();
}
void Client::terminate()
void Client::setupAppNameAndVersion() {
g_app.setName("OTClient");
g_app.setCompactName("otclient");
g_app.setVersion(VERSION);
}
void Client::findLuaInitScript() {
if(!g_resources.discoverWorkDir("init.lua"))
g_logger.fatal("Unable to find work directory, the application cannot be initialized.");
runLuaInitScript();
}
void Client::runLuaInitScript() {
if(!g_lua.safeRunScript("init.lua"))
g_logger.fatal("Unable to run script init.lua!");
}
void Client::terminateAndFreeMemory()
{
g_app.unloadModules();
g_creatures.terminate();
g_game.terminate();
g_map.terminate();
@@ -90,4 +84,5 @@ void Client::terminate()
g_things.terminate();
g_sprites.terminate();
g_shaders.terminate();
g_app.terminate();
}

View File

@@ -27,12 +27,14 @@
class Client
{
public:
void init(std::vector<std::string>& args);
void terminate();
void initAppFrameworkAndOTClient(std::vector<std::string>& args);
void setupAppNameAndVersion();
void findLuaInitScript();
void runLuaInitScript();
void registerLuaFunctions();
public:
Client(int argc, char* argv[]);
void terminateAndFreeMemory();
};
extern Client g_client;
#endif

View File

@@ -132,6 +132,10 @@ set(framework_SOURCES ${framework_SOURCES}
${CMAKE_CURRENT_LIST_DIR}/platform/unixplatform.cpp
${CMAKE_CURRENT_LIST_DIR}/platform/platform.cpp
${CMAKE_CURRENT_LIST_DIR}/platform/platform.h
# mobile
${CMAKE_CURRENT_LIST_DIR}/platform/mobilefacade.cpp
${CMAKE_CURRENT_LIST_DIR}/platform/mobilefacade.h
)
set_source_files_properties(${CMAKE_CURRENT_LIST_DIR}/luafunctions.cpp
@@ -140,7 +144,11 @@ set_source_files_properties(${CMAKE_CURRENT_LIST_DIR}/luafunctions.cpp
# some build options
option(LUAJIT "Use lua jit" OFF)
if(NOT APPLE)
if(ANDROID)
set(CRASH_HANDLER OFF)
else()
option(CRASH_HANDLER "Generate crash reports" ON)
endif()
option(USE_STATIC_LIBS "Don't use shared libraries (dlls)" ON)
option(USE_LIBCPP "Use the new libc++ library instead of stdc++" OFF)
option(USE_LTO "Use link time optimizations" OFF)
@@ -226,6 +234,10 @@ find_package(PhysFS REQUIRED)
find_package(OpenSSL REQUIRED)
find_package(ZLIB REQUIRED)
if(ANDROID)
set(framework_LIBRARIES ${framework_LIBRARIES} android log)
endif()
set(framework_LIBRARIES ${framework_LIBRARIES}
${Boost_LIBRARIES}
${LUA_LIBRARY}
@@ -242,6 +254,11 @@ set(framework_INCLUDE_DIRS ${framework_INCLUDE_DIRS}
${framework_INCLUDE_DIRS}
)
if(ANDROID)
set(framework_LIBRARIES ${framework_LIBRARIES})
set(framework_INCLUDE_DIRS ${framework_INCLUDE_DIRS})
endif()
if(CMAKE_BUILD_TYPE STREQUAL "Debug" OR CMAKE_BUILD_TYPE STREQUAL "RelWithDebInfo")
message(STATUS "Debug information: ON")
else()
@@ -281,9 +298,13 @@ else()
else()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pthread")
set(CMAKE_CXX_LINK_FLAGS "${CMAKE_CXX_LINK_FLAGS} -rdynamic -Wl,-rpath,./libs") # rdynamic is needed by backtrace.h used in crash handler
if(ANDROID)
set(SYSTEM_LIBRARIES dl)
else()
set(SYSTEM_LIBRARIES dl rt)
endif()
endif()
endif()
set(framework_LIBRARIES ${framework_LIBRARIES} ${SYSTEM_LIBRARIES})
if(FRAMEWORK_THREAD_SAFE)
@@ -292,13 +313,13 @@ endif()
if(FRAMEWORK_GRAPHICS)
set(OPENGLES "OFF" CACHE "Use OpenGL ES 1.0 or 2.0 (for mobiles devices)" STRING)
if(OPENGLES STREQUAL "2.0")
if(OPENGLES STREQUAL "2.0" OR (ANDROID_NATIVE_API_LEVEL AND ANDROID_NATIVE_API_LEVEL VERSION_GREATER 7))
find_package(OpenGLES2 REQUIRED)
find_package(EGL REQUIRED)
set(framework_DEFINITIONS ${framework_DEFINITIONS} -DOPENGL_ES=2)
set(framework_INCLUDE_DIRS ${framework_INCLUDE_DIRS} ${EGL_INCLUDE_DIR} ${OPENGLES2_INCLUDE_DIR})
set(framework_LIBRARIES ${framework_LIBRARIES} ${EGL_LIBRARY} ${OPENGLES2_LIBRARY})
ELSEif(OPENGLES STREQUAL "1.0")
ELSEif(OPENGLES STREQUAL "1.0" OR (ANDROID_NATIVE_API_LEVEL AND ANDROID_NATIVE_API_LEVEL VERSION_LESS 8))
find_package(OpenGLES1 REQUIRED)
find_package(EGL REQUIRED)
set(framework_DEFINITIONS ${framework_DEFINITIONS} -DOPENGL_ES=1)
@@ -341,7 +362,7 @@ if(FRAMEWORK_GRAPHICS)
)
endif()
else()
elseif(NOT ANDROID)
set(framework_LIBRARIES ${framework_LIBRARIES} X11)
endif()
@@ -441,6 +462,8 @@ if(FRAMEWORK_GRAPHICS)
${CMAKE_CURRENT_LIST_DIR}/platform/win32window.h
${CMAKE_CURRENT_LIST_DIR}/platform/x11window.cpp
${CMAKE_CURRENT_LIST_DIR}/platform/x11window.h
${CMAKE_CURRENT_LIST_DIR}/platform/androidwindow.cpp
${CMAKE_CURRENT_LIST_DIR}/platform/androidwindow.h
# window input
${CMAKE_CURRENT_LIST_DIR}/input/mouse.cpp

View File

@@ -0,0 +1,12 @@
# Try to find the SDL2 library
# SDL2_FOUND - system has SDL2
# SDL2_INCLUDE_DIR - the SDL2 include directory
# SDL2_LIBRARY - the SDL2 library
FIND_PATH(SDL2_INCLUDE_DIR NAMES SDL.h PATH_SUFFIXES sdl2)
SET(_SDL2_STATIC_LIBS libSDL2.a)
SET(_SDL2_SHARED_LIBS libSDL2.so SDL2)
FIND_LIBRARY(SDL2_LIBRARY NAMES ${_SDL2_SHARED_LIBS} ${_SDL2_STATIC_LIBS})
INCLUDE(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(SDL2 DEFAULT_MSG SDL2_LIBRARY SDL2_INCLUDE_DIR)
MARK_AS_ADVANCED(SDL2_LIBRARY SDL2_INCLUDE_DIR)

View File

@@ -45,6 +45,8 @@
#define BUILD_ARCH "x64"
#elif defined(__i386) || defined(_M_IX86) || defined(_X86_)
#define BUILD_ARCH "x86"
#elif defined(__arm__)
#define BUILD_ARCH "ARM"
#else
#define BUILD_ARCH "unknown"
#endif

View File

@@ -101,7 +101,7 @@ void Application::init(std::vector<std::string>& args)
registerLuaFunctions();
}
void Application::deinit()
void Application::unloadModules()
{
g_lua.callGlobalField("g_app", "onTerminate");
@@ -177,6 +177,8 @@ std::string Application::getOs()
return "mac";
#elif __linux
return "linux";
#elif ANDROID
return "android";
#else
return "unknown";
#endif

View File

@@ -34,9 +34,9 @@ public:
virtual ~Application() {}
virtual void init(std::vector<std::string>& args);
virtual void deinit();
virtual void unloadModules();
virtual void terminate();
virtual void run() = 0;
virtual void runAppMainLoop() = 0;
virtual void poll();
virtual void exit();
virtual void close();

View File

@@ -31,7 +31,7 @@
ConsoleApplication g_app;
void ConsoleApplication::run()
void ConsoleApplication::runAppMainLoop()
{
m_running = true;

View File

@@ -29,7 +29,7 @@
class ConsoleApplication : public Application
{
public:
void run();
void runAppMainLoop();
int getFps() { return m_frameCounter.getLastFps(); }

View File

@@ -66,12 +66,12 @@ void GraphicalApplication::init(std::vector<std::string>& args)
#endif
}
void GraphicalApplication::deinit()
void GraphicalApplication::unloadModules()
{
// hide the window because there is no render anymore
g_window.hide();
Application::deinit();
Application::unloadModules();
}
void GraphicalApplication::terminate()
@@ -101,7 +101,7 @@ void GraphicalApplication::terminate()
m_terminated = true;
}
void GraphicalApplication::run()
void GraphicalApplication::runAppMainLoop()
{
m_running = true;

View File

@@ -36,9 +36,9 @@ class GraphicalApplication : public Application
public:
void init(std::vector<std::string>& args);
void deinit();
void unloadModules();
void terminate();
void run();
void runAppMainLoop();
void poll();
void close();

View File

@@ -32,6 +32,10 @@
#include <framework/luaengine/luainterface.h>
#endif
#ifdef ANDROID
#include <android/log.h>
#endif // ANDROID
Logger g_logger;
void Logger::log(Fw::LogLevel level, const std::string& message)
@@ -66,6 +70,9 @@ void Logger::log(Fw::LogLevel level, const std::string& message)
outmsg = tmp.str();
#endif
*/
#ifdef ANDROID
__android_log_print(ANDROID_LOG_INFO, "OTClientMobile", outmsg.c_str());
#endif // ANDROID
std::cout << outmsg << std::endl;

View File

@@ -48,7 +48,8 @@ bool ResourceManager::discoverWorkDir(const std::string& existentFile)
std::string possiblePaths[] = { g_platform.getCurrentDir(),
g_resources.getBaseDir(),
g_resources.getBaseDir() + "../",
g_resources.getBaseDir() + "../share/" + g_app.getCompactName() + "/" };
g_resources.getBaseDir() + "../share/" + g_app.getCompactName() + "/",
"/sdcard/OTClient/" };
bool found = false;
for(const std::string& dir : possiblePaths) {
@@ -71,12 +72,20 @@ bool ResourceManager::setupUserWriteDir(const std::string& appWriteDirName)
{
std::string userDir = getUserDir();
std::string dirName;
#ifndef WIN32
dirName = stdext::format(".%s", appWriteDirName);
#else
dirName = appWriteDirName;
#endif
std::string writeDir = userDir + dirName;
std::string writeDir;
#ifdef ANDROID
writeDir = getWorkDir();
#else
writeDir = userDir + dirName;
#endif
if(!PHYSFS_setWriteDir(writeDir.c_str())) {
if(!PHYSFS_setWriteDir(userDir.c_str()) || !PHYSFS_mkdir(dirName.c_str())) {

View File

@@ -44,4 +44,8 @@
// logger
#include "core/logger.h"
#ifdef ANDROID
#include "platform/mobilefacade.h"
#endif
#endif

View File

@@ -35,7 +35,7 @@
#if defined(_MSC_VER) && _MSC_VER >= 1300
#define swap16(data) _byteswap_ushort(data)
#define swap32(data) _byteswap_ulong(data)
#elif __linux__
#elif __linux__ && !defined ANDROID
#include <byteswap.h>
#define swap16(data) bswap_16(data)
#define swap32(data) bswap_32(data)

View File

@@ -0,0 +1,506 @@
/*
* Copyright (c) 2010-2014 OTClient <https://github.com/edubart/otclient>
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
#ifdef ANDROID
#include "androidwindow.h"
AndroidWindow::AndroidWindow() {
m_minimumSize = Size(600, 480);
m_size = Size(600, 480);
m_window = 0;
m_keyMap[AndroidWindow::KEY_ENTER] = Fw::KeyEnter;
m_keyMap[AndroidWindow::KEY_BACKSPACE] = Fw::KeyBackspace;
}
AndroidWindow::~AndroidWindow() {
JNIEnv* env = getJNIEnv();
env->DeleteGlobalRef(m_nativeFacadeCalls);
internalDestroyGLContext();
}
AndroidWindow::KeyCode AndroidWindow::NativeEvent::getKeyCodeFromInt(int keyCode) {
switch (keyCode) {
case 66:
return KEY_ENTER;
case 67:
return KEY_BACKSPACE;
default:
return KEY_UNDEFINED;
}
}
AndroidWindow::EventType AndroidWindow::NativeEvent::getEventTypeFromInt(int actionType) {
switch (actionType) {
case 0:
return TOUCH_DOWN;
case 1:
return TOUCH_UP;
case 2:
return TOUCH_MOTION;
case 3:
return TOUCH_LONGPRESS;
default:
return EVENT_UNDEFINED;
}
}
JNIEnv* AndroidWindow::getJNIEnv() {
JNIEnv *env;
if (m_javaVM->AttachCurrentThread(&env, NULL) < 0) {
g_logger.fatal("failed to attach current thread");
return 0;
}
return env;
}
std::string AndroidWindow::getStringFromJString( jstring text ) {
JNIEnv* env = getJNIEnv();
const char* newChar = env->GetStringUTFChars(text,NULL);
std::string newText = newChar;
env->ReleaseStringUTFChars(text, newChar);
return newText;
}
void AndroidWindow::getJavaSurfaceAndSet() {
jobject nativeWindowObject;
JNIEnv* env = getJNIEnv();
nativeWindowObject = env->CallStaticObjectMethod(m_nativeFacadeCalls, m_midGetNativeSurface);
m_window = ANativeWindow_fromSurface(env, nativeWindowObject);
env->DeleteLocalRef(nativeWindowObject);
}
void AndroidWindow::internalInitGL() {
internalCheckGL();
internalChooseGL();
internalConnectGLContext();
internalCreateGLContext();
}
void AndroidWindow::internalCheckGL() {
m_eglDisplay = eglGetDisplay(EGL_DEFAULT_DISPLAY);
if(m_eglDisplay == EGL_NO_DISPLAY)
g_logger.fatal("EGL not supported");
if(!eglInitialize(m_eglDisplay, NULL, NULL))
g_logger.fatal("Unable to initialize EGL");
}
void AndroidWindow::internalChooseGL() {
static int attrList[] = {
#if OPENGL_ES==2
EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT,
#else
EGL_RENDERABLE_TYPE, EGL_OPENGL_ES_BIT,
#endif
EGL_RED_SIZE, 4,
EGL_GREEN_SIZE, 4,
EGL_BLUE_SIZE, 4,
EGL_ALPHA_SIZE, 4,
EGL_NONE
};
EGLint numConfig;
if(!eglChooseConfig(m_eglDisplay, attrList, &m_eglConfig, 1, &numConfig))
g_logger.fatal("Failed to choose EGL config");
if(numConfig != 1)
g_logger.warning("Didn't got the exact EGL config");
EGLint vid;
if(!eglGetConfigAttrib(m_eglDisplay, m_eglConfig, EGL_NATIVE_VISUAL_ID, &vid))
g_logger.fatal("Unable to get visual EGL visual id");
ANativeWindow_setBuffersGeometry(m_window, 0, 0, vid);
}
void AndroidWindow::internalCreateGLContext() {
EGLint attrList[] = {
#if OPENGL_ES==2
EGL_CONTEXT_CLIENT_VERSION, 2,
#else
EGL_CONTEXT_CLIENT_VERSION, 1,
#endif
EGL_NONE
};
m_eglContext = eglCreateContext(m_eglDisplay, m_eglConfig, EGL_NO_CONTEXT, attrList);
if(m_eglContext == EGL_NO_CONTEXT )
g_logger.fatal(stdext::format("Unable to create EGL context: %s", eglGetError()));
if (!eglMakeCurrent(m_eglDisplay, m_eglSurface, m_eglSurface, m_eglContext))
g_logger.fatal("Unable to connect EGL context into Android native window");
}
void AndroidWindow::internalDestroyGLContext() {
if (m_window == NULL)
return;
if(m_eglDisplay) {
eglMakeCurrent(m_eglDisplay, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
if (m_eglSurface) {
eglDestroySurface(m_eglDisplay, m_eglSurface);
m_eglSurface = EGL_NO_SURFACE;
}
if(m_eglContext) {
eglDestroyContext(m_eglDisplay, m_eglContext);
m_eglContext = EGL_NO_CONTEXT;
}
eglTerminate(m_eglDisplay);
m_eglDisplay = EGL_NO_DISPLAY;
}
}
void AndroidWindow::internalConnectGLContext() {
m_eglSurface = eglCreateWindowSurface(m_eglDisplay, m_eglConfig, m_window, NULL);
if(m_eglSurface == EGL_NO_SURFACE)
g_logger.fatal(stdext::format("Unable to create EGL surface: %s", eglGetError()));
}
void AndroidWindow::terminate() {
nativePause();
}
void AndroidWindow::poll() {
handleNativeEvents();
while( !m_events.empty() ) {
m_currentEvent = m_events.front();
processKeyDownOrKeyUp();
switch( m_currentEvent.type ) {
case TEXTINPUT:
processTextInput();
break;
case TOUCH_DOWN:
case TOUCH_LONGPRESS:
case TOUCH_UP:
processFingerdownAndFingerup();
break;
case TOUCH_MOTION:
processFingermotion();
}
m_events.pop();
}
fireKeysPress();
}
void AndroidWindow::processKeyDownOrKeyUp() {
if(m_currentEvent.type == KEY_DOWN || m_currentEvent.type == KEY_UP) {
Fw::Key keyCode = Fw::KeyUnknown;
KeyCode key = m_currentEvent.keyCode;
if(m_keyMap.find(key) != m_keyMap.end())
keyCode = m_keyMap[key];
if(m_currentEvent.type == KEY_DOWN)
processKeyDown(keyCode);
else if(m_currentEvent.type == KEY_UP)
processKeyUp(keyCode);
}
}
void AndroidWindow::processTextInput() {
std::string text = m_currentEvent.text;
KeyCode keyCode = m_currentEvent.keyCode;
if(text.length() == 0 || keyCode == KEY_ENTER || keyCode == KEY_BACKSPACE)
return;
if(m_onInputEvent) {
m_inputEvent.reset(Fw::KeyTextInputEvent);
m_inputEvent.keyText = text;
m_onInputEvent(m_inputEvent);
}
}
void AndroidWindow::processFingerdownAndFingerup() {
bool isTouchdown = m_currentEvent.type == TOUCH_DOWN;
Fw::MouseButton mouseButton = (m_currentEvent.type == TOUCH_LONGPRESS) ?
Fw::MouseRightButton : Fw::MouseLeftButton;
m_inputEvent.reset();
m_inputEvent.type = (isTouchdown) ? Fw::MousePressInputEvent : Fw::MouseReleaseInputEvent;
m_inputEvent.mouseButton = Fw::MouseLeftButton;
m_mouseButtonStates[mouseButton] = isTouchdown;
Point newMousePos(m_currentEvent.x, m_currentEvent.y);
m_inputEvent.mouseMoved = newMousePos - m_inputEvent.mousePos;
m_inputEvent.mousePos = newMousePos;
if(m_onInputEvent)
m_onInputEvent(m_inputEvent);
}
void AndroidWindow::processFingermotion() {
m_inputEvent.reset();
m_inputEvent.type = Fw::MouseMoveInputEvent;
Point newMousePos(m_currentEvent.x, m_currentEvent.y);
m_inputEvent.mouseMoved = newMousePos - m_inputEvent.mousePos;
m_inputEvent.mousePos = newMousePos;
if (m_onInputEvent)
m_onInputEvent(m_inputEvent);
}
void AndroidWindow::swapBuffers() {
eglSwapBuffers(m_eglDisplay, m_eglSurface);
}
void AndroidWindow::setVerticalSync(bool enable) {
eglSwapInterval(m_eglDisplay, enable ? 1 : 0);
}
std::string AndroidWindow::getClipboardText() {
// TODO
return "";
}
void AndroidWindow::setClipboardText(const std::string& text) {
// TODO
}
Size AndroidWindow::getDisplaySize() {
return m_size;
}
std::string AndroidWindow::getPlatformType() {
return "ANDROID-EGL";
}
void AndroidWindow::init() {
internalInitGL();
nativeResume();
}
void AndroidWindow::show() {}
void AndroidWindow::hide() {}
void AndroidWindow::maximize() {}
void AndroidWindow::move(const Point& pos) {}
void AndroidWindow::resize(const Size& size) {}
void AndroidWindow::showMouse() {}
void AndroidWindow::hideMouse() {}
int AndroidWindow::internalLoadMouseCursor(const ImagePtr& image, const Point& hotSpot) {
return 0;
}
void AndroidWindow::setMouseCursor(int cursorId) {}
void AndroidWindow::restoreMouseCursor() {}
void AndroidWindow::setTitle(const std::string& title) {}
void AndroidWindow::setMinimumSize(const Size& minimumSize) {}
void AndroidWindow::setFullscreen(bool fullscreen) {}
void AndroidWindow::setIcon(const std::string& iconFile) {}
void AndroidWindow::initializeJNI(JNIEnv* env) {
env->GetJavaVM(&m_javaVM);
env = getJNIEnv();
jclass temp = m_nativeFacadeCalls = env->FindClass(
"com/otclient/mobile/NativeFacadeCalls");
m_nativeFacadeCalls = (jclass)env->NewGlobalRef(temp);
m_midGetNativeSurface = env->GetStaticMethodID(m_nativeFacadeCalls,
"getNativeSurface", "()Landroid/view/Surface;");
m_midShowKeyboardSoft = env->GetStaticMethodID(m_nativeFacadeCalls,
"showKeyboardSoft", "()V");
}
void AndroidWindow::nativePause() {
m_visible = false;
}
void AndroidWindow::nativeResume() {
m_visible = true;
}
void AndroidWindow::nativeDestroy() {
m_messages.push(APP_TERMINATE);
}
void AndroidWindow::onNativeResize(int width, int height) {
m_size = Size(width, height);
}
void AndroidWindow::nativeCommitText(jstring jString) {
std::string text = getStringFromJString(jString);
m_events.push(NativeEvent(TEXTINPUT, text));
}
void AndroidWindow::onNativeSurfaceChanged() {
if( m_eglSurface == EGL_NO_SURFACE ) {
if( m_window )
ANativeWindow_release(m_window);
getJavaSurfaceAndSet();
m_messages.push(RECREATE_CONTEXT);
nativeResume();
}
}
void AndroidWindow::onNativeSurfaceDestroyed() {
internalDestroyGLContext();
}
void AndroidWindow::onNativeTouch(int actionType,
float x, float y) {
EventType type = NativeEvent::getEventTypeFromInt(actionType);
m_events.push(NativeEvent(type, x, y));
}
void AndroidWindow::onNativeKeyDown( int keyCode ) {
KeyCode key = NativeEvent::getKeyCodeFromInt(keyCode);
m_events.push(NativeEvent(KEY_DOWN, key));
}
void AndroidWindow::onNativeKeyUp( int keyCode ) {
KeyCode key = NativeEvent::getKeyCodeFromInt(keyCode);
m_events.push(NativeEvent(KEY_UP, key));
}
// these events need to be processed on native thread.
void AndroidWindow::handleNativeEvents() {
NativeMessage nativeMessage;
while (!m_messages.empty()) {
nativeMessage = m_messages.front();
switch (nativeMessage) {
case RECREATE_CONTEXT:
if(!m_eglContext)
internalInitGL();
break;
case APP_TERMINATE:
raise(SIGTERM);
break;
}
m_messages.pop();
}
}
void AndroidWindow::showKeyboardSoft() {
JNIEnv* env = getJNIEnv();
env->CallStaticVoidMethod(m_nativeFacadeCalls, m_midShowKeyboardSoft);
}
/*
* Java JNI functions
*/
void Java_com_otclient_mobile_MainActivity_nativeInit(
JNIEnv* env, jobject obj) {
((AndroidWindow&)g_window).initializeJNI(env);
}
void Java_com_otclient_mobile_MainActivity_nativePause(
JNIEnv* env, jobject obj) {
((AndroidWindow&)g_window).nativePause();
}
void Java_com_otclient_mobile_MainActivity_nativeResume(
JNIEnv* env, jobject obj) {
((AndroidWindow&)g_window).nativeResume();
}
void Java_com_otclient_mobile_MainActivity_nativeDestroy(
JNIEnv* env, jobject obj) {
((AndroidWindow&)g_window).nativeDestroy();
}
void Java_com_otclient_mobile_NativeSurfaceView_onNativeResize(
JNIEnv*, jobject, jint width, jint height) {
((AndroidWindow&)g_window).onNativeResize(width, height);
}
void Java_com_otclient_mobile_NativeSurfaceView_onNativeSurfaceChanged(
JNIEnv* env, jobject obj) {
((AndroidWindow&) g_window).onNativeSurfaceChanged();
}
void Java_com_otclient_mobile_NativeSurfaceView_onNativeSurfaceDestroyed(
JNIEnv* env, jobject obj) {
((AndroidWindow&)g_window).onNativeSurfaceDestroyed();
}
void Java_com_otclient_mobile_NativeSurfaceView_onNativeTouch(
JNIEnv* env, jobject obj, jint actionType, jfloat x, jfloat y) {
((AndroidWindow&) g_window).onNativeTouch(actionType, x, y);
}
void Java_com_otclient_mobile_InputConnectionForNative_nativeCommitText(
JNIEnv* env, jobject obj, jstring text ) {
((AndroidWindow&) g_window).nativeCommitText(text);
}
void Java_com_otclient_mobile_FakeEditText_onNativeKeyDown(
JNIEnv* env, jobject obj, jint keyCode ) {
((AndroidWindow&) g_window).onNativeKeyDown(keyCode);
}
void Java_com_otclient_mobile_FakeEditText_onNativeKeyUp(
JNIEnv* env, jobject obj, jint keyCode ) {
((AndroidWindow&) g_window).onNativeKeyUp(keyCode);
}
void Java_com_otclient_mobile_NativeMainThread_nativeStartApp(
JNIEnv*, jobject ) {
char *argv[2];
argv[0] = strdup("OTClient");
argv[1] = NULL;
main(1, argv);
}
#endif // ANDROID

View File

@@ -0,0 +1,201 @@
/*
* Copyright (c) 2010-2014 OTClient <https://github.com/edubart/otclient>
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
#ifndef ANDROIDWINDOW_H
#define ANDROIDWINDOW_H
#include "platformwindow.h"
#include <android/native_window.h>
#include <android/native_window_jni.h>
#include <jni.h>
#include <EGL/egl.h>
#include <queue>
class AndroidWindow : public PlatformWindow
{
enum KeyCode {
KEY_UNDEFINED,
KEY_BACKSPACE = 66,
KEY_ENTER = 67
};
enum EventType {
TOUCH_DOWN,
TOUCH_UP,
TOUCH_MOTION,
TOUCH_LONGPRESS,
KEY_DOWN,
KEY_UP,
TEXTINPUT,
EVENT_UNDEFINED
};
enum NativeMessage {
RECREATE_CONTEXT,
APP_TERMINATE
};
struct NativeEvent {
NativeEvent() {}
NativeEvent(EventType type, float x, float y) :
type(type), text(""), keyCode(KEY_UNDEFINED), x(x), y(y) {}
NativeEvent(EventType type, std::string text) :
type(type), text(text), keyCode(KEY_UNDEFINED), x(0), y(0) {}
NativeEvent(EventType type, KeyCode keyCode) :
type(type), text(""), keyCode(keyCode), x(0), y(0) {}
static KeyCode getKeyCodeFromInt(int);
static EventType getEventTypeFromInt(int);
EventType type;
std::string text;
KeyCode keyCode;
float x;
float y;
};
void internalInitGL();
void internalCheckGL();
void internalChooseGL();
void internalCreateGLContext();
void internalDestroyGLContext();
void internalConnectGLContext();
void processKeyDownOrKeyUp();
void processTextInput();
void processFingerdownAndFingerup();
void processFingermotion();
void handleNativeEvents();
JNIEnv* getJNIEnv();
std::string getStringFromJString( jstring );
// JNI Java calls
void getJavaSurfaceAndSet();
public:
AndroidWindow();
~AndroidWindow();
void init();
void terminate();
void move(const Point& pos);
void resize(const Size& size);
void show();
void hide();
void maximize();
void poll();
void swapBuffers();
void showMouse();
void hideMouse();
void setMouseCursor(int cursorId);
void restoreMouseCursor();
void setTitle(const std::string& title);
void setMinimumSize(const Size& minimumSize);
void setFullscreen(bool fullscreen);
void setVerticalSync(bool enable);
void setIcon(const std::string& iconFile);
void setClipboardText(const std::string& text);
Size getDisplaySize();
std::string getClipboardText();
std::string getPlatformType();
void initializeJNI(JNIEnv*);
void nativePause();
void nativeResume();
void nativeDestroy();
void onNativeResize(int, int);
void onNativeSurfaceChanged();
void onNativeSurfaceDestroyed();
void onNativeTouch(int actionType, float x, float y);
void nativeCommitText(jstring);
void onNativeKeyDown(int);
void onNativeKeyUp(int);
void showKeyboardSoft();
protected:
int internalLoadMouseCursor(const ImagePtr& image, const Point& hotSpot);
private:
JavaVM* m_javaVM;
ANativeWindow* m_window;
jclass m_nativeFacadeCalls;
jmethodID m_midGetNativeSurface;
jmethodID m_midShowKeyboardSoft;
EGLConfig m_eglConfig;
EGLContext m_eglContext;
EGLDisplay m_eglDisplay;
EGLSurface m_eglSurface;
std::queue<NativeEvent> m_events;
std::queue<NativeMessage> m_messages;
NativeEvent m_currentEvent;
};
extern "C" {
void Java_com_otclient_mobile_NativeMainThread_nativeStartApp(
JNIEnv*, jobject);
void Java_com_otclient_mobile_MainActivity_nativeInit(
JNIEnv*, jobject);
void Java_com_otclient_mobile_MainActivity_nativeResume(
JNIEnv*, jobject);
void Java_com_otclient_mobile_MainActivity_nativePause(
JNIEnv*, jobject);
void Java_com_otclient_mobile_MainActivity_nativeDestroy(
JNIEnv*, jobject);
void Java_com_otclient_mobile_NativeSurfaceView_onNativeResize(
JNIEnv*, jobject, jint, jint);
void Java_com_otclient_mobile_NativeSurfaceView_onNativeSurfaceChanged(
JNIEnv*, jobject);
void Java_com_otclient_mobile_NativeSurfaceView_onNativeSurfaceDestroyed(
JNIEnv*, jobject);
void Java_com_otclient_mobile_NativeSurfaceView_onNativeTouch(
JNIEnv* env, jobject obj, jint actionType, jfloat x, jfloat y);
void Java_com_otclient_mobile_InputConnectionForNative_nativeCommitText(
JNIEnv*, jobject, jstring );
void Java_com_otclient_mobile_FakeEditText_onNativeKeyDown(
JNIEnv*, jobject, jint );
void Java_com_otclient_mobile_FakeEditText_onNativeKeyUp(
JNIEnv*, jobject, jint );
int main(int, char* argv[]);
}
#endif

View File

@@ -0,0 +1,33 @@
/*
* Copyright (c) 2010-2014 OTClient <https://github.com/edubart/otclient>
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
#ifdef ANDROID
#include "mobilefacade.h"
#include "androidwindow.h"
MobileFacade g_mobileFacade;
void MobileFacade::showKeyboardSoft() {
((AndroidWindow&) g_window).showKeyboardSoft();
}
#endif

View File

@@ -0,0 +1,33 @@
/*
* Copyright (c) 2010-2014 OTClient <https://github.com/edubart/otclient>
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
#ifndef MOBILEFACADE_H
#define MOBILEFACADE_H
class MobileFacade {
public:
void showKeyboardSoft();
};
extern MobileFacade g_mobileFacade;
#endif

View File

@@ -25,6 +25,9 @@
#ifdef WIN32
#include "win32window.h"
WIN32Window window;
#elif defined ANDROID
#include "androidwindow.h"
AndroidWindow window;
#else
#include "x11window.h"
#include <framework/core/clock.h>

View File

@@ -20,7 +20,7 @@
* THE SOFTWARE.
*/
#if !defined(WIN32) && defined(CRASH_HANDLER)
#if !defined(WIN32) && !defined(ANDROID) && defined(CRASH_HANDLER)
#include "crashhandler.h"
#include <framework/global.h>

View File

@@ -29,7 +29,12 @@
#include <framework/stdext/stdext.h>
#include <sys/stat.h>
#ifdef ANDROID
#include <errno.h>
#else
#include <execinfo.h>
#endif
void Platform::processArgs(std::vector<std::string>& args)
{
@@ -169,6 +174,7 @@ std::string Platform::getOSName()
return std::string();
}
#ifndef ANDROID
std::string Platform::traceback(const std::string& where, int level, int maxDepth)
{
std::stringstream ss;
@@ -199,5 +205,13 @@ std::string Platform::traceback(const std::string& where, int level, int maxDept
return ss.str();
}
#else
std::string Platform::traceback(const std::string& where, int level, int maxDepth){
std::stringstream ss;
ss << "\nat:";
ss << "\n\t[C++]: " << where;
return ss.str();
}
#endif
#endif

View File

@@ -20,7 +20,7 @@
* THE SOFTWARE.
*/
#ifndef WIN32
#if !defined WIN32 && !defined ANDROID
#include "x11window.h"
#include <framework/core/resourcemanager.h>
@@ -590,15 +590,15 @@ void X11Window::poll()
XNextEvent(m_display, &event);
// check for repeated key releases
bool repatedKeyRelease = false;
bool repeatedKeyRelease = false;
if(event.type == KeyRelease && XPending(m_display)) {
XPeekEvent(m_display, &peekEvent);
if((peekEvent.type == KeyPress) && (peekEvent.xkey.keycode == event.xkey.keycode) && ((peekEvent.xkey.time-event.xkey.time) < 2))
repatedKeyRelease = true;
repeatedKeyRelease = true;
}
// process keydown and keyrelease events first
if(event.type == KeyPress || (event.type == KeyRelease && !repatedKeyRelease)) {
if(event.type == KeyPress || (event.type == KeyRelease && !repeatedKeyRelease)) {
// remove caps lock and shift maks
XKeyEvent xkey = event.xkey;
xkey.state &= ~(ShiftMask | LockMask);
@@ -623,7 +623,7 @@ void X11Window::poll()
continue;
// discard repated key releases
if(repatedKeyRelease)
if(repeatedKeyRelease)
continue;
switch(event.type) {

View File

@@ -659,8 +659,12 @@ void UITextEdit::onFocusChange(bool focused, Fw::FocusReason reason)
else
blinkCursor();
update(true);
#ifdef ANDROID
g_mobileFacade.showKeyboardSoft();
#endif
} else if(m_selectable)
clearSelection();
UIWidget::onFocusChange(focused, reason);
}

View File

@@ -20,39 +20,13 @@
* THE SOFTWARE.
*/
#include <framework/core/application.h>
#include <framework/core/resourcemanager.h>
#include <framework/luaengine/luainterface.h>
#include <client/client.h>
int main(int argc, const char* argv[])
int main(int argc, char* argv[])
{
std::vector<std::string> args(argv, argv + argc);
Client client(argc, argv);
client.terminateAndFreeMemory();
// setup application name and version
g_app.setName("OTClient");
g_app.setCompactName("otclient");
g_app.setVersion(VERSION);
// initialize application framework and otclient
g_app.init(args);
g_client.init(args);
// find script init.lua and run it
if(!g_resources.discoverWorkDir("init.lua"))
g_logger.fatal("Unable to find work directory, the application cannot be initialized.");
if(!g_lua.safeRunScript("init.lua"))
g_logger.fatal("Unable to run script init.lua!");
// the run application main loop
g_app.run();
// unload modules
g_app.deinit();
// terminate everything and free memory
g_client.terminate();
g_app.terminate();
return 0;
}

View File

@@ -1,7 +1,7 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Express 2013 for Windows Desktop
VisualStudioVersion = 12.0.21005.1
# Visual Studio 2013
VisualStudioVersion = 12.0.30501.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "otclient", "otclient.vcxproj", "{17A8F78F-1FFB-4128-A3B3-59CC6C19D89A}"
EndProject

View File

@@ -66,28 +66,38 @@
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<IncludePath>D:\otclient-msvc13-libs\libogg-1.3.1\include;D:\otclient-msvc13-libs\libvorbis-1.3.3\include;D:\otclient-msvc13-libs\physfs-2.0.3\include;D:\otclient-msvc13-libs\OpenSSL-1.0.1e\include;D:\otclient-msvc13-libs\zlib-1.2.5\include;D:\otclient-msvc13-libs\OpenAL\include\AL;D:\otclient-msvc13-libs\glew-1.10.0\include;D:\otclient-msvc13-libs\LuaJIT-2.0.2\include;D:\otclient-msvc13-libs\boost_1_55_0\include;D:\otclient\src;..\src;$(IncludePath)</IncludePath>
<LibraryPath>D:\otclient-msvc13-libs\libogg-1.3.1\lib;D:\otclient-msvc13-libs\libvorbis-1.3.3\lib;D:\otclient-msvc13-libs\physfs-2.0.3\lib;D:\otclient-msvc13-libs\OpenSSL-1.0.1e\lib\VC;D:\otclient-msvc13-libs\zlib-1.2.5\lib;D:\otclient-msvc13-libs\OpenAL\lib;D:\otclient-msvc13-libs\LuaJIT-2.0.2\lib;D:\otclient-msvc13-libs\glew-1.10.0\lib;D:\otclient-msvc13-libs\boost_1_55_0\lib;$(LibraryPath)</LibraryPath>
<IncludePath>$(LIBRARIES_DIR)\otclient-msvc13-libs\libogg-1.3.1\include;$(LIBRARIES_DIR)\otclient-msvc13-libs\libvorbis-1.3.3\include;$(LIBRARIES_DIR)\otclient-msvc13-libs\physfs-2.0.3\include;$(LIBRARIES_DIR)\otclient-msvc13-libs\OpenSSL-1.0.1e\include;$(LIBRARIES_DIR)\otclient-msvc13-libs\zlib-1.2.5\include;$(LIBRARIES_DIR)\otclient-msvc13-libs\OpenAL\include\AL;$(LIBRARIES_DIR)\otclient-msvc13-libs\glew-1.10.0\include;$(LIBRARIES_DIR)\otclient-msvc13-libs\LuaJIT-2.0.2\include;$(LIBRARIES_DIR)\otclient-msvc13-libs\boost_1_55_0\include;$(OTCLIENT_PATH)\src;$(IncludePath)</IncludePath>
<LibraryPath>$(LIBRARIES_DIR)\otclient-msvc13-libs\libogg-1.3.1\lib;$(LIBRARIES_DIR)\otclient-msvc13-libs\libvorbis-1.3.3\lib;$(LIBRARIES_DIR)\otclient-msvc13-libs\physfs-2.0.3\lib;$(LIBRARIES_DIR)\otclient-msvc13-libs\OpenSSL-1.0.1e\lib\VC;$(LIBRARIES_DIR)\otclient-msvc13-libs\zlib-1.2.5\lib;$(LIBRARIES_DIR)\otclient-msvc13-libs\OpenAL\lib;$(LIBRARIES_DIR)\otclient-msvc13-libs\LuaJIT-2.0.2\lib;$(LIBRARIES_DIR)\otclient-msvc13-libs\glew-1.10.0\lib;$(LIBRARIES_DIR)\otclient-msvc13-libs\boost_1_55_0\lib;$(LibraryPath)</LibraryPath>
<LinkIncremental>false</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<IncludePath>D:\otclient-msvc13-libs\libogg-1.3.1\include;D:\otclient-msvc13-libs\libvorbis-1.3.3\include;D:\otclient-msvc13-libs\physfs-2.0.3\include;D:\otclient-msvc13-libs\OpenSSL-1.0.1e\include;D:\otclient-msvc13-libs\zlib-1.2.5\include;D:\otclient-msvc13-libs\OpenAL\include\AL;D:\otclient-msvc13-libs\glew-1.10.0\include;D:\otclient-msvc13-libs\LuaJIT-2.0.2\include;D:\otclient-msvc13-libs\boost_1_55_0\include;D:\otclient\src;..\src;$(IncludePath)</IncludePath>
<LibraryPath>D:\otclient-msvc13-libs\libogg-1.3.1\lib;D:\otclient-msvc13-libs\libvorbis-1.3.3\lib;D:\otclient-msvc13-libs\physfs-2.0.3\lib;D:\otclient-msvc13-libs\OpenSSL-1.0.1e\lib\VC;D:\otclient-msvc13-libs\zlib-1.2.5\lib;D:\otclient-msvc13-libs\OpenAL\lib;D:\otclient-msvc13-libs\LuaJIT-2.0.2\lib;D:\otclient-msvc13-libs\glew-1.10.0\lib;D:\otclient-msvc13-libs\boost_1_55_0\lib;$(LibraryPath)</LibraryPath>
<IncludePath>$(LIBRARIES_DIR)\otclient-msvc13-libs\libogg-1.3.1\include;$(LIBRARIES_DIR)\otclient-msvc13-libs\libvorbis-1.3.3\include;$(LIBRARIES_DIR)\otclient-msvc13-libs\physfs-2.0.3\include;$(LIBRARIES_DIR)\otclient-msvc13-libs\OpenSSL-1.0.1e\include;$(LIBRARIES_DIR)\otclient-msvc13-libs\zlib-1.2.5\include;$(LIBRARIES_DIR)\otclient-msvc13-libs\OpenAL\include\AL;$(LIBRARIES_DIR)\otclient-msvc13-libs\glew-1.10.0\include;$(LIBRARIES_DIR)\otclient-msvc13-libs\LuaJIT-2.0.2\include;$(LIBRARIES_DIR)\otclient-msvc13-libs\boost_1_55_0\include;$(OTCLIENT_PATH)\src;$(IncludePath)</IncludePath>
<LibraryPath>$(LIBRARIES_DIR)\otclient-msvc13-libs\libogg-1.3.1\lib;$(LIBRARIES_DIR)\otclient-msvc13-libs\libvorbis-1.3.3\lib;$(LIBRARIES_DIR)\otclient-msvc13-libs\physfs-2.0.3\lib;$(LIBRARIES_DIR)\otclient-msvc13-libs\OpenSSL-1.0.1e\lib\VC;$(LIBRARIES_DIR)\otclient-msvc13-libs\zlib-1.2.5\lib;$(LIBRARIES_DIR)\otclient-msvc13-libs\OpenAL\lib;$(LIBRARIES_DIR)\otclient-msvc13-libs\LuaJIT-2.0.2\lib;$(LIBRARIES_DIR)\otclient-msvc13-libs\glew-1.10.0\lib;$(LIBRARIES_DIR)\otclient-msvc13-libs\boost_1_55_0\lib;$(LibraryPath)</LibraryPath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<IncludePath>C:\otclient-msvc13-libs\libogg-1.3.1\include;C:\otclient-msvc13-libs\libvorbis-1.3.3\include;C:\otclient-msvc13-libs\physfs-2.0.3\include;C:\otclient-msvc13-libs\OpenSSL-1.0.1e\include;C:\otclient-msvc13-libs\zlib-1.2.5\include;C:\otclient-msvc13-libs\OpenAL\include\AL;C:\otclient-msvc13-libs\glew-1.10.0\include;C:\otclient-msvc13-libs\LuaJIT-2.0.2\include;C:\otclient-msvc13-libs\boost_1_55_0\include;..\src;$(IncludePath)</IncludePath>
<LibraryPath>C:\otclient-msvc13-libs\libogg-1.3.1\lib;C:\otclient-msvc13-libs\libvorbis-1.3.3\lib;C:\otclient-msvc13-libs\physfs-2.0.3\lib;C:\otclient-msvc13-libs\OpenSSL-1.0.1e\lib\VC;C:\otclient-msvc13-libs\zlib-1.2.5\lib;C:\otclient-msvc13-libs\OpenAL\lib;C:\otclient-msvc13-libs\LuaJIT-2.0.2\lib;C:\otclient-msvc13-libs\glew-1.10.0\lib;C:\otclient-msvc13-libs\boost_1_55_0\lib;$(LibraryPath)</LibraryPath>
<IncludePath>$(LIBRARIES_DIR)\otclient-msvc13-libs\libogg-1.3.1\include;$(LIBRARIES_DIR)\otclient-msvc13-libs\libvorbis-1.3.3\include;$(LIBRARIES_DIR)\otclient-msvc13-libs\physfs-2.0.3\include;$(LIBRARIES_DIR)\otclient-msvc13-libs\OpenSSL-1.0.1e\include;$(LIBRARIES_DIR)\otclient-msvc13-libs\zlib-1.2.5\include;$(OTCLIENT_PATH)\src;$(LIBRARIES_DIR)\otclient-msvc13-libs\OpenAL\include\AL;$(LIBRARIES_DIR)\otclient-msvc13-libs\glew-1.10.0\include;$(LIBRARIES_DIR)\otclient-msvc13-libs\LuaJIT-2.0.2\include;$(LIBRARIES_DIR)\otclient-msvc13-libs\boost_1_55_0\include;$(IncludePath)</IncludePath>
<LibraryPath>$(LIBRARIES_DIR)\otclient-msvc13-libs\libogg-1.3.1\lib;$(LIBRARIES_DIR)\otclient-msvc13-libs\libvorbis-1.3.3\lib;$(LIBRARIES_DIR)\otclient-msvc13-libs\physfs-2.0.3\lib;$(LIBRARIES_DIR)\otclient-msvc13-libs\OpenSSL-1.0.1e\lib\VC;$(LIBRARIES_DIR)\otclient-msvc13-libs\zlib-1.2.5\lib;$(LIBRARIES_DIR)\otclient-msvc13-libs\OpenAL\lib;$(LIBRARIES_DIR)\otclient-msvc13-libs\LuaJIT-2.0.2\lib;$(LIBRARIES_DIR)\otclient-msvc13-libs\glew-1.10.0\lib;$(LIBRARIES_DIR)\otclient-msvc13-libs\boost_1_55_0\lib;$(LibraryPath)</LibraryPath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<IncludePath>D:\otclient-msvc13-libs\libogg-1.3.1\include;D:\otclient-msvc13-libs\libvorbis-1.3.3\include;D:\otclient-msvc13-libs\physfs-2.0.3\include;D:\otclient-msvc13-libs\OpenSSL-1.0.1e\include;D:\otclient-msvc13-libs\zlib-1.2.5\include;D:\otclient-msvc13-libs\OpenAL\include\AL;D:\otclient-msvc13-libs\glew-1.10.0\include;D:\otclient-msvc13-libs\LuaJIT-2.0.2\include;D:\otclient-msvc13-libs\boost_1_55_0\include;D:\otclient\src;..\src;$(IncludePath)</IncludePath>
<LibraryPath>D:\otclient-msvc13-libs\libogg-1.3.1\lib;D:\otclient-msvc13-libs\libvorbis-1.3.3\lib;D:\otclient-msvc13-libs\physfs-2.0.3\lib;D:\otclient-msvc13-libs\OpenSSL-1.0.1e\lib\VC;D:\otclient-msvc13-libs\zlib-1.2.5\lib;D:\otclient-msvc13-libs\OpenAL\lib;D:\otclient-msvc13-libs\LuaJIT-2.0.2\lib;D:\otclient-msvc13-libs\glew-1.10.0\lib;D:\otclient-msvc13-libs\boost_1_55_0\lib;$(LibraryPath)</LibraryPath>
<IncludePath>$(LIBRARIES_DIR)\otclient-msvc13-libs\libogg-1.3.1\include;$(LIBRARIES_DIR)\otclient-msvc13-libs\libvorbis-1.3.3\include;$(LIBRARIES_DIR)\otclient-msvc13-libs\physfs-2.0.3\include;$(LIBRARIES_DIR)\otclient-msvc13-libs\OpenSSL-1.0.1e\include;$(LIBRARIES_DIR)\otclient-msvc13-libs\zlib-1.2.5\include;$(LIBRARIES_DIR)\otclient-msvc13-libs\OpenAL\include\AL;$(LIBRARIES_DIR)\otclient-msvc13-libs\glew-1.10.0\include;$(LIBRARIES_DIR)\otclient-msvc13-libs\LuaJIT-2.0.2\include;$(LIBRARIES_DIR)\otclient-msvc13-libs\boost_1_55_0\include;$(OTCLIENT_PATH)\src;$(IncludePath)</IncludePath>
<LibraryPath>$(LIBRARIES_DIR)\otclient-msvc13-libs\libogg-1.3.1\lib;$(LIBRARIES_DIR)\otclient-msvc13-libs\libvorbis-1.3.3\lib;$(LIBRARIES_DIR)\otclient-msvc13-libs\physfs-2.0.3\lib;$(LIBRARIES_DIR)\otclient-msvc13-libs\OpenSSL-1.0.1e\lib\VC;$(LIBRARIES_DIR)\otclient-msvc13-libs\zlib-1.2.5\lib;$(LIBRARIES_DIR)\otclient-msvc13-libs\OpenAL\lib;$(LIBRARIES_DIR)\otclient-msvc13-libs\LuaJIT-2.0.2\lib;$(LIBRARIES_DIR)\otclient-msvc13-libs\glew-1.10.0\lib;$(LIBRARIES_DIR)\otclient-msvc13-libs\boost_1_55_0\lib;$(LibraryPath)</LibraryPath>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>WIN32;_CRT_SECURE_NO_WARNINGS;_WIN32_WINNT=0x0501;BOT_PROTECTION;CLIENT;CRASH_HANDLER;FW_GRAPHICS;FW_NET;FW_SOUND;FW_XML;BUILD_TYPE="RelWithDebInfo";BUILD_COMMIT="devel";BUILD_REVISION="0";VERSION="0.6.3";"BUILD_REVISION=\"0\"";"VERSION=\"0.6.3\"";%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>WIN32;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;_WIN32_WINNT=0x0501;BOT_PROTECTION;CLIENT;CRASH_HANDLER;FW_GRAPHICS;FW_NET;FW_SOUND;FW_XML;BUILD_TYPE="RelWithDebInfo";BUILD_COMMIT="devel";BUILD_REVISION="0";VERSION="0.6.3";%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ObjectFileName>$(IntDir)\$(Platform)\src\%(RelativeDir)\</ObjectFileName>
<AdditionalIncludeDirectories>$(LIBRARIES_DIR)\otclient-msvc13-libs\libogg-1.3.1\include;$(LIBRARIES_DIR)\otclient-msvc13-libs\libvorbis-1.3.3\include;$(LIBRARIES_DIR)\otclient-msvc13-libs\physfs-2.0.3\include;$(LIBRARIES_DIR)\otclient-msvc13-libs\OpenSSL-1.0.1e\include;$(LIBRARIES_DIR)\otclient-msvc13-libs\zlib-1.2.5\include;$(LIBRARIES_DIR)\otclient-msvc13-libs\OpenAL\include\AL;$(LIBRARIES_DIR)\otclient-msvc13-libs\glew-1.10.0\include;$(LIBRARIES_DIR)\otclient-msvc13-libs\LuaJIT-2.0.2\include;$(LIBRARIES_DIR)\otclient-msvc13-libs\boost_1_55_0\include;$(OTCLIENT_PATH)\src</AdditionalIncludeDirectories>
<IntrinsicFunctions>true</IntrinsicFunctions>
<Optimization>MaxSpeed</Optimization>
<BasicRuntimeChecks>Default</BasicRuntimeChecks>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<MinimalRebuild>false</MinimalRebuild>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<FunctionLevelLinking>true</FunctionLevelLinking>
<WholeProgramOptimization>true</WholeProgramOptimization>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
@@ -96,6 +106,8 @@
<LargeAddressAware>true</LargeAddressAware>
<SubSystem>Windows</SubSystem>
<EntryPointSymbol>mainCRTStartup</EntryPointSymbol>
<AdditionalLibraryDirectories>$(LIBRARIES_DIR)\otclient-msvc13-libs\libogg-1.3.1\lib;$(LIBRARIES_DIR)\otclient-msvc13-libs\libvorbis-1.3.3\lib;$(LIBRARIES_DIR)\otclient-msvc13-libs\physfs-2.0.3\lib;$(LIBRARIES_DIR)\otclient-msvc13-libs\OpenSSL-1.0.1e\lib\VC;$(LIBRARIES_DIR)\otclient-msvc13-libs\zlib-1.2.5\lib;$(LIBRARIES_DIR)\otclient-msvc13-libs\OpenAL\lib;$(LIBRARIES_DIR)\otclient-msvc13-libs\LuaJIT-2.0.2\lib;$(LIBRARIES_DIR)\otclient-msvc13-libs\glew-1.10.0\lib;$(LIBRARIES_DIR)\otclient-msvc13-libs\boost_1_55_0\lib</AdditionalLibraryDirectories>
<LinkTimeCodeGeneration>UseLinkTimeCodeGeneration</LinkTimeCodeGeneration>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
@@ -105,6 +117,7 @@
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>WIN32;_CRT_SECURE_NO_WARNINGS;_WIN32_WINNT=0x0501;BOT_PROTECTION;CLIENT;CRASH_HANDLER;FW_GRAPHICS;FW_NET;FW_SOUND;FW_XML;BUILD_TYPE="RelWithDebInfo";BUILD_COMMIT="devel";BUILD_REVISION="0";VERSION="0.6.3";"BUILD_REVISION=\"0\"";"VERSION=\"0.6.3\"";%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ObjectFileName>$(IntDir)\$(Platform)\src\%(RelativeDir)\</ObjectFileName>
<AdditionalIncludeDirectories>$(LIBRARIES_DIR)\otclient-msvc13-libs\libogg-1.3.1\include;$(LIBRARIES_DIR)\otclient-msvc13-libs\libvorbis-1.3.3\include;$(LIBRARIES_DIR)\otclient-msvc13-libs\physfs-2.0.3\include;$(LIBRARIES_DIR)\otclient-msvc13-libs\OpenSSL-1.0.1e\include;$(LIBRARIES_DIR)\otclient-msvc13-libs\zlib-1.2.5\include;$(LIBRARIES_DIR)\otclient-msvc13-libs\OpenAL\include\AL;$(LIBRARIES_DIR)\otclient-msvc13-libs\glew-1.10.0\include;$(LIBRARIES_DIR)\otclient-msvc13-libs\LuaJIT-2.0.2\include;$(LIBRARIES_DIR)\otclient-msvc13-libs\boost_1_55_0\include;$(OTCLIENT_PATH)\src;$(IncludePath)</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
@@ -113,6 +126,7 @@
<LargeAddressAware>true</LargeAddressAware>
<SubSystem>Windows</SubSystem>
<EntryPointSymbol>mainCRTStartup</EntryPointSymbol>
<AdditionalLibraryDirectories>$(LIBRARIES_DIR)\otclient-msvc13-libs\libogg-1.3.1\lib;$(LIBRARIES_DIR)\otclient-msvc13-libs\libvorbis-1.3.3\lib;$(LIBRARIES_DIR)\otclient-msvc13-libs\physfs-2.0.3\lib;$(LIBRARIES_DIR)\otclient-msvc13-libs\OpenSSL-1.0.1e\lib\VC;$(LIBRARIES_DIR)\otclient-msvc13-libs\zlib-1.2.5\lib;$(LIBRARIES_DIR)\otclient-msvc13-libs\OpenAL\lib;$(LIBRARIES_DIR)\otclient-msvc13-libs\LuaJIT-2.0.2\lib;$(LIBRARIES_DIR)\otclient-msvc13-libs\glew-1.10.0\lib;$(LIBRARIES_DIR)\otclient-msvc13-libs\boost_1_55_0\lib;$(LibraryPath)</AdditionalLibraryDirectories>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
@@ -125,6 +139,7 @@
<PreprocessorDefinitions>WIN32;_CRT_SECURE_NO_WARNINGS;_WIN32_WINNT=0x0501;BOT_PROTECTION;CLIENT;CRASH_HANDLER;FW_GRAPHICS;FW_NET;FW_SOUND;FW_XML;BUILD_TYPE="RelWithDebInfo";BUILD_COMMIT="devel";BUILD_REVISION="0";VERSION="0.6.3";%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<ObjectFileName>$(IntDir)\$(Platform)\src\%(RelativeDir)\</ObjectFileName>
<AdditionalIncludeDirectories>$(LIBRARIES_DIR)\otclient-msvc13-libs\libogg-1.3.1\include;$(LIBRARIES_DIR)\otclient-msvc13-libs\libvorbis-1.3.3\include;$(LIBRARIES_DIR)\otclient-msvc13-libs\physfs-2.0.3\include;$(LIBRARIES_DIR)\otclient-msvc13-libs\OpenSSL-1.0.1e\include;$(LIBRARIES_DIR)\otclient-msvc13-libs\zlib-1.2.5\include;$(LIBRARIES_DIR)\otclient-msvc13-libs\OpenAL\include\AL;$(LIBRARIES_DIR)\otclient-msvc13-libs\glew-1.10.0\include;$(LIBRARIES_DIR)\otclient-msvc13-libs\LuaJIT-2.0.2\include;$(LIBRARIES_DIR)\otclient-msvc13-libs\boost_1_55_0\include;$(OTCLIENT_PATH)\src;$(IncludePath)</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
@@ -135,6 +150,7 @@
<EntryPointSymbol>mainCRTStartup</EntryPointSymbol>
<IgnoreSpecificDefaultLibraries>libcmt.lib</IgnoreSpecificDefaultLibraries>
<LargeAddressAware>true</LargeAddressAware>
<AdditionalLibraryDirectories>$(LIBRARIES_DIR)\otclient-msvc13-libs\libogg-1.3.1\lib;$(LIBRARIES_DIR)\otclient-msvc13-libs\libvorbis-1.3.3\lib;$(LIBRARIES_DIR)\otclient-msvc13-libs\physfs-2.0.3\lib;$(LIBRARIES_DIR)\otclient-msvc13-libs\OpenSSL-1.0.1e\lib\VC;$(LIBRARIES_DIR)\otclient-msvc13-libs\zlib-1.2.5\lib;$(LIBRARIES_DIR)\otclient-msvc13-libs\OpenAL\lib;$(LIBRARIES_DIR)\otclient-msvc13-libs\LuaJIT-2.0.2\lib;$(LIBRARIES_DIR)\otclient-msvc13-libs\glew-1.10.0\lib;$(LIBRARIES_DIR)\otclient-msvc13-libs\boost_1_55_0\lib;$(LibraryPath)</AdditionalLibraryDirectories>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
@@ -269,6 +285,7 @@
<ClCompile Include="..\src\framework\otml\otmlexception.cpp" />
<ClCompile Include="..\src\framework\otml\otmlnode.cpp" />
<ClCompile Include="..\src\framework\otml\otmlparser.cpp" />
<ClCompile Include="..\src\framework\platform\androidwindow.cpp" />
<ClCompile Include="..\src\framework\platform\platform.cpp" />
<ClCompile Include="..\src\framework\platform\platformwindow.cpp" />
<ClCompile Include="..\src\framework\platform\win32crashhandler.cpp" />
@@ -427,6 +444,7 @@
<ClInclude Include="..\src\framework\otml\otmlnode.h" />
<ClInclude Include="..\src\framework\otml\otmlparser.h" />
<ClInclude Include="..\src\framework\pch.h" />
<ClInclude Include="..\src\framework\platform\androidwindow.h" />
<ClInclude Include="..\src\framework\platform\crashhandler.h" />
<ClInclude Include="..\src\framework\platform\platform.h" />
<ClInclude Include="..\src\framework\platform\platformwindow.h" />

View File

@@ -19,9 +19,6 @@
<Filter Include="Source Files\client">
<UniqueIdentifier>{5c843160-5a3a-4841-b64f-a1be3d5c2df6}</UniqueIdentifier>
</Filter>
<Filter Include="Header Files\client">
<UniqueIdentifier>{9c343067-7e4c-497d-9423-f580732fd03c}</UniqueIdentifier>
</Filter>
<Filter Include="Header Files\framework">
<UniqueIdentifier>{be8876e0-a2cf-45f5-ac85-f822d0c85be4}</UniqueIdentifier>
</Filter>
@@ -103,6 +100,9 @@
<Filter Include="Header Files\framework\graphics\ogl">
<UniqueIdentifier>{8b96ee09-99f1-4c70-90c1-d99505de6264}</UniqueIdentifier>
</Filter>
<Filter Include="Header Files\client">
<UniqueIdentifier>{9c343067-7e4c-497d-9423-f580732fd03c}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\src\framework\luafunctions.cpp">
@@ -531,6 +531,9 @@
<ClCompile Include="..\src\client\animator.cpp">
<Filter>Source Files\client</Filter>
</ClCompile>
<ClCompile Include="..\src\framework\platform\androidwindow.cpp">
<Filter>Source Files\framework\platform</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\src\framework\const.h">
@@ -1055,6 +1058,9 @@
<ClInclude Include="..\src\client\animator.h">
<Filter>Header Files\client</Filter>
</ClInclude>
<ClInclude Include="..\src\framework\platform\androidwindow.h">
<Filter>Header Files\framework\platform</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="..\src\otcicon.rc">