Adding a Plugin example
authorSeonhyungLee <sh2644.lee@samsung.com>
Mon, 2 Sep 2013 07:49:08 +0000 (16:49 +0900)
committerSeonhyungLee <sh2644.lee@samsung.com>
Mon, 2 Sep 2013 07:49:08 +0000 (16:49 +0900)
Change-Id: I2e87556b8b4c8afd7739631548862b7965202921

14 files changed:
src/ui-core/CMakeLists.txt [changed mode: 0755->0644]
src/ui-core/example/Linux/CMakeLists.txt
src/ui-core/example/Plugin/CMakeLists.txt [new file with mode: 0644]
src/ui-core/example/Plugin/jni.h [moved from src/ui-core/inc/jni.h with 100% similarity, mode: 0644]
src/ui-core/example/Plugin/jni_md.h [moved from src/ui-core/inc/jni_md.h with 100% similarity, mode: 0644]
src/ui-core/example/Plugin/org_tizen_tools_areditor_sceneeditor_editor3d_NativeSceneEditor.cpp [new file with mode: 0644]
src/ui-core/example/Plugin/org_tizen_tools_areditor_sceneeditor_editor3d_NativeSceneEditor.h [moved from src/ui-core/inc/org_tizen_tools_areditor_sceneeditor_editor3d_NativeSceneEditor.h with 100% similarity, mode: 0644]
src/ui-core/libs/libEGL.dll [moved from src/ui-core/libs/mesa/libEGL.dll with 100% similarity]
src/ui-core/libs/libEGL.lib [moved from src/ui-core/libs/mesa/libEGL.lib with 100% similarity]
src/ui-core/libs/libGLESv2.dll [moved from src/ui-core/libs/mesa/libGLESv2.dll with 100% similarity]
src/ui-core/libs/libGLESv2.lib [moved from src/ui-core/libs/mesa/libGLESv2.lib with 100% similarity]
src/ui-core/src/CMakeLists.txt
src/ui-core/src/UcInterface.cpp
src/ui-core/src/org_tizen_tools_areditor_sceneeditor_editor3d_NativeSceneEditor.cpp [deleted file]

old mode 100755 (executable)
new mode 100644 (file)
index d2188ac..736d21f
@@ -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)
index dbf4e7c..e642741 100644 (file)
@@ -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 (file)
index 0000000..1a44497
--- /dev/null
@@ -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")
old mode 100755 (executable)
new mode 100644 (file)
similarity index 100%
rename from src/ui-core/inc/jni.h
rename to src/ui-core/example/Plugin/jni.h
old mode 100755 (executable)
new mode 100644 (file)
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 (file)
index 0000000..bd3d87e
--- /dev/null
@@ -0,0 +1,19 @@
+#include "org_tizen_tools_areditor_sceneeditor_editor3d_NativeSceneEditor.h"
+#include <UcInterface.h>
+#include <jni_md.h>
+
+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);
+}
+
index 2f63c91..1294cd4 100755 (executable)
@@ -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" )
index 1cf3361..a98da6a 100644 (file)
@@ -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 (executable)
index d7c9970..0000000
+++ /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 <jni_md.h>
-
-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();
-}
-