From 2aaeb54cc599561b177d6d1b36f6b352a085ccb1 Mon Sep 17 00:00:00 2001 From: Joshua Granick Date: Fri, 29 Nov 2013 21:03:17 -0800 Subject: [PATCH] Add Tizen support for landscape mode --- project/include/Utils.h | 3 +++ project/src/common/ExternalInterface.cpp | 2 +- .../src/platform/tizen/TizenApplication.cpp | 18 ++++++++++++++++++ 3 files changed, 22 insertions(+), 1 deletion(-) diff --git a/project/include/Utils.h b/project/include/Utils.h index 992d07168..391d9b654 100644 --- a/project/include/Utils.h +++ b/project/include/Utils.h @@ -193,6 +193,9 @@ extern "C" bool GetBundleFilename(const char *inName, char *outBuffer,int inBufS extern "C" FILE *OpenOverwrite(const char *inName); namespace lime { #else +#ifdef TIZEN +extern int gFixedOrientation; +#endif #define OpenRead(x) fopen(x,"rb") #define OpenOverwrite(x) fopen(x,"wb") // [ddc] #endif diff --git a/project/src/common/ExternalInterface.cpp b/project/src/common/ExternalInterface.cpp index cae25f284..13cea9d4f 100644 --- a/project/src/common/ExternalInterface.cpp +++ b/project/src/common/ExternalInterface.cpp @@ -1027,7 +1027,7 @@ DEFINE_PRIM(lime_clear_user_preference,1); value lime_stage_set_fixed_orientation(value inValue) { -#ifdef IPHONE +#if defined(IPHONE) || defined(TIZEN) gFixedOrientation = val_int(inValue); #endif return alloc_null(); diff --git a/project/src/platform/tizen/TizenApplication.cpp b/project/src/platform/tizen/TizenApplication.cpp index 3a96aa877..44dd2ac82 100644 --- a/project/src/platform/tizen/TizenApplication.cpp +++ b/project/src/platform/tizen/TizenApplication.cpp @@ -7,6 +7,7 @@ using namespace Tizen::Graphics::Opengl; namespace lime { + int gFixedOrientation = -1; FrameCreationCallback sgCallback; unsigned int sgFlags; int sgHeight; @@ -32,6 +33,16 @@ namespace lime { } + // For now, swap the width/height for proper EGL initialization, when landscape + + if (gFixedOrientation == 3 || gFixedOrientation == 4) { + + int temp = sgWidth; + sgWidth = sgHeight; + sgHeight = temp; + + } + Tizen::Base::Collection::ArrayList args (Tizen::Base::Collection::SingleObjectDeleter); args.Construct (); result r = Tizen::App::Application::Execute (TizenApplication::CreateInstance, &args); @@ -100,6 +111,13 @@ namespace lime { mForm = new (std::nothrow) TizenForm (this); mForm->Construct (Tizen::Ui::Controls::FORM_STYLE_NORMAL); + + if (gFixedOrientation == 3 || gFixedOrientation == 4) { + + mForm->SetOrientation (Tizen::Ui::ORIENTATION_LANDSCAPE); + + } + GetAppFrame ()->GetFrame ()->AddControl (mForm); mForm->AddKeyEventListener (*this);