From 94c01f1cb13d9b79ddbea71952331e435d4497d1 Mon Sep 17 00:00:00 2001 From: Joshua Granick Date: Sun, 1 Dec 2013 11:55:58 -0800 Subject: [PATCH] Add dummy accelerometer call --- project/src/common/Input.cpp | 2 +- project/src/platform/tizen/System.cpp | 221 ++++++++++++++++++++++++++ 2 files changed, 222 insertions(+), 1 deletion(-) create mode 100644 project/src/platform/tizen/System.cpp diff --git a/project/src/common/Input.cpp b/project/src/common/Input.cpp index 0c0031f28..512c4059f 100644 --- a/project/src/common/Input.cpp +++ b/project/src/common/Input.cpp @@ -4,7 +4,7 @@ namespace lime { -#if !defined(IPHONE) && !defined(WEBOS) && !defined(ANDROID) && !defined(BLACKBERRY) +#if !defined(IPHONE) && !defined(WEBOS) && !defined(ANDROID) && !defined(BLACKBERRY) && !defined(TIZEN) bool GetAcceleration(double &outX, double &outY, double &outZ) { return false; diff --git a/project/src/platform/tizen/System.cpp b/project/src/platform/tizen/System.cpp new file mode 100644 index 000000000..6f5b8df70 --- /dev/null +++ b/project/src/platform/tizen/System.cpp @@ -0,0 +1,221 @@ +#include + + +namespace lime { + + + + double CapabilitiesGetPixelAspectRatio () { + + return 1; + + } + + + double CapabilitiesGetScreenDPI () { + + return 200; + + } + + + QuickVec* CapabilitiesGetScreenResolutions () { + + // glfwInit(); + int count; + QuickVec *out = new QuickVec(); + /*const GLFWvidmode *modes = glfwGetVideoModes(glfwGetPrimaryMonitor(), &count); + for (int i = 0; i < count; i++) + { + out->push_back( modes[i].width ); + out->push_back( modes[i].height ); + }*/ + return out; + + } + + + double CapabilitiesGetScreenResolutionX () { + + if (gFixedOrientation == 3 || gFixedOrientation == 4) { + + return 1280; + + } else { + + return 720; + + } + + } + + + double CapabilitiesGetScreenResolutionY () { + + if (gFixedOrientation == 3 || gFixedOrientation == 4) { + + return 720; + + } else { + + return 1280; + + } + + } + + + std::string CapabilitiesGetLanguage () { + + return "en-US"; + + } + + + bool ClearUserPreference (const char *inId) { + + return true; + + /*JNIEnv *env = GetEnv(); + jclass cls = FindClass("org/haxe/lime/GameActivity"); + jmethodID mid = env->GetStaticMethodID(cls, "clearUserPreference", "(Ljava/lang/String;)V"); + if (mid == 0) + return false; + + jstring jInId = env->NewStringUTF( inId ); + env->CallStaticVoidMethod(cls, mid, jInId ); + return true;*/ + + } + + + std::string FileDialogFolder (const std::string &title, const std::string &text) { + + return ""; + + } + + + std::string FileDialogOpen (const std::string &title, const std::string &text, const std::vector &fileTypes) { + + return ""; + + } + + + std::string FileDialogSave (const std::string &title, const std::string &text, const std::vector &fileTypes) { + + return ""; + + } + + + bool GetAcceleration (double &outX, double &outY, double &outZ) { + + //if (gFixedOrientation == 3 || gFixedOrientation == 4) { + + outX = 0; + outY = 0; + outZ = 1; + + //} + + /*int result = accelerometer_read_forces (&outX, &outY, &outZ); + + if (getenv ("FORCE_PORTRAIT") != NULL) { + + int cache = outX; + outX = outY; + outY = -cache; + + } + + outZ = -outZ;*/ + + return true; + + } + + + std::string GetUserPreference (const char *inId) { + + return ""; + + /*JNIEnv *env = GetEnv(); + jclass cls = FindClass("org/haxe/lime/GameActivity"); + jmethodID mid = env->GetStaticMethodID(cls, "getUserPreference", "(Ljava/lang/String;)Ljava/lang/String;"); + if (mid == 0) + { + return std::string(""); + } + + jstring jInId = env->NewStringUTF(inId); + jstring jPref = (jstring) env->CallStaticObjectMethod(cls, mid, jInId); + env->DeleteLocalRef(jInId); + const char *nativePref = env->GetStringUTFChars(jPref, 0); + std::string result(nativePref); + env->ReleaseStringUTFChars(jPref, nativePref); + return result;*/ + + } + + + void HapticVibrate (int period, int duration) { + + + + } + + + bool LaunchBrowser (const char *inUtf8URL) { + + return false; + + } + + + bool SetUserPreference (const char *inId, const char *inPreference) { + + /*JNIEnv *env = GetEnv(); + jclass cls = FindClass("org/haxe/lime/GameActivity"); + jmethodID mid = env->GetStaticMethodID(cls, "setUserPreference", "(Ljava/lang/String;Ljava/lang/String;)V"); + if (mid == 0) + return false; + + jstring jInId = env->NewStringUTF( inId ); + jstring jPref = env->NewStringUTF ( inPreference ); + env->CallStaticVoidMethod(cls, mid, jInId, jPref ); + env->DeleteLocalRef(jInId); + env->DeleteLocalRef(jPref); + return true;*/ + + return true; + + } + + +} + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file