예제 #1
0
void UI::SetDebugHudProfileMode(DebugHudProfileMode mode)
{
    DebugHud* hud = GetSubsystem<DebugHud>();

    if (!hud)
        return;

    hud->SetProfilerMode(mode);
}
예제 #2
0
void UI::SetDebugHudRefreshInterval(float seconds)
{
    DebugHud* hud = GetSubsystem<DebugHud>();

    if (!hud)
        return;

    hud->SetProfilerInterval(seconds);
}
예제 #3
0
void UI::ToggleDebugHud()
{
    DebugHud* hud = GetSubsystem<DebugHud>();

    if (!hud)
        return;

    hud->ToggleAll();
}
예제 #4
0
void UI::CycleDebugHudMode()
{
    DebugHud* hud = GetSubsystem<DebugHud>();

    if (!hud)
        return;

    hud->CycleMode();
}
예제 #5
0
void UI::SetDebugHudExtents(bool useRootExtent, const IntVector2& position, const IntVector2& size)
{
    DebugHud* hud = GetSubsystem<DebugHud>();

    if (!hud)
        return;

    hud->SetExtents(useRootExtent, position, size);

}
void MasterControl::CreateConsoleAndDebugHud()
{
  // Create console
  Console* console = engine_->CreateConsole();
  console->SetDefaultStyle(defaultStyle_);
  console->GetBackground()->SetOpacity(0.8f);

  // Create debug HUD.
  DebugHud* debugHud = engine_->CreateDebugHud();
  debugHud->SetDefaultStyle(defaultStyle_);
}
예제 #7
0
void UI::ShowDebugHud(bool value)
{
    DebugHud* hud = GetSubsystem<DebugHud>();

    if (!hud)
        return;

    if (value)
        hud->SetMode(DEBUGHUD_SHOW_ALL);
    else
        hud->SetMode(DEBUGHUD_SHOW_NONE);
}
void Urho3DQtApplication::CreateConsoleAndDebugHud()
{
    // Get default style
    ResourceCache* cache = GetSubsystem<ResourceCache>();
    XMLFile* xmlFile = cache->GetResource<XMLFile>("UI/DefaultStyle.xml");

    // Create console
    Console* console = engine_->CreateConsole();
    console->SetDefaultStyle(xmlFile);

    // Create debug HUD.
    DebugHud* debugHud = engine_->CreateDebugHud();
    debugHud->SetDefaultStyle(xmlFile);
}
예제 #9
0
파일: Tower.cpp 프로젝트: Batanick/tower
void TowerApp::CreateConsoleAndDebugHud() {
    // Get default style
    ResourceCache *cache = GetSubsystem<ResourceCache>();
    XMLFile *xmlFile = cache->GetResource<XMLFile>("UI/DefaultStyle.xml");

    // Create console
    Console *console = engine_->CreateConsole();
    console->SetDefaultStyle(xmlFile);
    console->GetBackground()->SetOpacity(0.8f);

    // Create debug HUD.
    DebugHud *debugHud = engine_->CreateDebugHud();
    debugHud->SetDefaultStyle(xmlFile);
}
void Urho3DTemplate::SetWindowTitleAndIcon()
{
    //Get default style
    ResourceCache* cache = GetSubsystem<ResourceCache>();
    XMLFile* xmlfile = cache->GetResource<XMLFile>("UI/DefaulStyle.xml");

    //Create console
    Console* console = engine_->CreateConsole();
    console->SetDefaultStyle(xmlfile);
    console->GetBackground()->SetOpacity(0.0f);

    //Create debug HUD
    DebugHud* debugHud = engine_->CreateDebugHud();
    debugHud->SetDefaultStyle(xmlfile);
}
예제 #11
0
파일: Tower.cpp 프로젝트: Batanick/tower
void TowerApp::HandleKeyDown(StringHash, VariantMap &eventData) {
    using namespace KeyDown;

    int key = eventData[P_KEY].GetInt();

    // Close console (if open) or exit when ESC is pressed
    if (key == KEY_ESC) {
        Console *console = GetSubsystem<Console>();
        if (console->IsVisible())
            console->SetVisible(false);
        else
            engine_->Exit();

        return;
    }

    if (key == '`') {
        GetSubsystem<Console>()->Toggle();
        return;
    }

    // Toggle debug HUD with F2
    if (key == KEY_F2) {
        DebugHud *debugHud = GetSubsystem<DebugHud>();
        if (debugHud->GetMode() == 0 || debugHud->GetMode() == DEBUGHUD_SHOW_ALL_MEMORY)
            debugHud->SetMode(DEBUGHUD_SHOW_ALL);
        else
            debugHud->SetMode(DEBUGHUD_SHOW_NONE);
        return;
    }

    if (key == KEY_F3) {
        DebugHud *debugHud = GetSubsystem<DebugHud>();
        if (debugHud->GetMode() == 0 || debugHud->GetMode() == DEBUGHUD_SHOW_ALL)
            debugHud->SetMode(DEBUGHUD_SHOW_ALL_MEMORY);
        else
            debugHud->SetMode(DEBUGHUD_SHOW_NONE);

        return;
    }

    if (key == KEY_F4) {
        drawDebugGeometry = !drawDebugGeometry;
        return;
    }
}
예제 #12
0
//------------------------------------------------------------------------------------------------------------------------------------------------------
void BaseApplication::HandleKeyDown(StringHash eventType, VariantMap& eventData)
{
    using namespace Urho3D::KeyDown;

    int key = eventData[P_KEY].GetInt();

    // Close console (if open) or exit when ESC is pressed
    if (key == Urho3D::KEY_ESC)
    {
        Console* console = GetSubsystem<Console>();
        if (console->IsVisible())
            console->SetVisible(false);
        else
            engine_->Exit();
    }

    // Toggle console with F1
    else if (key == Urho3D::KEY_F1)
        GetSubsystem<Console>()->Toggle();

    // Toggle debug HUD with F2
    else if (key == Urho3D::KEY_F2)
    {
        DebugHud* debugHud = GetSubsystem<DebugHud>();
        if (debugHud->GetMode() == 0 || debugHud->GetMode() == DEBUGHUD_SHOW_ALL_MEMORY)
            debugHud->SetMode(DEBUGHUD_SHOW_ALL);
        else
            debugHud->SetMode(DEBUGHUD_SHOW_NONE);
    }
    else if (key == KEY_F3)
    {
        DebugHud* debugHud = GetSubsystem<DebugHud>();
        if (debugHud->GetMode() == 0 || debugHud->GetMode() == DEBUGHUD_SHOW_ALL)
            debugHud->SetMode(DEBUGHUD_SHOW_ALL_MEMORY);
        else
            debugHud->SetMode(DEBUGHUD_SHOW_NONE);
    }

    // Common rendering quality controls, only when UI has no focused element
    else if (!GetSubsystem<UI>()->GetFocusElement())
    {
        Renderer* renderer = GetSubsystem<Renderer>();

        // Preferences / Pause
        if (key == KEY_SELECT && touchEnabled_)
        {
            paused_ = !paused_;

            Input* input = GetSubsystem<Input>();
            if (screenJoystickSettingsIndex_ == M_MAX_UNSIGNED)
            {
                // Lazy initialization
                ResourceCache* cache = GetSubsystem<ResourceCache>();
                screenJoystickSettingsIndex_ = input->AddScreenJoystick(cache->GetResource<XMLFile>("UI/ScreenJoystickSettings_Samples.xml"), cache->GetResource<XMLFile>("UI/DefaultStyle.xml"));
            }
            else
                input->SetScreenJoystickVisible(screenJoystickSettingsIndex_, paused_);
        }

        // Texture quality
        else if (key == '1')
        {
            int quality = renderer->GetTextureQuality();
            ++quality;
            if (quality > QUALITY_HIGH)
                quality = QUALITY_LOW;
            renderer->SetTextureQuality(quality);
        }

        // Material quality
        else if (key == '2')
        {
            int quality = renderer->GetMaterialQuality();
            ++quality;
            if (quality > QUALITY_HIGH)
                quality = QUALITY_LOW;
            renderer->SetMaterialQuality(quality);
        }

        // Specular lighting
        else if (key == '3')
            renderer->SetSpecularLighting(!renderer->GetSpecularLighting());

        // Shadow rendering
        else if (key == '4')
            renderer->SetDrawShadows(!renderer->GetDrawShadows());

        // Shadow map resolution
        else if (key == '5')
        {
            int shadowMapSize = renderer->GetShadowMapSize();
            shadowMapSize *= 2;
            if (shadowMapSize > 2048)
                shadowMapSize = 512;
            renderer->SetShadowMapSize(shadowMapSize);
        }

        // Shadow depth and filtering quality
        else if (key == '6')
        {
            int quality = renderer->GetShadowQuality();
            ++quality;
            if (quality > SHADOWQUALITY_PCF_24BIT)
                quality = SHADOWQUALITY_SIMPLE_16BIT;
            renderer->SetShadowQuality((ShadowQuality)quality);
        }

        // Occlusion culling
        else if (key == '7')
        {
            bool occlusion = renderer->GetMaxOccluderTriangles() > 0;
            occlusion = !occlusion;
            renderer->SetMaxOccluderTriangles(occlusion ? 5000 : 0);
        }

        // Instancing
        else if (key == '8')
            renderer->SetDynamicInstancing(!renderer->GetDynamicInstancing());

        // Take screenshot
        else if (key == '9')
        {
            Graphics* graphics = GetSubsystem<Graphics>();
            Image screenshot(context_);
            graphics->TakeScreenShot(screenshot);
            // Here we save in the Data folder with date and time appended
            screenshot.SavePNG(GetSubsystem<FileSystem>()->GetProgramDir() + "Data/Screenshot_" +
                Time::GetTimeStamp().Replaced(':', '_').Replaced('.', '_').Replaced(' ', '_') + ".png");
        }
    }
}