Permalink
Browse files

Updated SimpleCameraDemo.

  • Loading branch information...
Mikael Kindborg
Mikael Kindborg committed Apr 8, 2013
1 parent e43611b commit 52ec6c79ec99a59c1c1a34d7406123d04c4643c3
Showing with 23 additions and 7 deletions.
  1. +23 −7 SimpleCameraDemo/main.cpp
View
@@ -143,14 +143,7 @@ class SnapshotUI
// Create the image widget used to display snapshots
// (it will be added to the layout dynamically).
- MAExtent screenSize = maGetScrSize();
mImageWidget = new Image();
- mImageWidget->setTopPosition(50);
- mImageWidget->setLeftPosition(50);
- mImageWidget->setWidth(EXTENT_X(screenSize) - 100);
- mImageWidget->setHeight(EXTENT_Y(screenSize) - 150);
- mImageWidget->setBackgroundColor(0x770000);
- mImageWidget->setAlpha(1.0);
}
Widget* getTopWidget()
@@ -188,6 +181,15 @@ class SnapshotUI
return;
}
+ // Position and size image widget.
+ MAExtent screenSize = maGetScrSize();
+ mImageWidget->setTopPosition(50);
+ mImageWidget->setLeftPosition(50);
+ mImageWidget->setWidth(EXTENT_X(screenSize) - 100);
+ mImageWidget->setHeight(EXTENT_Y(screenSize) - 150);
+ mImageWidget->setBackgroundColor(0x770000);
+ mImageWidget->setAlpha(1.0);
+
// Show the image in the image widget.
mImageWidget->setImage(mImageHandle);
//mImageWidget->setScaleMode(IMAGE_SCALE_XY);
@@ -244,11 +246,25 @@ class SimpleCameraMoblet :
*/
SimpleCameraMoblet()
{
+ setScreenOrientation();
createFocusListener();
createUI();
startCameraPreview();
}
+ void setScreenOrientation()
+ {
+ // Android and Windows Phone.
+ maScreenSetOrientation(SCREEN_ORIENTATION_DYNAMIC);
+
+ // iOS and Windows Phone.
+ maScreenSetSupportedOrientations(
+ MA_SCREEN_ORIENTATION_LANDSCAPE_LEFT |
+ MA_SCREEN_ORIENTATION_LANDSCAPE_RIGHT |
+ MA_SCREEN_ORIENTATION_PORTRAIT |
+ MA_SCREEN_ORIENTATION_PORTRAIT_UPSIDE_DOWN);
+ }
+
void createFocusListener()
{
addFocusListener(this);

0 comments on commit 52ec6c7

Please sign in to comment.