Esempio n. 1
0
bool
UiControls::OnAppInitializing(AppRegistry& appRegistry)
{
	// TODO:
	// Initialize UI resources (forms, buttons, etc.) and application specific data.
	// The application's permanent data and context can be obtained from the appRegistry.
	// If this method is successful, return true; otherwise, return false.
	// If this method returns false, the application will be terminated.
	/////////////////////////////////////////////////////////////////////////////////////
	//this codes is automatically inserted by Tizen application wizard.
	Frame* pAppFrame = new Frame();
	pAppFrame->Construct();
	AddFrame(*pAppFrame);
	////////////////////////////////////////////////////////////////////////////////////

	// Prepare Scene management.

	SceneRegister::RegisterAllScenes();
	SceneManager* pSceneManager = SceneManager::GetInstance();
	pSceneManager->GoForward(ForwardSceneTransition(SCENE_MAIN_FORM));

	// Uncomment the following statement to listen to the screen on/off events.
	//PowerManager::SetScreenEventListener(*this);
	
	return true;
}
Esempio n. 2
0
//
// create the ScummVM system
//
TizenAppForm *systemStart(Tizen::App::Application *app) {
	logEntered();

	Frame *appFrame = new (std::nothrow) TizenAppFrame();
	if (!appFrame || appFrame->Construct() == E_FAILURE) {
		AppLog("Failed to create appFrame");
		return NULL;
	}
	app->AddFrame(*appFrame);

	TizenAppForm *appForm = new TizenAppForm();
	if (!appForm) {
		AppLog("Failed to create appForm");
		return NULL;
	}

	if (E_SUCCESS != appForm->Construct() ||
		E_SUCCESS != appFrame->AddControl(appForm)) {
		delete appForm;
		AppLog("Failed to construct appForm");
		return NULL;
	}

	appFrame->SetCurrentForm(appForm);
	appForm->GetVisualElement()->SetShowState(false);

	logLeaving();
	return appForm;
}
bool VisTizenGLESApp::OnAppInitialized(void)
{
  using namespace Tizen::Ui;
  using namespace Tizen::Ui::Controls;

  // Create the app's UI frame.
  Frame* pAppFrame = new Frame();
  pAppFrame->Construct();
  pAppFrame->SetOrientation(ORIENTATION_LANDSCAPE);
  AddFrame(*pAppFrame);

  // Create and register our Tizen form with the app frame.
  VisTizenGLESForm* pTizenGLESForm = new VisTizenGLESForm( this );
  pTizenGLESForm->Construct( FORM_STYLE_NORMAL );
  GetAppFrame()->GetFrame()->AddControl( pTizenGLESForm );

  // Set and handle device orientation.
  pTizenGLESForm->SetOrientation( ORIENTATION_LANDSCAPE );
  pTizenGLESForm->AddOrientationEventListener( *this );

  // Register for handling frame events. We use this only for deactivating the automatic switching off of the
  // screen - trying to do that in OnForeground() doesn't work as expected.
  pAppFrame->AddFrameEventListener( *this );

  // Register our Tizen form with Vision (to allow for hooking up input events etc.).
  VVideo::SetUIForm( pTizenGLESForm );

  // Start up Vision.
  if (!VisionInitFunction())
  {
    VisionDeInitFunction();
    return false;
  }

  return true;
}
Esempio n. 4
0
bool
GCubeApp::OnAppInitialized(void)
{
	// フレーム作成
	Frame *pFrame = new Frame();
	pFrame->Construct();
	pFrame->SetName(L"GCube");

	// フォーム作成
	Form *pForm = new Form();
	if (settings->showStatusBar) {
		pForm->Construct(FORM_STYLE_INDICATOR);
	} else {
		pForm->Construct(FORM_STYLE_NORMAL);
	}
	pForm->AddTouchEventListener(*this);
	pForm->AddOrientationEventListener(*this);

	pFrame->AddControl(pForm);
	pFrame->SetCurrentForm(pForm);

	// 画面の向き
	enum Orientation orientation = ORIENTATION_NONE;
	if (settings->orientationPortrait) {
		if (settings->orientationLandscapeLeft || settings->orientationLandscapeRight) {
			orientation = ORIENTATION_AUTOMATIC;
		} else {
			orientation = ORIENTATION_PORTRAIT;
		}
	} else {
		if (settings->orientationPortraitUpsideDown) {
			if (settings->orientationLandscapeLeft || settings->orientationLandscapeRight) {
				orientation = ORIENTATION_AUTOMATIC_FOUR_DIRECTION;
			} else {
				orientation = ORIENTATION_PORTRAIT_REVERSE;
			}
		} else {
			if (settings->orientationLandscapeLeft) {
				orientation = ORIENTATION_LANDSCAPE_REVERSE;
			} else {
				if (settings->orientationLandscapeRight) {
					orientation = ORIENTATION_LANDSCAPE;
				}
			}
		}
	}

	pFrame->SetOrientation(orientation);
	pForm->SetOrientation(orientation);
	pFrame->SetMultipointTouchEnabled(true);
	AddFrame(*pFrame);

	{
		__player = new Tizen::Graphics::Opengl::GlPlayer;
		__player->Construct(Tizen::Graphics::Opengl::EGL_CONTEXT_CLIENT_VERSION_2_X, pForm);
		__player->SetFps(settings->frameRate);
		__player->SetEglAttributePreset(Tizen::Graphics::Opengl::EGL_ATTRIBUTES_PRESET_ARGB8888);
		EGLint eglConfigList[] =
		{
		  EGL_RED_SIZE, 8,
		  EGL_GREEN_SIZE, 8,
		  EGL_BLUE_SIZE, 8,
		  EGL_ALPHA_SIZE, 8,
		  EGL_DEPTH_SIZE, 16,
		  EGL_SURFACE_TYPE, EGL_WINDOW_BIT,
		  EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT,
		  EGL_NONE
		};
		__player->SetEglAttributeList(eglConfigList);
		__player->Start();
	}

	__renderer = new GlRendererTemplate();
	__player->SetIGlRenderer(__renderer);

	int w = __renderer->GetTargetControlWidth();
	int h = __renderer->GetTargetControlHeight();

	if (settings->debugButtonPos > 0) {
		// デバッグボタン作成
		// TODO: XMLで作成
		int dy = 0;
		if (settings->showStatusBar) {
			dy = 60;
		}
		Button* pDebugButton = new Button();
		if (settings->debugButtonPos == 1) {
			pDebugButton->Construct(Rectangle(w-80, h-80-dy, 70, 70), L"D");
		} else if (settings->debugButtonPos == 2) {
			pDebugButton->Construct(Rectangle(10, h-80-dy, 70, 70), L"D");
		} else if (settings->debugButtonPos == 3) {
			pDebugButton->Construct(Rectangle(w-80, 10, 70, 70), L"D");
		} else {
			pDebugButton->Construct(Rectangle(10, 10, 70, 70), L"D");
		}
		pDebugButton->SetActionId(ID_DEBUG_BUTTON);
		pDebugButton->AddActionEventListener(*this);
		pForm->AddControl(pDebugButton);

		// ポップアップ作成
		__pPopup = new Popup();
		__pPopup->Construct(true, Dimension(600, 800));
		__pPopup->SetTitleText(L"DebugConsole");

		// ポップアップを閉じるボタン作成
		Button* pCloseButton = new Button();
		pCloseButton->Construct(Rectangle(30, 600, 250, 80), L"Cancel");
		pCloseButton->SetActionId(ID_BUTTON_CLOSE_POPUP);
		pCloseButton->AddActionEventListener(*this);
		__pPopup->AddControl(pCloseButton);

		// OKボタン作成
		Button* pOKButton = new Button();
		pOKButton->Construct(Rectangle(320, 600, 250, 80), L"OK");
		pOKButton->SetActionId(ID_BUTTON_OK_POPUP);
		pOKButton->AddActionEventListener(*this);
		__pPopup->AddControl(pOKButton);

		// テキスト入力
		__pEditField = new EditField();
		__pEditField->Construct(Rectangle(30, 500, 540, 80));
		__pPopup->AddControl(__pEditField);

		// 説明テキスト
		std::vector<char> textBuff;
		GCGetResourceData("etc/debug.txt", textBuff);
		textBuff.push_back('\n');
		String text = String(&textBuff[0]);
		TextBox *pTextBox = new TextBox();
		pTextBox->Construct(Rectangle(30, 50, 540, 430));
		pTextBox->SetTextSize(18);
		pTextBox->SetText(text);
		__pPopup->AddControl(pTextBox);
	}

	// サイズを通知
	DeviceOrientation o = this->ConvertOrientState(pFrame->GetOrientationStatus());
	gcube->onSizeChanged(w, h, o);

	if (settings->useOrientationSensor) {
		__sensorManager.Construct();
		this->CreateSensor();
	}

	return true;
}