Add Tizen support for landscape mode

This commit is contained in:
Joshua Granick
2013-11-29 21:03:17 -08:00
parent ea33423fd7
commit 2aaeb54cc5
3 changed files with 22 additions and 1 deletions

View File

@@ -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

View File

@@ -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();

View File

@@ -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);