From: SeonhyungLee Date: Mon, 2 Sep 2013 07:49:08 +0000 (+0900) Subject: Adding a Plugin example X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=eecd0f7726cead47a34c57ded61af92cf4b3e454;p=framework%2Fosp%2Fuifw.git Adding a Plugin example Change-Id: I2e87556b8b4c8afd7739631548862b7965202921 --- diff --git a/src/ui-core/CMakeLists.txt b/src/ui-core/CMakeLists.txt old mode 100755 new mode 100644 index d2188ac..736d21f --- a/src/ui-core/CMakeLists.txt +++ b/src/ui-core/CMakeLists.txt @@ -21,14 +21,11 @@ SET(LIBRARY_OUTPUT_PATH ${CMAKE_CURRENT_SOURCE_DIR}/libs) LINK_DIRECTORIES(${LIBRARY_OUTPUT_PATH}) -IF(_WIN32) -LINK_DIRECTORIES(${LIBRARY_OUTPUT_PATH}/mesa) -ENDIF(_WIN32) - ADD_SUBDIRECTORY(src) IF(_WIN32) ADD_SUBDIRECTORY(example/Win32) +ADD_SUBDIRECTORY(example/Plugin) ELSEIF(LINUX) ADD_SUBDIRECTORY(example/Linux) ENDIF(_WIN32) diff --git a/src/ui-core/example/Linux/CMakeLists.txt b/src/ui-core/example/Linux/CMakeLists.txt index dbf4e7c..e642741 100644 --- a/src/ui-core/example/Linux/CMakeLists.txt +++ b/src/ui-core/example/Linux/CMakeLists.txt @@ -8,7 +8,9 @@ SET(${this_target}_SOURCE_FILES TestApplication.cpp ) -SET(EXECUTABLE_OUTPUT_PATH ${CMAKE_CURRENT_SOURCE_DIR}) +SET(EXECUTABLE_OUTPUT_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../../libs) + ADD_EXECUTABLE(${this_target} ${${this_target}_SOURCE_FILES}) +ADD_DEPENDENCIES(${this_target} ui-core) TARGET_LINK_LIBRARIES(${this_target} "-lui-core") diff --git a/src/ui-core/example/Plugin/CMakeLists.txt b/src/ui-core/example/Plugin/CMakeLists.txt new file mode 100644 index 0000000..1a44497 --- /dev/null +++ b/src/ui-core/example/Plugin/CMakeLists.txt @@ -0,0 +1,15 @@ +SET(this_target visual-element) + +INCLUDE_DIRECTORIES( + . + ../../inc +) + +SET(${this_target}_SOURCE_FILES + org_tizen_tools_areditor_sceneeditor_editor3d_NativeSceneEditor.cpp +) + +ADD_LIBRARY(${this_target} SHARED ${${this_target}_SOURCE_FILES}) + +SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--kill-at") +TARGET_LINK_LIBRARIES(${this_target} "-lui-core") diff --git a/src/ui-core/inc/jni.h b/src/ui-core/example/Plugin/jni.h old mode 100755 new mode 100644 similarity index 100% rename from src/ui-core/inc/jni.h rename to src/ui-core/example/Plugin/jni.h diff --git a/src/ui-core/inc/jni_md.h b/src/ui-core/example/Plugin/jni_md.h old mode 100755 new mode 100644 similarity index 100% rename from src/ui-core/inc/jni_md.h rename to src/ui-core/example/Plugin/jni_md.h diff --git a/src/ui-core/example/Plugin/org_tizen_tools_areditor_sceneeditor_editor3d_NativeSceneEditor.cpp b/src/ui-core/example/Plugin/org_tizen_tools_areditor_sceneeditor_editor3d_NativeSceneEditor.cpp new file mode 100644 index 0000000..bd3d87e --- /dev/null +++ b/src/ui-core/example/Plugin/org_tizen_tools_areditor_sceneeditor_editor3d_NativeSceneEditor.cpp @@ -0,0 +1,19 @@ +#include "org_tizen_tools_areditor_sceneeditor_editor3d_NativeSceneEditor.h" +#include +#include + +JNIEXPORT void JNICALL Java_org_tizen_tools_areditor_sceneeditor_editor3d_NativeSceneEditor_init(JNIEnv *, jobject, jint handle, jint width, jint height) +{ + InitLibrary(handle, width, height); +} + +JNIEXPORT void JNICALL Java_org_tizen_tools_areditor_sceneeditor_editor3d_NativeSceneEditor_resize(JNIEnv *, jobject, jint width, jint height) +{ + ResizeWindow(width, height); +} + +JNIEXPORT void JNICALL Java_org_tizen_tools_areditor_sceneeditor_editor3d_NativeSceneEditor_repaint(JNIEnv *, jobject, jfloat dt) +{ + UpdateScreen(1.0f); +} + diff --git a/src/ui-core/inc/org_tizen_tools_areditor_sceneeditor_editor3d_NativeSceneEditor.h b/src/ui-core/example/Plugin/org_tizen_tools_areditor_sceneeditor_editor3d_NativeSceneEditor.h old mode 100755 new mode 100644 similarity index 100% rename from src/ui-core/inc/org_tizen_tools_areditor_sceneeditor_editor3d_NativeSceneEditor.h rename to src/ui-core/example/Plugin/org_tizen_tools_areditor_sceneeditor_editor3d_NativeSceneEditor.h diff --git a/src/ui-core/libs/mesa/libEGL.dll b/src/ui-core/libs/libEGL.dll similarity index 100% rename from src/ui-core/libs/mesa/libEGL.dll rename to src/ui-core/libs/libEGL.dll diff --git a/src/ui-core/libs/mesa/libEGL.lib b/src/ui-core/libs/libEGL.lib similarity index 100% rename from src/ui-core/libs/mesa/libEGL.lib rename to src/ui-core/libs/libEGL.lib diff --git a/src/ui-core/libs/mesa/libGLESv2.dll b/src/ui-core/libs/libGLESv2.dll similarity index 100% rename from src/ui-core/libs/mesa/libGLESv2.dll rename to src/ui-core/libs/libGLESv2.dll diff --git a/src/ui-core/libs/mesa/libGLESv2.lib b/src/ui-core/libs/libGLESv2.lib similarity index 100% rename from src/ui-core/libs/mesa/libGLESv2.lib rename to src/ui-core/libs/libGLESv2.lib diff --git a/src/ui-core/src/CMakeLists.txt b/src/ui-core/src/CMakeLists.txt index 2f63c91..1294cd4 100755 --- a/src/ui-core/src/CMakeLists.txt +++ b/src/ui-core/src/CMakeLists.txt @@ -155,7 +155,7 @@ ELSEIF(_WIN32) ADD_DEFINITIONS("-DVE_WIN32_GL -DBUILD_UI_CORE") LIST(APPEND ${this_target}_SOURCE_FILES - org_tizen_tools_areditor_sceneeditor_editor3d_NativesceneEditor.cpp + UcInterface.cpp ${UIFW_DIRECTORY}/src/ui/animations/platform/FUiAnim_Win32Window.cpp ) @@ -176,10 +176,9 @@ TARGET_LINK_LIBRARIES(${this_target} "-lEGL" ) ELSEIF(_WIN32) -SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--kill-at") - TARGET_LINK_LIBRARIES(${this_target} "-llibGLESv2" ) TARGET_LINK_LIBRARIES(${this_target} "-llibEGL" ) + ENDIF(LINUX) TARGET_LINK_LIBRARIES(${this_target} "-lpthread" ) diff --git a/src/ui-core/src/UcInterface.cpp b/src/ui-core/src/UcInterface.cpp index 1cf3361..a98da6a 100644 --- a/src/ui-core/src/UcInterface.cpp +++ b/src/ui-core/src/UcInterface.cpp @@ -73,7 +73,6 @@ void ResizeWindow(int width, int height) void UpdateScreen(float delayedTime) { pVisualElement->Flush(); - pNativeLayer->Flush(); } diff --git a/src/ui-core/src/org_tizen_tools_areditor_sceneeditor_editor3d_NativeSceneEditor.cpp b/src/ui-core/src/org_tizen_tools_areditor_sceneeditor_editor3d_NativeSceneEditor.cpp deleted file mode 100755 index d7c9970..0000000 --- a/src/ui-core/src/org_tizen_tools_areditor_sceneeditor_editor3d_NativeSceneEditor.cpp +++ /dev/null @@ -1,154 +0,0 @@ -// jniSceneEditor.cpp : Defines the entry point for the console application. -// - -#include "FUiAnim_DisplayManager.h" -#include "FUiAnim_AnimationManager.h" -#include "FUiAnim_RootVisualElement.h" -#include "FUiAnimVisualElement.h" -#include "FUiAnimVisualElementSurface.h" -#include "FUiAnim_NativeLayer.h" -#include "FGrpFloatRectangle.h" -#include "FGrpBufferInfo.h" -#include "FUiAnimDisplayContext.h" -#include "FUiAnim_DisplayContextImpl.h" -#include "FUiAnim_NativeWindow.h" -#include "FUiAnim_Win32Window.h" -#include "FUiAnim_GlLayer.h" - -#include "org_tizen_tools_areditor_sceneeditor_editor3d_NativeSceneEditor.h" -#include - -using namespace Tizen::Graphics; -using namespace Tizen::Ui::Animations; - -_NativeLayer* pNativeLayer = null; -DisplayContext* pContext = null; -VisualElement* pVisualElement = null; - -JNIEXPORT void JNICALL Java_org_tizen_tools_areditor_sceneeditor_editor3d_NativeSceneEditor_init - (JNIEnv *, jobject, jint handle, jint width, jint height){ - - #if 0 - //------------------------------ - // Please, insert your code here - //------------------------------ - - /*CreateContext ( (HWND)handle, width, height ); - // get the device context (DC) - gg_hDC = GetDC( (HWND)handle ); - //OnInit - ResourceManager* resourceManager = ResourceManager::GetInstance(); - __pScene = new Scene("Scene"); - - __pRenderSystem = new Tizen::Ui::Renderer::RenderSystem(); - __pRenderSystem->Create(); - __pRenderSystem->SetBackgroundColor(1.0f, 0.2f, 0.2f, 0.2f); - __pRenderSystem->InitViewport(0, 0, width, height, 45.0f, 0.1f, 1000.0f); - __pRenderSystem->UpdateScreen(); - - __pRenderSystem->GetCamera()->Perspective(45.0f, (float)width / height, 0.1f, 1000.0f); - __pRenderSystem->GetCamera()->LookAt(Vector3(0, 0, 100), Vector3(0, 0, 0), Vector3(0, 1, 0)); - - __pScene->Update(); - - FileSystem::ShaderPath = "Shaders/"; - FileSystem::MaterialPath = "Materials/"; - FileSystem::TexturePath = "Textures/"; - - - std::string ModelFileName1 = "ColladaModels/ColorCube.dae";//"../../../Demos/ColladaModels/ColorCube.dae"; - std::string ModelFileName2 = "ColladaModels/scorpion_.DAE";//"../../../Demos/ColladaModels/scorpion_.DAE"; - std::string ModelFileName3 = "ColladaModels/lizard_animation_1.DAE"; - std::string ModelFileName4 = "ColladaModels/astroBoy_walk_Maya.dae"; - - __pGrid.SetLines ( 5.0f, 10.0f, 50.0f ); - __pGrid.Create ( __pRenderSystem ); - GizmoManager::Setting(__pScene,__pRenderSystem); - - glEnable(GL_DEPTH_TEST);*/ -#endif - // - // Please remind that this code is only for testing... - // - - // Initialize - _AnimationManager::CreateInstance(); - _DisplayManager::CreateInstance(); - - _Win32Window* pWindow = new _Win32Window(handle); - - pNativeLayer = new _GlLayer(); - ((_GlLayer*)pNativeLayer)->ConstructForNativeWindow(*pWindow); - - pNativeLayer->SetShowState(true); - pContext = _DisplayContextImpl::CreatePublicInstance(*pNativeLayer); - - // Create a Visual Element - _RootVisualElement* pRoot = pNativeLayer->GetRootVisualElement(); - if (pRoot) - { - pVisualElement = new VisualElement(); - pVisualElement->Construct(); - pVisualElement->SetShowState(true); - pVisualElement->SetBounds(FloatRectangle(0, 0, 100, 100)); - pRoot->AttachChild(pVisualElement); - - VisualElementSurface* pSurface = new VisualElementSurface(); - pSurface->Construct(*pContext, FloatDimension(100, 100)); - - BufferInfo bufferInfo; - pSurface->GetBufferInfo(bufferInfo); - - // Set Pixels - memset(bufferInfo.pPixels, 0xFF, bufferInfo.width * bufferInfo.height * 4); - - pVisualElement->SetSurface(pSurface); - //pElement->Flush(); - } -} - -JNIEXPORT void JNICALL Java_org_tizen_tools_areditor_sceneeditor_editor3d_NativeSceneEditor_resize - (JNIEnv *, jobject, jint width, jint height){ - - //------------------------------ - // Please, insert your code here - //------------------------------ - - /*__pRenderSystem->InitViewport ( 0, 0, width, height); - __pRenderSystem->GetCamera()->Perspective(45.0f, (float)width / height, 0.1f, 1000.0f);*/ -} - -JNIEXPORT void JNICALL Java_org_tizen_tools_areditor_sceneeditor_editor3d_NativeSceneEditor_repaint - (JNIEnv *, jobject, jfloat dt){ - - //------------------------------ - // Please, insert your code here - //------------------------------ - - //////////////////////////////Update//////////////////////////////////////////////////// - /*float fElapsedTime = dt; - __pRenderSystem->SetProjectionMatrix(__pRenderSystem->GetCamera()->GetProjection()); - __pScene->Update(); - - Matrix4 mat; - mat.Identity(); - __pGrid.WorldMatrix = mat; - __pGrid.Update( fElapsedTime ); - - GizmoManager::Update(0,0); - - ///////////////////// Draw ////////////////////////////////////////////////////////////////////// - __pRenderSystem->Clear(ClearFlag::COLOR | ClearFlag::ZBUFFER | ClearFlag::STENCIL); - - __pScene->FindVisible(__pRenderSystem, __pScene->GetRootNodeScene()); - - __pRenderSystem->BeginRender(); - __pRenderSystem->RenderStages(); - __pRenderSystem->EndRender(); - - SwapBuffers(gg_hDC); - */ - pVisualElement->Flush(); - pNativeLayer->Flush(); -} -