kadir.basol Posted February 5, 2012 Share Posted February 5, 2012 Hello , i want to add some of my JavaFX addons to my engine. But there is some problems , I donno how to access HWND on Windows side to embed my javafx code. Can someone help how to access HWND on C++ side? Link to comment
frustum Posted February 5, 2012 Share Posted February 5, 2012 HWND window = (HWND)Unigine::App::get()->getHandle(); Link to comment
kadir.basol Posted February 5, 2012 Author Share Posted February 5, 2012 No way , i think you are giving script side solution here is my code on visual studio : /* Copyright © 2005-2011, Unigine Corp. All rights reserved. * * File: main.cpp * Desc: Unigine application * Version: 1.01 * Author: Alexander Zaprjagaev <frustum@unigine.com> * * This file is part of the Unigine engine (http://unigine.com/). * * Your use and or redistribution of this software in source and / or * binary form, with or without modification, is subject to: (i) your * ongoing acceptance of and compliance with the terms and conditions of * the Unigine License Agreement; and (ii) your inclusion of this notice * in any version of this software that you use or redistribute. * A copy of the Unigine License Agreement is available by contacting * Unigine Corp. at http://unigine.com/ */ #include <Unigine.h> #include <UnigineInterpreter.h> /* */ using namespace Unigine; /* */ // 1. Create an extern function that receives a script node as a smart pointer NodePtr void my_node_set(NodePtr node) { // 1.1. Call the node member function exposed through the C++ API node->setTransform(translate(vec3(1.0f,2.0f,3.0f))); } /* */ int main(int argc,char **argv) { Engine *engine = Engine::init(UNIGINE_VERSION,argc,argv); engine->main(); Engine::shutdown(); return 0; } how to reach HWND on C++ side? i will push java virtual machine on there and need to access raw OpenGL. Link to comment
frustum Posted February 6, 2012 Share Posted February 6, 2012 Unigine::App is a C++ API class: #include <Unigine.h> #include <UnigineApp.h> using namespace Unigine; int main(int argc,char **argv) { Engine *engine = Engine::init(UNIGINE_VERSION,argc,argv); HWND window = (HWND)App::get()->getHandle(); do_smth_with_window(window); engine->main(); Engine::shutdown(); } Link to comment
kadir.basol Posted February 8, 2012 Author Share Posted February 8, 2012 I've added but had problem :HWND window = (HWND)App::get()->getHandle(); 1>------ Build started: Project: main_vc2010, Configuration: Debug Win32 ------ 1>Build started 08/02/2012 23:38:02. 1>InitializeBuildStatus: 1> Touching "Debug\main_vc2010.unsuccessfulbuild". 1>ClCompile: 1> main.cpp 1>main.cpp(47): error C2027: use of undefined type 'Unigine::App' 1> C:\UnigineSDK\include\Unigine.h(36) : see declaration of 'Unigine::App' 1>main.cpp(47): error C2227: left of '->getHandle' must point to class/struct/union/generic type 1> type is ''unknown-type'' 1>main.cpp(47): error C3861: 'get': identifier not found 1> 1>Build FAILED. 1> 1>Time Elapsed 00:00:00.58 ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ========== Link to comment
manguste Posted February 13, 2012 Share Posted February 13, 2012 Are you absolutely sure that you've included UnigineApp.h? You can check source/plugins/Interface/Interface.cpp for reference, where the handle is returned without any problem. Link to comment
kadir.basol Posted February 25, 2012 Author Share Posted February 25, 2012 I've tried this: /* Copyright (C) 2005-2011, Unigine Corp. All rights reserved. * * File: main.cpp * Desc: Unigine application * Version: 1.01 * Author: Alexander Zaprjagaev <frustum@unigine.com> * * This file is part of the Unigine engine (http://unigine.com/). * * Your use and or redistribution of this software in source and / or * binary form, with or without modification, is subject to: (i) your * ongoing acceptance of and compliance with the terms and conditions of * the Unigine License Agreement; and (ii) your inclusion of this notice * in any version of this software that you use or redistribute. * A copy of the Unigine License Agreement is available by contacting * Unigine Corp. at http://unigine.com/ */ #include <Windows.h> #include <Unigine.h> #include <UnigineInterpreter.h> /* */ using namespace Unigine; /* */ // 1. Create an extern function that receives a script node as a smart pointer NodePtr void my_node_set(NodePtr node) { // 1.1. Call the node member function exposed through the C++ API node->setTransform(translate(vec3(1.0f,2.0f,3.0f))); } void do_smth_with_window(HWND hWnd) { } /* */ int main(int argc,char **argv) { Engine *engine = Engine::init(UNIGINE_VERSION,argc,argv); //HWND window = (HWND)Unigine::App::get()->getHandle(); HWND window = (HWND)App::get()->getHandle(); //App* app = Unigine::App; //do_smth_with_window(window); //engine->getAppPath(); engine->main(); //engine->getAppPath() setIcon(new Image("my_icon.png")); //engine->runConsole(""); //Engine::main(); //engine.app.setIcon(new Image("my_icon.png")); //engine.console.setLock(1) Engine::shutdown(); return 0; } When i try to compile code up , i've got this error on compilation: 1>------ Rebuild All started: Project: main_vc2010, Configuration: Debug Win32 ------ 1>Build started 25/02/2012 17:03:50. 1>_PrepareForClean: 1> Deleting file "Debug\main_vc2010.lastbuildstate". 1>InitializeBuildStatus: 1> Touching "Debug\main_vc2010.unsuccessfulbuild". 1>ClCompile: 1> main.cpp 1>main.cpp(47): error C2027: use of undefined type 'Unigine::App' 1> C:\UnigineSDK\include\Unigine.h(36) : see declaration of 'Unigine::App' 1>main.cpp(47): error C2227: left of '->getHandle' must point to class/struct/union/generic type 1> type is ''unknown-type'' 1>main.cpp(47): error C3861: 'get': identifier not found 1> 1>Build FAILED. 1> 1>Time Elapsed 00:00:00.55 ========== Rebuild All: 0 succeeded, 1 failed, 0 skipped ========== Link to comment
kadir.basol Posted February 27, 2012 Author Share Posted February 27, 2012 /* Copyright © 2005-2011, Unigine Corp. All rights reserved. * * File: main.cpp * Desc: Unigine application * Version: 1.01 * Author: Alexander Zaprjagaev <frustum@unigine.com> * * This file is part of the Unigine engine (http://unigine.com/). * * Your use and or redistribution of this software in source and / or * binary form, with or without modification, is subject to: (i) your * ongoing acceptance of and compliance with the terms and conditions of * the Unigine License Agreement; and (ii) your inclusion of this notice * in any version of this software that you use or redistribute. * A copy of the Unigine License Agreement is available by contacting * Unigine Corp. at http://unigine.com/ */ #include <Windows.h> #include <Unigine.h> #include <UnigineInterpreter.h> #include <UnigineImage.h> #include <UnigineApp.h> //<-- included this but same problem persists /* */ using namespace Unigine; // 0. ImagePtr must be defined as a global variable ImagePtr image; // 1.1. Create an image in the Unigine memory pool through ImagePtr smart pointer ImagePtr my_image_create_0() { image = Image::create(); // 1.2. Specify parameters of the image and fill it with black color image->create2D(128,128,Image::FORMAT_RG8); return image; } /* */ // 1. Create an extern function that receives a script node as a smart pointer NodePtr void my_node_set(NodePtr node) { // 1.1. Call the node member function exposed through the C++ API node->setTransform(translate(vec3(1.0f,2.0f,3.0f))); } void do_smth_with_window(HWND hWnd) { } /* */ int main(int argc,char **argv) { Engine *engine = Engine::init(UNIGINE_VERSION,argc,argv); // 2. Register the function for export into Unigine Interpreter::addExternFunction("my_image_create_0",MakeExternFunction(&my_image_create_0)); HWND window = (HWND)App::get()->getHandle(); //HWND window = (HWND)App::get()->getHandle(); //App* app = Unigine::App; //do_smth_with_window(window); //engine->getAppPath(); //const char *datapath = engine->getDataPath(); //printf("Data path:"); //printf(datapath); engine->main(); //engine->getAppPath() setIcon(new Image("my_icon.png")); //engine->runConsole(""); //Engine::main(); //engine.app.setIcon(new Image("my_icon.png")); //engine.console.setLock(1) Engine::shutdown(); return 0; } 1>------ Rebuild All started: Project: main_vc2010, Configuration: Release Win32 ------ 1>Build started 27/02/2012 18:13:55. 1>_PrepareForClean: 1> Deleting file "Release\main_vc2010.lastbuildstate". 1>InitializeBuildStatus: 1> Touching "Release\main_vc2010.unsuccessfulbuild". 1>ClCompile: 1> main.cpp 1>main.cpp(64): error C2039: 'getHandle' : is not a member of 'Unigine::App' 1> C:\UnigineSDK\include\UnigineApp.h(32) : see declaration of 'Unigine::App' 1> 1>Build FAILED. 1> 1>Time Elapsed 00:00:00.61 ========== Rebuild All: 0 succeeded, 1 failed, 0 skipped ========== Link to comment
manguste Posted February 28, 2012 Share Posted February 28, 2012 What SDK version do you use? Check include/UnigineApp.h, there should be the following function: virtual void *getHandle() = 0; If not, you need a later version: getting a window handle via this function was added at your request in 2011-12-28 SDK. Link to comment
kadir.basol Posted September 22, 2012 Author Share Posted September 22, 2012 i cant download that version.my membership ended. But why are you canceling download for old download and old documentations? ( that we bought at the times ) Link to comment
ulf.schroeter Posted September 23, 2012 Share Posted September 23, 2012 only the latest SDK version is available for download. It's a good idea to have a local backup copy of each version. Matching SDK documentation for each version can always be found in <SDK>\docs folder. Link to comment
kadir.basol Posted September 23, 2012 Author Share Posted September 23, 2012 Well but i want my last membership day download and docs back. Why i cant access my old membership downloads Link to comment
ulf.schroeter Posted September 24, 2012 Share Posted September 24, 2012 Just read the post why. Maybe by sending an e-mail to support@UNIGINE.com they might provide you your latest SDK download via FTP. Link to comment
Recommended Posts