if (i == 1000)
{
IterateMainLoop();
+ UpdateScreen(1.0f);
}
}
)
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")
+TARGET_LINK_LIBRARIES(${this_target} "-llibui-core")
{
switch(msg)
{
- case WM_CLOSE:
- InitLibrary((int)hwnd, 400, 400);
- CreateVisualElement(0, 0, 200, 200);
- UpdateScreen(1.0f);
- DestroyWindow(hwnd);
- break;
+ case WM_LBUTTONDOWN:
+ InitLibrary((int)hwnd, 400, 400);
+ CreateVisualElement(0, 0, 200, 200);
+ break;
+
+ case WM_RBUTTONDOWN:
+ UpdateScreen(1.0f);
+ break;
- case WM_DESTROY:
- PostQuitMessage(0);
+ case WM_CLOSE:
+ DestroyWindow(hwnd);
break;
- default:
- return DefWindowProc(hwnd, msg, wParam, lParam);
+
+ case WM_DESTROY:
+ PostQuitMessage(0);
+ break;
+
+ default:
+ return DefWindowProc(hwnd, msg, wParam, lParam);
}
+
return 0;
}
-#ifdef _WIN32
-#include "jni.h"
-#include "jni_md.h"
+#ifndef _UC_INTERFACE_H_
+#define _UC_INTERFACE_H_
+
+// for win32, linux simulator
+#define UCEXPORT __declspec(dllexport)
-JNIEXPORT void JNICALL InitLibrary(int windowHandle, int width, int height);
-JNIEXPORT void JNICALL CreateVisualElement(int x, int y, int width, int height);
-JNIEXPORT void JNICALL ResizeWindow(int width, int height);
-JNIEXPORT void JNICALL UpdateScreen(float delayedTime);
-#else
+#ifdef _WIN32
+extern "C" UCEXPORT void InitLibrary(int windowHandle, int width, int height);
+extern "C" UCEXPORT void CreateVisualElement(int x, int y, int width, int height);
+extern "C" UCEXPORT void ResizeWindow(int width, int height);
+extern "C" UCEXPORT void UpdateScreen(float delayedTime);
+extern "C" UCEXPORT void IterateMainLoop(void);
+#elif LINUX
void InitLibrary(int windowHandle, int width, int height);
void CreateVisualElement(int x, int y, int width, int height);
void ResizeWindow(int width, int height);
void UpdateScreen(float delayedTime);
void IterateMainLoop(void);
#endif
+
+#endif // _UC_INTERFACE_H_
--- /dev/null
+/* DO NOT EDIT THIS FILE - it is machine generated */
+#include <jni.h>
+/* Header for class org_tizen_tools_areditor_sceneeditor_editor3d_NativeSceneEditor */
+
+#ifndef _Included_org_tizen_tools_areditor_sceneeditor_editor3d_NativeSceneEditor
+#define _Included_org_tizen_tools_areditor_sceneeditor_editor3d_NativeSceneEditor
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * Class: org_tizen_tools_areditor_sceneeditor_editor3d_NativeSceneEditor
+ * Method: init
+ * Signature: (III)V
+ */
+JNIEXPORT void JNICALL Java_org_tizen_tools_areditor_sceneeditor_editor3d_NativeSceneEditor_init
+ (JNIEnv *, jobject, jint, jint, jint);
+
+/*
+ * Class: org_tizen_tools_areditor_sceneeditor_editor3d_NativeSceneEditor
+ * Method: resize
+ * Signature: (II)V
+ */
+JNIEXPORT void JNICALL Java_org_tizen_tools_areditor_sceneeditor_editor3d_NativeSceneEditor_resize
+ (JNIEnv *, jobject, jint, jint);
+
+/*
+ * Class: org_tizen_tools_areditor_sceneeditor_editor3d_NativeSceneEditor
+ * Method: repaint
+ * Signature: (F)V
+ */
+JNIEXPORT void JNICALL Java_org_tizen_tools_areditor_sceneeditor_editor3d_NativeSceneEditor_repaint
+ (JNIEnv *, jobject, jfloat);
+
+
+#ifdef __cplusplus
+}
+#endif
+#endif
ADD_DEFINITIONS("-DVE_WIN32_GL -DBUILD_UI_CORE")
LIST(APPEND ${this_target}_SOURCE_FILES
+ org_tizen_tools_areditor_sceneeditor_editor3d_NativesceneEditor.cpp
${UIFW_DIRECTORY}/src/ui/animations/platform/FUiAnim_Win32Window.cpp
)
TARGET_LINK_LIBRARIES(${this_target} "-lX11" )
TARGET_LINK_LIBRARIES(${this_target} "-lXrender" )
TARGET_LINK_LIBRARIES(${this_target} "-ldl" )
-#TARGET_LINK_LIBRARIES(${this_target} "-lglib-2.0" )
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)
using namespace Tizen::Graphics;
using namespace Tizen::Ui::Animations;
-#ifdef LINUX
_NativeLayer* pNativeLayer = null;
-#elif _WIN32
-_GlLayer* pLayer = null;
-#endif
-DisplayContext* pDisplayContext = null;
+DisplayContext* pContext = null;
+VisualElement* pVisualElement = null;
void InitLibrary(int windowHandle, int width, int height)
{
#ifdef LINUX
pNativeLayer = _NativeLayer::CreateInstanceN();
- pNativeLayer->SetShowState(true);
- pDisplayContext = _DisplayContextImpl::CreatePublicInstance(*pNativeLayer);
#elif _WIN32
_Win32Window* pWindow = new _Win32Window(windowHandle);
+ pNativeLayer = new _GlLayer();
+ ((_GlLayer*)pNativeLayer)->ConstructForNativeWindow(*pWindow);
+#endif
- pLayer = new _GlLayer();
- pLayer->ConstructForNativeWindow(*pWindow);
- pLayer->SetShowState(true);
+ pNativeLayer->SetShowState(true);
- pDisplayContext = _DisplayContextImpl::CreatePublicInstance(*pLayer);
-#endif
+ pContext = _DisplayContextImpl::CreatePublicInstance(*pNativeLayer);
}
void CreateVisualElement(int x, int y, int width, int height)
{
-#ifdef LINUX
_RootVisualElement* pRoot = pNativeLayer->GetRootVisualElement();
-#elif _WIN32
- _RootVisualElement* pRoot = pLayer->GetRootVisualElement();
-#endif
- VisualElement* pElement = new VisualElement();
- pElement->Construct();
- pElement->SetShowState(true);
- pElement->SetBounds(FloatRectangle(x, y, width, height));
- pRoot->AttachChild(pElement);
+ pVisualElement = new VisualElement();
+ pVisualElement->Construct();
+ pVisualElement->SetShowState(true);
+ pVisualElement->SetBounds(FloatRectangle(x, y, width, height));
+ pRoot->AttachChild(pVisualElement);
//VisualElementSurface* pSurface = pElement->GetSurfaceN();
VisualElementSurface* pSurface = new VisualElementSurface();
- pSurface->Construct(*pDisplayContext, FloatDimension(100, 100));
+ pSurface->Construct(*pContext, FloatDimension(100, 100));
BufferInfo bufferInfo;
pSurface->GetBufferInfo(bufferInfo);
-// memset(bufferInfo.pPixels, 0x7, bufferInfo.width * bufferInfo.height * 4);
-
- pElement->SetSurface(pSurface);
+ memset(bufferInfo.pPixels, 0xFF, bufferInfo.width * bufferInfo.height * 4);
- pElement->Flush();
+ pVisualElement->SetSurface(pSurface);
}
void ResizeWindow(int width, int height)
{
- //pNativeLayer->SetBounds(width, height);
+ pNativeLayer->SetBounds(FloatRectangle(0, 0, width, height));
}
void UpdateScreen(float delayedTime)
{
-#ifdef _WIN32
- pLayer->Flush();
-#endif
+ pVisualElement->Flush();
+ pNativeLayer->Flush();
}
-void IterateMainLoop()
+void IterateMainLoop(void)
{
#ifdef LINUX
_Looper* pLooper = _Looper::GetInstance();
--- /dev/null
+// 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();
+}
+
Handle
_Win32Window::OnConstructing()
{
-
+ return null;
}
void