当前位置: 首页>>代码示例>>C++>>正文


C++ Input::SetMouseVisible方法代码示例

本文整理汇总了C++中Input::SetMouseVisible方法的典型用法代码示例。如果您正苦于以下问题:C++ Input::SetMouseVisible方法的具体用法?C++ Input::SetMouseVisible怎么用?C++ Input::SetMouseVisible使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Input的用法示例。


在下文中一共展示了Input::SetMouseVisible方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: SetVisible

void Console::SetVisible(bool enable)
{
    Input* input = GetSubsystem<Input>();
    background_->SetVisible(enable);
    closeButton_->SetVisible(enable);
    if (enable)
    {
        // Check if we have receivers for E_CONSOLECOMMAND every time here in case the handler is being added later dynamically
        bool hasInterpreter = PopulateInterpreter();
        commandLine_->SetVisible(hasInterpreter);
        if (hasInterpreter && focusOnShow_)
            GetSubsystem<UI>()->SetFocusElement(lineEdit_);

        // Ensure the background has no empty space when shown without the lineedit
        background_->SetHeight(background_->GetMinHeight());

        // Show OS mouse
        savedMouseVisibility_ = input->IsMouseVisible();
        input->SetMouseVisible(true);
    }
    else
    {
        rowContainer_->SetFocus(false);
        interpreters_->SetFocus(false);
        lineEdit_->SetFocus(false);

        // Restore OS mouse visibility
        input->SetMouseVisible(savedMouseVisibility_);
    }
}
开发者ID:AGreatFish,项目名称:Urho3D,代码行数:30,代码来源:Console.cpp

示例2: Update

void DebugCameraController::Update(float timeStep)
{
    // Do not move if the UI has a focused element
    if (GetUI()->GetFocusElement())
        return;

    // Do not move if interacting with UI controls
    if (GetSystemUI()->IsAnyItemActive())
        return;

    Input* input = GetInput();

    // Movement speed as world units per second
    float moveSpeed_ = speed_;
    if (input->GetKeyDown(KEY_SHIFT))
    {
        moveSpeed_ *= 2;

        if (input->GetKeyPress(KEY_KP_PLUS))
            speed_ += 1.f;
        else if (input->GetKeyPress(KEY_KP_MINUS))
            speed_ -= 1.f;
    }

    if (input->GetMouseButtonDown(MOUSEB_RIGHT))
    {
        IntVector2 delta = input->GetMouseMove();

        if (input->IsMouseVisible() && delta != IntVector2::ZERO)
            input->SetMouseVisible(false);

        auto yaw = GetNode()->GetRotation().EulerAngles().x_;
        if ((yaw > -90.f && yaw < 90.f) || (yaw <= -90.f && delta.y_ > 0) || (yaw >= 90.f && delta.y_ < 0))
            GetNode()->RotateAround(Vector3::ZERO, Quaternion(mouseSensitivity_ * delta.y_, Vector3::RIGHT), TS_LOCAL);
        GetNode()->RotateAround(GetNode()->GetPosition(), Quaternion(mouseSensitivity_ * delta.x_, Vector3::UP), TS_WORLD);
    }
    else if (!input->IsMouseVisible())
        input->SetMouseVisible(true);

    // Read WASD keys and move the camera scene node to the corresponding direction if they are pressed
    if (input->GetKeyDown(KEY_W))
        GetNode()->Translate(Vector3::FORWARD * moveSpeed_ * timeStep);
    if (input->GetKeyDown(KEY_S))
        GetNode()->Translate(Vector3::BACK * moveSpeed_ * timeStep);
    if (input->GetKeyDown(KEY_A))
        GetNode()->Translate(Vector3::LEFT * moveSpeed_ * timeStep);
    if (input->GetKeyDown(KEY_D))
        GetNode()->Translate(Vector3::RIGHT * moveSpeed_ * timeStep);
}
开发者ID:rokups,项目名称:Urho3D,代码行数:49,代码来源:DebugCameraController.cpp

示例3: MoveCamera

void Labyrinth::MoveCamera(float timeStep)
{
    // Do not move if the UI has a focused element (the console)
    if (GetSubsystem<UI>()->GetFocusElement())
        return;
    
    Input* input = GetSubsystem<Input>();
    input->SetMouseVisible(false);
    
    // Movement speed as world units per second
    const float MOVE_SPEED = 20.0f;
    // Mouse sensitivity as degrees per pixel
    const float MOUSE_SENSITIVITY = 0.1f;
    
    // Use this frame's mouse motion to adjust camera node yaw and pitch. Clamp the pitch between -90 and 90 degrees
    IntVector2 mouseMove = input->GetMouseMove();
    yaw_ += MOUSE_SENSITIVITY * mouseMove.x_;
    pitch_ += MOUSE_SENSITIVITY * mouseMove.y_;
    pitch_ = Clamp(pitch_, -90.0f, 90.0f);
    
    // Construct new orientation for the camera scene node from yaw and pitch. Roll is fixed to zero
    cameraNode_->SetRotation(Quaternion(pitch_, yaw_, 0.0f));
    
    // Read WASD keys and move the camera scene node to the corresponding direction if they are pressed
    if (input->GetKeyDown(KEY_UP))
        cameraNode_->Translate(Vector3::FORWARD * MOVE_SPEED * timeStep);
    if (input->GetKeyDown(KEY_DOWN))
        cameraNode_->Translate(Vector3::BACK * MOVE_SPEED * timeStep);
    if (input->GetKeyDown(KEY_LEFT))
        cameraNode_->Translate(Vector3::LEFT * MOVE_SPEED * timeStep);
    if (input->GetKeyDown(KEY_RIGHT))
        cameraNode_->Translate(Vector3::RIGHT * MOVE_SPEED * timeStep);
}
开发者ID:emp64,项目名称:TuxKing,代码行数:33,代码来源:Labyrinth.cpp

示例4: if

void DebugCameraController2D::Update(float timeStep)
{
    // Do not move if the UI has a focused element
    if (GetUI()->GetFocusElement())
        return;

    // Do not move if interacting with UI controls
    if (GetSystemUI()->IsAnyItemActive())
        return;

    Input* input = GetInput();

    // Movement speed as world units per second
    float moveSpeed_ = speed_;
    if (input->GetKeyDown(KEY_SHIFT))
    {
        moveSpeed_ *= 2;

        if (input->GetKeyPress(KEY_KP_PLUS))
            speed_ += 1.f;
        else if (input->GetKeyPress(KEY_KP_MINUS))
            speed_ -= 1.f;
    }

    if (input->GetMouseButtonDown(MOUSEB_RIGHT))
    {
        IntVector2 delta = input->GetMouseMove();

        if (input->IsMouseVisible() && delta != IntVector2::ZERO)
            input->SetMouseVisible(false);
        GetNode()->Translate2D(Vector2{(float)delta.x_ * -1.f, (float)delta.y_} * moveSpeed_ * timeStep);
    }
    else if (!input->IsMouseVisible())
        input->SetMouseVisible(true);

    // Read WASD keys and move the camera scene node to the corresponding direction if they are pressed
    if (input->GetKeyDown(KEY_W))
        GetNode()->Translate(Vector3::UP * moveSpeed_ * timeStep);
    if (input->GetKeyDown(KEY_S))
        GetNode()->Translate(Vector3::DOWN * moveSpeed_ * timeStep);
    if (input->GetKeyDown(KEY_A))
        GetNode()->Translate(Vector3::LEFT * moveSpeed_ * timeStep);
    if (input->GetKeyDown(KEY_D))
        GetNode()->Translate(Vector3::RIGHT * moveSpeed_ * timeStep);
}
开发者ID:rokups,项目名称:Urho3D,代码行数:45,代码来源:DebugCameraController.cpp

示例5: Start

	void IDE::Start()
	{
		// cache subsystems
		cache_ = GetSubsystem<ResourceCache>();
		ui_ = GetSubsystem<UI>();
		graphics_ = GetSubsystem<Graphics>();

		context_->RegisterSubsystem(new ProjectManager(context_));
		prjMng_ = GetSubsystem<ProjectManager>();
		prjMng_->SetProjectRootFolder(settings_->projectsRootDir_);

		// Get default style
		XMLFile* xmlFile = cache_->GetResource<XMLFile>("UI/DefaultStyle.xml");
		XMLFile* styleFile = cache_->GetResource<XMLFile>("UI/IDEStyle.xml");
		XMLFile* iconstyle = cache_->GetResource<XMLFile>("UI/IDEIcons.xml");

		ui_->GetRoot()->SetDefaultStyle(styleFile);

		// Create console
		console_ = engine_->CreateConsole();
		console_->SetDefaultStyle(xmlFile);
		console_->SetAutoVisibleOnError(true);

		// Create debug HUD.
		debugHud_ = engine_->CreateDebugHud();
		debugHud_->SetDefaultStyle(xmlFile);

		// Subscribe key down event
		SubscribeToEvent(E_KEYDOWN, HANDLER(IDE, HandleKeyDown));
		SubscribeToEvent(E_MENUBAR_ACTION, HANDLER(IDE, HandleMenuBarAction));
		SubscribeToEvent(E_OPENPROJECT, HANDLER(IDE, HandleOpenProject));

		// Create Cursor
		Cursor* cursor_ = new Cursor(context_);
		cursor_->SetStyleAuto(xmlFile);
		ui_->SetCursor(cursor_);
		if (GetPlatform() == "Android" || GetPlatform() == "iOS")
			ui_->GetCursor()->SetVisible(false);
		Input* input = GetSubsystem<Input>();
		// Use OS mouse without grabbing it
		input->SetMouseVisible(true);

		// create main ui
		rootUI_ = ui_->GetRoot()->CreateChild<UIElement>("IDERoot");
		rootUI_->SetSize(ui_->GetRoot()->GetSize());
		rootUI_->SetTraversalMode(TM_DEPTH_FIRST);     // This is needed for root-like element to prevent artifacts
		rootUI_->SetDefaultStyle(styleFile);


		editor_ = new Editor(context_);

		editor_->Create(NULL, NULL);

		
		ShowWelcomeScreen();
		
	}
开发者ID:PeaceSells50,项目名称:Urho3DIDE,代码行数:57,代码来源:IDE.cpp

示例6: Object

SampleSelector::SampleSelector(Context* context) :
    Object(context)
{
    UIView* view = FeatureExamples::GetUIView();

    UILayout* rootLayout = new UILayout(context_);
    rootLayout->SetAxis(UI_AXIS_Y);
    rootLayout->SetRect(view->GetRect());
    view->AddChild(rootLayout);

    const char* examples[] = {
        "Hello World",
        "Hello GUI",
        "Render to Texture",
        "2D Sprite",
        "2D Physics",
        "2D Constraints",
        "2D Rope",
        "2D Spriter Animation",
        "3D Static Scene",
        "3D Animating Scene",
        "3D Light Animation",
        "3D Billboards",
        "3D Particles",
        "3D Physics",
        "3D Skeletal Animation",
        "3D Decals",
        "3D Character",
        "3D Dynamic Geometry",
        "3D Ragdolls",
        "3D Vehicle Demo",
        "3D Crowd Navigation",
        "3D Water",
        "3D Multiple Viewports"
    };

    for (size_t i = 0; i < sizeof(examples) / sizeof(examples[0]); i++)
    {
        UIButton* button = new UIButton(context_);
        button->SetLayoutMinWidth(128);
        button->SetText(examples[i]);
        button->SetId(examples[i]);
        button->SubscribeToEvent(button, E_WIDGETEVENT, ATOMIC_HANDLER(SampleSelector, HandleWidgetEvent));
        rootLayout->AddChild(button);
    }

    Input* input = GetSubsystem<Input>();
    input->SetMouseVisible(true);
    input->SetMouseMode(MM_FREE);

    // Subscribe key up event
    SubscribeToEvent(E_KEYUP, ATOMIC_HANDLER(SampleSelector, HandleKeyUp));

    context->RegisterSubsystem(this);
}
开发者ID:LumaDigital,项目名称:AtomicExamples,代码行数:55,代码来源:SampleSelector.cpp

示例7: Start

	void Sample::Start()
	{
		context_->RegisterSubsystem(new NanoGUI(context_));		
		NanoGUI* nanogui = GetSubsystem<NanoGUI>();
		if (nanogui)
		{
			nanogui->Initialize();
		}
		cache_ = GetSubsystem<ResourceCache>();
		ui_ = GetSubsystem<UI>();
		graphics_ = GetSubsystem<Graphics>();
		
		//////////////////////////////////////////////////////////////////////////
		// Get default styles
		XMLFile* styleFile = cache_->GetResource<XMLFile>("UI/DefaultStyle.xml");
		ui_->GetRoot()->SetDefaultStyle(styleFile);
		// create main ui
		rootUI_ = ui_->GetRoot()->CreateChild<UIElement>("IDERoot");
		rootUI_->SetSize(ui_->GetRoot()->GetSize());
		rootUI_->SetTraversalMode(TM_DEPTH_FIRST);     // This is needed for root-like element to prevent artifacts
		rootUI_->SetDefaultStyle(styleFile);

		//////////////////////////////////////////////////////////////////////////
		/// Create console
		console_ = engine_->CreateConsole();
		console_->SetDefaultStyle(styleFile);

		//////////////////////////////////////////////////////////////////////////
		/// Create debug HUD.
		debugHud_ = engine_->CreateDebugHud();
		debugHud_->SetDefaultStyle(styleFile);

		//////////////////////////////////////////////////////////////////////////
		/// Subscribe key down event
		SubscribeToEvent(E_KEYDOWN, HANDLER(Sample, HandleKeyDown));

		// edit clear color, set background color
		Renderer* renderer = GetSubsystem<Renderer>();
		Zone* zone = renderer->GetDefaultZone();
		zone->SetFogColor(Color(0.3f, 0.3f, 0.4f)); // Set background color for the scene

		//////////////////////////////////////////////////////////////////////////
		/// Create Cursor
// 		Cursor* cursor_ = new Cursor(context_);
// 		cursor_->SetStyleAuto(styleFile);
// 		ui_->SetCursor(cursor_);
// 		if (GetPlatform() == "Android" || GetPlatform() == "iOS")
// 			ui_->GetCursor()->SetVisible(false);
		/// Show Platform Cursor
		Input* input = GetSubsystem<Input>();
		input->SetMouseVisible(true);


		
	}
开发者ID:lyz4534,项目名称:Urho3DSamples,代码行数:55,代码来源:Sample.cpp

示例8: CreateUI

void GameApplication::CreateUI()
{
	Input* input = GetSubsystem<Input>();
	input->SetMouseVisible(true);

    ResourceCache* cache = GetSubsystem<ResourceCache>();
    UI* ui = GetSubsystem<UI>();
    
    // Create a Cursor UI element because we want to be able to hide and show it at will. When hidden, the mouse cursor will
    // control the camera, and when visible, it will point the raycast target
    XMLFile* style = cache->GetResource<XMLFile>("UI/DefaultStyle.xml");
    SharedPtr<Cursor> cursor(new Cursor(context_));
    cursor->SetStyleAuto(style);
    ui->SetCursor(cursor);
    // Set starting position of the cursor at the rendering window center
    Graphics* graphics = GetSubsystem<Graphics>();
    cursor->SetPosition(graphics->GetWidth() / 2, graphics->GetHeight() / 2);
    
    // Construct new Text object, set string to display and font to use
    scoreText = ui->GetRoot()->CreateChild<Text>();
    scoreText->SetFont(cache->GetResource<Font>("Fonts/Anonymous Pro.ttf"), 15);
    // The text has multiple rows. Center them in relation to each other
    scoreText->SetTextAlignment(HA_CENTER);
	scoreText->SetColor(Color::BLUE);
	scoreText->SetTextEffect(TextEffect::TE_SHADOW);
    // Position the text relative to the screen center
    scoreText->SetHorizontalAlignment(HA_CENTER);
    scoreText->SetVerticalAlignment(VA_CENTER);
    scoreText->SetPosition(0, ui->GetRoot()->GetHeight() / 4 + 80);

	//开始按钮
	//UIButton* btnStart = new UIButton(context_);
	//btnStart->SetPosition(100,100);
	//btnStart->SetSize(120,50);

	//ui->GetRoot()->AddChild(btnStart);

	Button* btnStart = CreateButton(80,100,120,50,"Start");// ui->GetRoot()->CreateChild<Button>();
	btnStart->SetName("btnStart");
	btnStart->SetMinHeight(24);
	btnStart->SetStyleAuto();
	btnStart->SetPosition(100,100);
	btnStart->SetSize(120,50);

	Text* buttonText = btnStart->CreateChild<Text>();
	buttonText->SetAlignment(HA_CENTER, VA_CENTER);
	buttonText->SetColor(Color::BLUE);
	Font* font = cache->GetResource<Font>("Fonts/Anonymous Pro.ttf");
	buttonText->SetFont(font, 12);
	buttonText->SetText("Start");

	SubscribeToEvent(btnStart,E_PRESSED,HANDLER(GameApplication,OnButtonStartClick));

	UpdateScore();
}
开发者ID:xujingsy,项目名称:Urho3D_xujing,代码行数:55,代码来源:GameApplication.cpp

示例9: Start

void AEEditorCommon::Start()
{
    Input* input = GetSubsystem<Input>();
    input->SetMouseVisible(true);

    // Register IPC system
    context_->RegisterSubsystem(new IPC(context_));

    // Instantiate and register the Javascript subsystem
    Javascript* javascript = new Javascript(context_);
    context_->RegisterSubsystem(javascript);

    vm_ = javascript->InstantiateVM("MainVM");
    vm_->InitJSContext();

}
开发者ID:WorldofOpenDev,项目名称:AtomicGameEngine,代码行数:16,代码来源:AEEditorCommon.cpp

示例10: SetVisible

	void InGameEditor::SetVisible(bool enable)
	{
		if (enable != rootUI_->IsVisible())
		{
			Input* input = GetSubsystem<Input>();
			rootUI_->SetVisible(enable);

			if (enable)
			{
				// Show OS mouse
				input->SetMouseVisible(true, true);

				using namespace StartInGameEditor;
				VariantMap& newEventData = GetEventDataMap();
				SendEvent(E_START_INGAMEEDITOR_, newEventData);

				/// Subscribe input events
				SubscribeToEvent(E_KEYDOWN, URHO3D_HANDLER(InGameEditor, HandleKeyDown));
				SubscribeToEvent(E_KEYUP, URHO3D_HANDLER(InGameEditor, HandleKeyUp));
				// Subscribe HandleUpdate() function for processing update events
				SubscribeToEvent(E_UPDATE, URHO3D_HANDLER(InGameEditor, HandleUpdate));
				SetMainEditor(PluginScene3DEditor::GetTypeStatic());
	
			}
			else
			{
				// Restore OS mouse visibility
				input->ResetMouseVisible();
				ui_->SetFocusElement(NULL);

				using namespace QuitInGameEditor;
				VariantMap& newEventData = GetEventDataMap();
				SendEvent(E_QUIT_INGAMEEDITOR_, newEventData);

				/// Subscribe input events
				UnsubscribeFromEvent(E_KEYDOWN);
				UnsubscribeFromEvent(E_KEYUP);
				UnsubscribeFromEvent(E_UPDATE);
				if (mainEditorPlugin_)
				{
				//	mainEditorPlugin_->Leave();
				}
			}
		}
	}
开发者ID:PeaceSells50,项目名称:Urho3DIDE,代码行数:45,代码来源:InGameEditor.cpp

示例11: Start

	void Sample::Start()
	{

		cache_ = GetSubsystem<ResourceCache>();
		ui_ = GetSubsystem<UI>();
		graphics_ = GetSubsystem<Graphics>();
		
		//////////////////////////////////////////////////////////////////////////
		// Get default styles
		XMLFile* styleFile = cache_->GetResource<XMLFile>("UI/DefaultStyle.xml");
		ui_->GetRoot()->SetDefaultStyle(styleFile);
		// create main ui
		rootUI_ = ui_->GetRoot()->CreateChild<UIElement>("IDERoot");
		rootUI_->SetSize(ui_->GetRoot()->GetSize());
		rootUI_->SetTraversalMode(TM_DEPTH_FIRST);     // This is needed for root-like element to prevent artifacts
		rootUI_->SetDefaultStyle(styleFile);

		//////////////////////////////////////////////////////////////////////////
		/// Create console
		console_ = engine_->CreateConsole();
		console_->SetDefaultStyle(styleFile);

		//////////////////////////////////////////////////////////////////////////
		/// Create debug HUD.
		debugHud_ = engine_->CreateDebugHud();
		debugHud_->SetDefaultStyle(styleFile);

		//////////////////////////////////////////////////////////////////////////
		/// Subscribe key down event
		SubscribeToEvent(E_KEYDOWN, HANDLER(Sample, HandleKeyDown));

		// edit clear color, set background color
		Renderer* renderer = GetSubsystem<Renderer>();
		Zone* zone = renderer->GetDefaultZone();
		zone->SetFogColor(Color(0.3f, 0.3f, 0.4f)); // Set background color for the scene

		//////////////////////////////////////////////////////////////////////////
		/// Create Cursor
// 		Cursor* cursor_ = new Cursor(context_);
// 		cursor_->SetStyleAuto(styleFile);
// 		ui_->SetCursor(cursor_);
// 		if (GetPlatform() == "Android" || GetPlatform() == "iOS")
// 			ui_->GetCursor()->SetVisible(false);
		/// Show Platform Cursor
		Input* input = GetSubsystem<Input>();
		input->SetMouseVisible(true);

		//////////////////////////////////////////////////////////////////////////
		/// create an svg image
		rootUI_->AddChild(CreateSVGSprite("GameData/svg/23.svg"));

		Sprite* drawing = CreateSVGSprite("GameData/svg/drawing.svg");
		if (drawing)
		{
			// Set logo sprite hot spot
			drawing->SetHotSpot(0, drawing->GetHeight());
			drawing->SetAlignment(HA_LEFT, VA_BOTTOM);
			rootUI_->AddChild(drawing);
		}
		Sprite* nano = CreateSVGSprite("GameData/svg/nano.svg");
		if (nano)
		{
			// Set logo sprite hot spot
			nano->SetHotSpot(0, -nano->GetHeight());
			nano->SetAlignment(HA_LEFT, VA_TOP);
			rootUI_->AddChild(nano);
		}
		
	}
开发者ID:lyz4534,项目名称:Urho3DSamples,代码行数:69,代码来源:Sample.cpp

示例12: Start

	void Sample::Start()
	{

		cache_ = GetSubsystem<ResourceCache>();
		ui_ = GetSubsystem<UI>();
		graphics_ = GetSubsystem<Graphics>();
		
		//////////////////////////////////////////////////////////////////////////
		// Get default styles
		XMLFile* styleFile = cache_->GetResource<XMLFile>("UI/IDEStyle.xml");
		XMLFile* iconstyleFile = cache_->GetResource<XMLFile>("UI/EditorIcons.xml");
		ui_->GetRoot()->SetDefaultStyle(styleFile);

		// create scene main ui
		rootUI_ = ui_->GetRoot()->CreateChild<UIElement>("UI");
		rootUI_->SetSize(ui_->GetRoot()->GetSize());
		rootUI_->SetTraversalMode(TM_DEPTH_FIRST);     // This is needed for root-like element to prevent artifacts
		rootUI_->SetDefaultStyle(styleFile);
		// All user - created UI elements have lowest priority so they do not cover editor's windows
		rootUI_->SetPriority(-1000);

		//////////////////////////////////////////////////////////////////////////
		/// Create HierarchyWindow
		uihierarchyWindow_ = rootUI_->CreateChild<HierarchyWindow>("UIHierarchyWindow");
		uihierarchyWindow_->SetSize(200, 200);
		uihierarchyWindow_->SetDefaultStyle(styleFile);
		uihierarchyWindow_->SetStyleAuto();
		uihierarchyWindow_->SetMovable(true);
		uihierarchyWindow_->SetIconStyle(iconstyleFile);
		uihierarchyWindow_->SetTitle("UI Hierarchy");
		uihierarchyWindow_->SetAlignment(HA_RIGHT, VA_TOP);
		/// \todo
		// dont know why the auto style does not work ... 
		uihierarchyWindow_->SetTexture(cache_->GetResource<Texture2D>("Textures/UI.png"));
		uihierarchyWindow_->SetImageRect(IntRect(48, 0, 64, 16));
		uihierarchyWindow_->SetBorder(IntRect(4, 4, 4, 4));
		uihierarchyWindow_->SetResizeBorder(IntRect(8, 8, 8, 8));

		



		sceneHierarchyWindow_ = rootUI_->CreateChild<HierarchyWindow>("SceneHierarchyWindow");
		sceneHierarchyWindow_->SetSize(200, 200);
		sceneHierarchyWindow_->SetDefaultStyle(styleFile);
		sceneHierarchyWindow_->SetStyleAuto();
		sceneHierarchyWindow_->SetMovable(true);
		sceneHierarchyWindow_->SetIconStyle(iconstyleFile);
		sceneHierarchyWindow_->SetTitle("Scene Hierarchy");
		sceneHierarchyWindow_->SetAlignment(HA_LEFT, VA_TOP);
		/// \todo
		// dont know why the auto style does not work ... 
		sceneHierarchyWindow_->SetTexture(cache_->GetResource<Texture2D>("Textures/UI.png"));
		sceneHierarchyWindow_->SetImageRect(IntRect(48, 0, 64, 16));
		sceneHierarchyWindow_->SetBorder(IntRect(4, 4, 4, 4));
		sceneHierarchyWindow_->SetResizeBorder(IntRect(8, 8, 8, 8));




		//////////////////////////////////////////////////////////////////////////
		/// Create console
		console_ = engine_->CreateConsole();
		console_->SetDefaultStyle(styleFile);

		//////////////////////////////////////////////////////////////////////////
		/// Create debug HUD.
		debugHud_ = engine_->CreateDebugHud();
		debugHud_->SetDefaultStyle(styleFile);

		//////////////////////////////////////////////////////////////////////////
		/// Subscribe key down event
		SubscribeToEvent(E_KEYDOWN, HANDLER(Sample, HandleKeyDown));

		// edit clear color, set background color
		Renderer* renderer = GetSubsystem<Renderer>();
		Zone* zone = renderer->GetDefaultZone();
		zone->SetFogColor(Color(0.3f, 0.3f, 0.4f)); // Set background color for the scene

		//////////////////////////////////////////////////////////////////////////
		/// Create Cursor
// 		Cursor* cursor_ = new Cursor(context_);
// 		cursor_->SetStyleAuto(styleFile);
// 		ui_->SetCursor(cursor_);
// 		if (GetPlatform() == "Android" || GetPlatform() == "iOS")
// 			ui_->GetCursor()->SetVisible(false);
		/// Show Platform Cursor
		Input* input = GetSubsystem<Input>();
		input->SetMouseVisible(true);

		// Create the scene content
		CreateScene();

		// Create the UI content
		CreateInstructions();

		// Setup the viewport for displaying the scene
		SetupViewport();

		// Hook up to the frame update and render post-update events
//.........这里部分代码省略.........
开发者ID:lyz4534,项目名称:Urho3DSamples,代码行数:101,代码来源:Sample.cpp


注:本文中的Input::SetMouseVisible方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。