cory.sharplin Posted November 18, 2010 Share Posted November 18, 2010 Character control for RPG style, Got one problem - when clicking on screen cursor is hiding, when pressing esc its showing. Must control that but can't find part of code that is responsible for that. Any ideas or help please? Link to comment
frustum Posted November 18, 2010 Share Posted November 18, 2010 core/scripts/system.h file has several defines for different mouse models: SOFT_MOUSE is demo mouse mode. USER_MOUSE the mouse is not controlled by system script. Link to comment
eugene.litvinov Posted January 17, 2011 Share Posted January 17, 2011 I have similary problem... I get system.h, but in Unigine 2010-11-29 this lines commented: //#define USER_MOUSE //#define SOFT_MOUSE //#define EXPORT_LOCALE //#define EXPORT_EXTERN I try use engine.app.getMouseShow()/engine.app.setMouseShow() but this is not help... I need sweech this two regimes: in one user control game's character and cursor is hided, but when user get some game's window - his character lost control and cursor is show, then user can move cursor to manipulate with window... how it could be done? Thanks. Link to comment
nathank Posted January 18, 2011 Share Posted January 18, 2011 I try use engine.app.getMouseShow()/engine.app.setMouseShow() but this is not help... Try setMouseGrab. Link to comment
frustum Posted January 18, 2011 Share Posted January 18, 2011 Define USER_MOUSE or SOFT_MOUSE inside your custom unigine.cpp file before system.h include. #define USER_MOUSE #include <core/unigine.h> #include <core/scripts/system.h> Link to comment
eugene.litvinov Posted January 18, 2011 Share Posted January 18, 2011 If I understand right, custom unigine.cpp - it's my main.cpp, my "enter point" in application? I added this define in it: #define USER_MOUSE #include <core/unigine.h> #include <core/scripts/system.h> #include <source/scripts/game/Game.h> #include <source/scripts/editor/Editor.h> #include <source/scripts/Global.h> int init() { Source::initGlobal(); return 1; } . . . But it's working exectly like earlier... When I use #define USER_MOUSE unigine not manage cursor and my application can show/hide it through engine.app.setMouseShow() or not? Link to comment
eugene.litvinov Posted January 18, 2011 Share Posted January 18, 2011 I don't use my custom unigine.cpp (I have not necessity yet), so I try add this define to SDK-binary\data\core\unigine.cpp - it's also don't get necessary result Link to comment
binstream Posted January 19, 2011 Share Posted January 19, 2011 I don't use my custom unigine.cpp (I have not necessity yet), so I try add this define to SDK-binary\data\core\unigine.cpp - it's also don't get necessary result It's OK to use custom unigine.cpp in the project, take a look at our samples (Heaven and so on). Refer to the manual for more info: Tutorials -> Adding Scripts to the Project Link to comment
eugene.litvinov Posted January 20, 2011 Share Posted January 20, 2011 Ok, I try to use custom unigine.cpp: I update my exec64.bat file: main_x64d -system_script data/source/unigine.cpp -console_command "world_load source/main" My project placed in folder SDK-binary\data\source\ (main.cpp and main.world placed here) unigine.cpp looks like: /* Copyright (C) 2005-2010, Unigine Corp. All rights reserved. * * File: unigine.cpp * Desc: Unigine system * Version: 1.00 * Author: Ivan Gulaev <tmifx@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/ */ //#define USER_MOUSE #include <unigine.h> #include <system.h> /******************************************************************************\ * * init/shutdown * \******************************************************************************/ /* */ int init() { systemInit(); engine.console.run("world_load source/main"); log.message("custom unigine.cpp init()\n"); return 1; } /* */ int shutdown() { systemShutdown(); return 1; } /******************************************************************************\ * * update * \******************************************************************************/ /* */ int update() { systemUpdate(); return 1; } But when I execure my bat file and launch unigine my custom file unigine.cpp not execute, log message custom unigine.cpp init() not output, and in console have no errors or warnings about custom unigine.cpp not finded or something else. Link to comment
eugene.litvinov Posted January 20, 2011 Share Posted January 20, 2011 In Windows console file all the same output Loading "core/unigine.cpp" 69ms Link to comment
binstream Posted January 20, 2011 Share Posted January 20, 2011 In Windows console file all the same output Loading "core/unigine.cpp" 69ms What is your data path? Please attach the full log.html Link to comment
eugene.litvinov Posted January 21, 2011 Share Posted January 21, 2011 Unigine log file 13:17:11 Loading "E:/unigine/SDK-binary/bin/unigine.cfg"... 13:17:15 Loading "opengl32.dll"... 13:17:15 Set 960x540 windowed video mode 13:17:17 Set 1.00 gamma value 13:17:17 Unigine engine http://unigine.com/ 13:17:17 Binary: Windows 64bit Visual C++ 1600 Debug Nov 29 2010 13:17:17 App path: E:/unigine/SDK-binary/bin/ 13:17:17 Data path: E:/unigine/SDK-binary/data/ 13:17:17 Save path: E:/unigine/SDK-binary/bin/ 13:17:17 13:17:17 ---- System ---- 13:17:17 System: Windows 7 (build 7600) 64bit 13:17:17 CPU: Intel(R) Core(TM)2 Duo CPU T5800 @ 2.00GHz 1994MHz MMX SSE SSE2 SSE3 SSSE3 HTT 13:17:17 GPU: NVIDIA GeForce 9300M GS 8.17.12.6099 13:17:17 System memory: 2042 Mb 13:17:17 Video memory: 256 Mb 13:17:17 13:17:17 ---- MathLib ---- 13:17:17 Set SSE simd processor 13:17:17 13:17:18 ---- Sound ---- 13:17:18 NULL 13:17:18 13:17:18 ---- Render ---- 13:17:18 Renderer: NVIDIA NV50 256Mb 13:17:18 OpenGL vendor: NVIDIA Corporation 13:17:18 OpenGL renderer: GeForce 9300M GS/PCI/SSE2 13:17:18 OpenGL version: 3.3.0 13:17:18 Found required GL_ARB_map_buffer_range 13:17:18 Found required GL_ARB_vertex_array_object 13:17:18 Found required GL_ARB_vertex_buffer_object 13:17:18 Found required GL_ARB_half_float_vertex 13:17:18 Found required GL_ARB_half_float_pixel 13:17:18 Found required GL_ARB_occlusion_query 13:17:18 Found required GL_EXT_texture3D 13:17:18 Found required GL_EXT_texture_cube_map 13:17:18 Found required GL_EXT_texture_sRGB 13:17:18 Found required GL_EXT_texture_swizzle 13:17:18 Found required GL_ARB_shader_object 13:17:18 Found required GL_ARB_vertex_shader 13:17:18 Found required GL_ARB_fragment_shader 13:17:18 Found required GL_ARB_draw_buffers 13:17:18 Found required GL_ARB_framebuffer_object 13:17:18 Found required GL_EXT_framebuffer_blit 13:17:18 Found required GL_EXT_framebuffer_multisample 13:17:18 Found optional GL_ARB_draw_instanced 13:17:18 Found optional GL_ARB_transform_feedback 13:17:18 Found optional GL_ARB_draw_elements_base_vertex 13:17:18 Found optional GL_EXT_draw_buffers2 13:17:18 Found optional GL_ARB_blend_func_extended 13:17:18 Found optional GL_ARB_uniform_buffer_object 13:17:18 Found optional GL_ARB_geometry_shader4 13:17:18 Found optional GL_ARB_gpu_shader4 13:17:18 Found optional GL_EXT_Cg_shader 13:17:18 Found optional GL_ARB_texture_rg 13:17:18 Found optional GL_ARB_texture_array 13:17:18 Found optional GL_ARB_texture_snorm 13:17:18 Found optional GL_ARB_texture_multisample 13:17:18 Found optional GL_ARB_texture_compression 13:17:18 Found optional GL_ARB_texture_compression_rgtc 13:17:18 Found optional GL_ARB_seamless_cube_map 13:17:18 Found optional RGB10A2 render texture format 13:17:18 Shading language: 3.30 NVIDIA via Cg compiler 13:17:18 Maximum texture size: 8192 13:17:18 Maximum texture units: 32 13:17:18 Maximum draw buffers: 8 13:17:18 13:17:18 ---- Physics ---- 13:17:18 Physics: Multi-threaded 13:17:18 13:17:18 Unigine~# world_load source/main 13:17:23 ---- Interpreter ---- 13:17:23 Version: 2.38 13:17:23 13:17:24 Loading "core/unigine.cpp" 889ms 13:17:24 Loading "core/locale/unigine.en" dictionary 13:17:24 Loading "core/materials/unigine_post.mat" 11 materials 11 shaders 47ms 13:17:24 Loading "core/materials/unigine_render.mat" 38 materials 178 shaders 11ms 13:17:24 Loading "core/materials/unigine_meshes.mat" 17 materials 11532 shaders 199ms 13:17:24 Loading "core/materials/unigine_terrains.mat" 1 material 144 shaders 1ms 13:17:24 Loading "core/materials/unigine_grass.mat" 1 material 69 shaders 3ms 13:17:24 Loading "core/materials/unigine_particles.mat" 1 material 45 shaders 4ms 13:17:24 Loading "core/materials/unigine_billboards.mat" 1 material 69 shaders 4ms 13:17:24 Loading "core/materials/unigine_volumes.mat" 6 materials 45 shaders 8ms 13:17:24 Loading "core/materials/unigine_guis.mat" 1 material 70 shaders 2ms 13:17:25 Loading "core/materials/unigine_water.mat" 1 material 101 shaders 50ms 13:17:25 Loading "core/materials/unigine_skies.mat" 1 material 13 shaders 41ms 13:17:25 Loading "core/materials/unigine_decals.mat" 1 material 55 shaders 3ms 13:17:25 Loading "core/properties/unigine.prop" 2 properties 0ms 13:17:25 Unigine~# editor_load 13:17:25 editor.showKeyLine(); 13:17:25 source/scripts/editor/gui/ToolBar.h:78: Interpreter::parse(): unknown token "editor" 13:17:28 Loading "data/core/editor/editor.cpp" 2165ms 13:17:28 13:17:28 ---- Editor ---- 13:17:28 Version: 0.54 13:17:28 13:17:50 Unigine~# world_load source/main 13:17:50 NameSpace::check(): unused variable "Source::ToolBar::aaaa" 13:17:50 NameSpace::check(): unused variable "Source::ToolBar::reloadWidgetIcon" 13:17:50 NameSpace::check(): unused variable "Source::ToolBar::changeCameraIcon" 13:17:50 NameSpace::check(): unused variable "Source::Editor::gui" 13:17:50 NameSpace::check(): unused variable "Source::NoteList::gui" 13:17:50 NameSpace::check(): unused variable "Source::Cursor::gui" 13:17:50 NameSpace::check(): unused variable "Source::Inventory::reloadWidgetIcon" 13:17:50 NameSpace::check(): unused variable "Source::Inventory::changeCameraIcon" 13:17:50 NameSpace::check(): unused variable "Source::TextPanel::spriteTop" 13:17:50 NameSpace::check(): unused variable "Source::TextPanel::spriteMiddle" 13:17:50 NameSpace::check(): unused variable "Source::TextPanel::spriteBottom" 13:17:50 NameSpace::check(): unused variable "Source::TextPanel::prevPageButton" 13:17:50 NameSpace::check(): unused variable "Source::TextPanel::nextPageButton" 13:17:50 NameSpace::check(): unused variable "Source::BaseObject::REDABILITY_OBJECT" 13:17:50 NameSpace::check(): unused variable "Source::BaseObject::HAND_OBJECT" 13:17:50 NameSpace::check(): unused variable "Source::BaseObject::INVENTORY_OBJECT" 13:17:50 NameSpace::check(): unused variable "Source::BaseObject::HIERARCHICAL_OBJECT" 13:17:50 NameSpace::check(): unused variable "Source::BaseObject::MODIFICATING_OBJECT" 13:17:50 NameSpace::check(): unused variable "Source::BaseObject::INTERACTIVE_OBJECT" 13:17:50 NameSpace::check(): unused variable "Source::GameObject::active" 13:17:50 NameSpace::check(): unused variable "Source::GameObject::orientation" 13:17:50 NameSpace::check(): unused variable "Source::Revolvable::rotation" 13:17:50 NameSpace::check(): unused variable "Source::Revolvable::rotToMouseSpeed" 13:17:50 NameSpace::check(): unused variable "Source::CharacterBase::aaa" 13:17:50 NameSpace::check(): unused variable "Source::Character::angleTest" 13:17:50 NameSpace::check(): unused variable "Source::Character::increase" 13:17:50 NameSpace::check(): unused array "Source::Game::boxes" 13:17:50 NameSpace::check(): unused variable "target_height" in "Source::CharacterBase::update" function 13:17:50 NameSpace::check(): unused variable "text" in "Source::Game::initGUI" function 13:17:50 NameSpace::check(): unused variable "friction" in "Source::Game::bodyContact" function 13:17:50 NameSpace::check(): unused variable "velocity" in "Source::Game::bodyContact" function 13:17:50 NameSpace::check(): unused variable "time" in "Source::Revolvable::update" function 13:17:50 NameSpace::check(): unused variable "indexBoneHip" in "Source::Revolvable::update" function 13:17:50 NameSpace::check(): unused variable "indexBoneHead" in "Source::Revolvable::update" function 13:17:50 NameSpace::check(): unused variable "radius" in "Source::Game::updateInteraction" function 13:17:50 NameSpace::check(): unused variable "desc" in "Source::Game::updateMouseState" function 13:17:50 NameSpace::check(): unused variable "rotation" in "Source::Game::updateMouseState" function 13:17:50 Loading "source/main.cpp" 515ms 13:17:50 Loading "source/materials/source.mat" 6 materials 28ms 13:17:50 Loading "source/properties/objects.prop" 7 properties 21ms 13:17:51 Loading "source/main.world" 393ms 13:17:51 13:17:51 ---- Editor Source ---- 13:17:51 Version: 0.1 13:17:51 13:17:55 Unigine~# editor_quit 13:17:55 13:17:55 ---- Game Source ---- 13:17:55 Version: 0.1 13:17:55 13:17:56 engine.app.getWidth(): 960 13:17:56 vBox.getWidth(): 544 13:17:56 x: 412 13:17:56 game: aaaaaaaaaaaaaaaa 13:17:56 ui: UserInterface 000000000AF53060 external (9:5:5) 13:17:56 mainPanel: WidgetVBox 000000000384EC80 external (11:2:2) 13:17:56 source = SoundSource 0000000003D5C8E0 external (70:0:0) 13:17:56 Game::init() 13:17:56 source = location 13:17:56 source = cube 13:17:56 prop.getName(): HandObject 13:17:56 source = table 13:17:56 prop.getName(): ReadabilityObject 13:17:56 source = robot 13:17:56 source = robotCharacter 13:17:56 prop.getName(): InteractiveObject 13:17:56 character: Source::Character 000000000482D5F0 (2621455:0:0) 13:17:56 robotSkin: ObjectMeshSkinned 0000000003D468B0 external (85:0:0) 13:17:56 Editor::shutdown() 13:17:56 Editor::destructor() 13:17:57 enterCallback: 1 13:17:57 enterCallback: 1 13:17:58 ToolBar::buttonPressHandler(): 1 13:17:59 GameGlobal::eventKeyRelease(): 100 13:17:59 enterCallback: 1 13:17:59 GameGlobal::eventKeyRelease(): 119 13:18:03 GameGlobal::eventKeyRelease(): 256 I try to use in bat file both -system_script data/source/unigine.cpp and -system_script source/unigine.cpp paths I could attach all test project, if it be easier Link to comment
binstream Posted January 21, 2011 Share Posted January 21, 2011 I try to use in bat file both -system_script data/source/unigine.cpp and -system_script source/unigine.cpp paths I could attach all test project, if it be easier send .bat launcher and customized unigine.cpp Link to comment
eugene.litvinov Posted January 22, 2011 Share Posted January 22, 2011 Oh, I set each parameter in .bat file from new line... and they was ignored ( Now I use next .bat file: main_x64d -system_script source/unigine.cpp This is work: custom unigine.cpp file is loading and system cursor always showed, thanks. But I need a little another functionality ;) Sorry, I think this post about how show/hide unigine cursor, not a system (in my case Windows) cursor... I need manage custom unigine cursor, is it possible? Thanks. Link to comment
binstream Posted January 22, 2011 Share Posted January 22, 2011 Sorry, I think this post about how show/hide unigine cursor, not a system (in my case Windows) cursor... I need manage custom unigine cursor, is it possible? Thanks. What exactly do you need to achieve? <Mind-reading> See engine.app.setMouseGrab() function. </Mind-reading> Link to comment
eugene.litvinov Posted January 23, 2011 Share Posted January 23, 2011 I see example TmifXgameTD and use next check: if (engine.app.getMouseButton() && !engine.controls.isMouseEnabled()) engine.controls.setMouseEnabled(1); This code is enough - I can use it when user interact with menus, and omit it when user control his PlayerActor. I only couldn't understand, what do function engine.app.getMouseButton() in this pattern. Thanks. Link to comment
eugene.litvinov Posted January 24, 2011 Share Posted January 24, 2011 Some experiments show, that this code not much too :) I use #define USER_MOUSE (how you recommended) and describe my cursor behavior based on code from update() function from system.h. It works, thanks a lot :) Link to comment
cory.sharplin Posted January 26, 2011 Author Share Posted January 26, 2011 Sorry forgot to respond we also sorted this, thanks for all the extra info. Link to comment
Recommended Posts