예제 #1
0
HRESULT ui::UIScrollBar::Render(graphics::D3DInteropHelper *pD3DInteropHelper, ID2D1RenderTarget *pRenderTarget) {
#ifdef DEBUG_UISCROLLBAR
  LOG_ENTER(SEVERITY_LEVEL_DEBUG) << L"propertyChanged = " << m_propertyChanged;
#endif
  if (m_propertyChanged || IsPropertyChanged()) {
    CHK_FATAL_HRESULT(Initialize(pD3DInteropHelper));
    CHK_FATAL_HRESULT(CreateDeviceDependentResources(pD3DInteropHelper, pRenderTarget));
    m_propertyChanged = false;
    SetPropertyChanged(false);
  }
  if (m_barPositionChanged) {
    UpdateBarPosition();
    m_barPositionChanged = false;
  }

  m_body->Render(pD3DInteropHelper, pRenderTarget, 1.0f);
  m_arrow1->Render(pD3DInteropHelper, pRenderTarget, 1.0f);
  m_arrow2->Render(pD3DInteropHelper, pRenderTarget, 1.0f);
  m_slideArea->Render(pD3DInteropHelper, pRenderTarget, 1.0f);
  m_bar->Render(pD3DInteropHelper, pRenderTarget, 1.0f);

#ifdef DEBUG_UISCROLLBAR
  LOG_LEAVE(SEVERITY_LEVEL_DEBUG);
#endif
  return S_OK;
}
예제 #2
0
파일: Scene.cpp 프로젝트: dsp56001/CPP2014
HRESULT Scene::CreateGraphicsResources(HWND hwnd)
{
	HRESULT hr = S_OK;
	if (m_pRenderTarget == NULL)
	{
		RECT rc;
		GetClientRect(hwnd, &rc);

		D2D1_SIZE_U size = D2D1::SizeU(rc.right, rc.bottom);

		hr = m_pFactory->CreateHwndRenderTarget(
			D2D1::RenderTargetProperties(),
			D2D1::HwndRenderTargetProperties(hwnd, size),
			&m_pRenderTarget
			);

		if (SUCCEEDED(hr))
		{
			hr = CreateDeviceDependentResources();
		}
		if (SUCCEEDED(hr))
		{
			CalculateLayout();
		}
	}
	return hr;
}
예제 #3
0
bool touchmind::view::path::impl::DefaultPathView::HitTest(
    touchmind::Context *pContext,
    ID2D1RenderTarget *pRenderTarget,
    D2D1_POINT_2F point)
{
    if (!_CheckValidity()) {
        return false;
    }
    CreateDeviceDependentResources(pContext, pRenderTarget);
    BOOL b;
    m_pathGeometry->StrokeContainsPoint(
        point,
        GetNodeModel().lock()->GetPathModel()->GetWidth() + 5.0f,
        nullptr,
        nullptr,
        &b);
    return (b == TRUE);
}
예제 #4
0
파일: Application.cpp 프로젝트: amxxL/Game
// Initialize the Direct3D resources required to run.
void Application::Initialize(int width, int height)
{
    m_window = std::make_unique<Window>(L"Game", width, height);
    m_window->RegisterUserData(reinterpret_cast<LONG_PTR>(this));

    m_deviceResources->SetWindow(m_window->GetHandle(), width, height);

    m_deviceResources->CreateDeviceResources();
    CreateDeviceDependentResources();

    m_deviceResources->CreateWindowSizeDependentResources();
    CreateWindowSizeDependentResources();

    // Scenes manager.
    m_sceneManager = std::make_unique<SceneManager>(m_deviceResources->GetD3DDeviceContext());
    m_sceneManager->PushScene(PlayScene::Instance());

    // TIP: Change the timer settings if you want something other than the default variable timestep mode.
    // e.g. for 60 FPS fixed timestep update logic, call:
    
    /*
    m_timer.SetFixedTimeStep(true);
    m_timer.SetTargetElapsedSeconds(1.0 / 60);
    */

    m_keyboard = std::make_unique<DirectX::Keyboard>();
    m_mouse = std::make_unique<Mouse>();
    //m_mouse->SetWindow(window);

    // Setup ImGui
    IMGUI_CHECKVERSION();
    ImGui::CreateContext();
    //ImGuiIO& io = ImGui::GetIO();
    ImGui_ImplWin32_Init(m_window->GetHandle());
    ImGui_ImplDX11_Init(m_deviceResources->GetD3DDevice(), m_deviceResources->GetD3DDeviceContext());
    ImGui::StyleColorsDark();

}
예제 #5
0
HRESULT ui::UIListBoxItem::Render(graphics::D3DInteropHelper *pD3DInteropHelper, ID2D1RenderTarget *pRenderTarget) {
#ifdef DEBUG_UILISTBOXITEM
  LOG_ENTER(SEVERITY_LEVEL_DEBUG);
#endif
  if (m_textChanged) {
    __RecreateAllTextLayout(pD3DInteropHelper, pRenderTarget);
    m_textChanged = false;
  }
  if (m_resourceChanged) {
    DiscardDeviceDependentResources();
    CreateDeviceDependentResources(pD3DInteropHelper, pRenderTarget);
    m_resourceChanged = true;
  }

  m_bodyRect->Render(pD3DInteropHelper, pRenderTarget, 1.0f);

  if (!m_bitmap->IsLoaded()) {
    m_bitmap->Load(pRenderTarget, pD3DInteropHelper->GetWICImagingFactory());
  }
  pRenderTarget->DrawBitmap(m_bitmap->GetBitmap(), m_bitmapLayoutRect.ToRectF());
  pRenderTarget->DrawTextLayout(D2D1::Point2F(m_mainTextLayoutRect.x, m_mainTextLayoutRect.y), m_mainTextLayout,
                                m_textBrushSet->Get(L"mainTextBrush")->GetBrush());
  pRenderTarget->DrawTextLayout(D2D1::Point2F(m_subText1LayoutRect.x, m_subText1LayoutRect.y), m_subText1Layout,
                                m_textBrushSet->Get(L"subText1Brush")->GetBrush());
  pRenderTarget->DrawTextLayout(D2D1::Point2F(m_subText2LayoutRect.x, m_subText2LayoutRect.y), m_subText2Layout,
                                m_textBrushSet->Get(L"subText2Brush")->GetBrush());

//     CComPtr<ID2D1SolidColorBrush> redBrush = nullptr;
//     pRenderTarget->CreateSolidColorBrush(D2D1::ColorF(D2D1::ColorF::Red), D2D1::BrushProperties(), &redBrush);
//     LOG(SEVERITY_LEVEL_DEBUG) << L"width = " << GetWidth() << L", height = " << GetHeight();
//     pRenderTarget->DrawRectangle(D2D1::RectF(0.0f, 0.0f, GetWidth(), GetHeight()), redBrush);

#ifdef DEBUG_UILISTBOXITEM
  LOG_LEAVE(SEVERITY_LEVEL_DEBUG);
#endif
  return S_OK;
}
예제 #6
0
void touchmind::view::path::impl::DefaultPathView::Draw(
    touchmind::Context *pContext,
    ID2D1RenderTarget *pRenderTarget )
{
    if (!_CheckValidity()) {
        return;
    }
    auto node = GetNodeModel().lock();
    auto path = node->GetPathModel();

    CreateDeviceDependentResources(pContext, pRenderTarget);
    if (path->IsSelected()) {
        FLOAT shadowOffset = GetNodeViewManager()->GetGaussFilter()->GetOffset();
        D2D1_SIZE_F size = m_pBitmap->GetSize();
        FLOAT left = m_bounds.left -  shadowOffset;
        FLOAT top  = m_bounds.top - shadowOffset;
        pRenderTarget->DrawBitmap(m_pBitmap, D2D1::RectF(left, top, left + size.width, top + size.height));
    }
    pRenderTarget->DrawGeometry(
        m_pathGeometry,
        m_pathBrush,
        path->GetWidthAsValue(),
        m_pathStyle);
}
void touchmind::view::linkedge::impl::ArrowLinkEdgeView::Fill(touchmind::Context *pContext,
                                                              ID2D1RenderTarget *pRenderTarget, ID2D1Brush *pBrush) {
  CreateDeviceDependentResources(pContext, pRenderTarget);
  pRenderTarget->FillGeometry(m_pArrowGeometry, pBrush == nullptr ? m_pBrush : pBrush);
}
예제 #8
0
파일: Application.cpp 프로젝트: amxxL/Game
void Application::OnDeviceRestored()
{
    CreateDeviceDependentResources();
    CreateWindowSizeDependentResources();
}