Logo Search packages:      
Sourcecode: dasher version File versions

DasherView.inl

// DasherView.inl
//
/////////////////////////////////////////////////////////////////////////////
//
// Copyright (c) 2001-2002 David Ward
//
/////////////////////////////////////////////////////////////////////////////


inline void Dasher::CDasherView::Render()
{
      m_Screen->Blank();
      
      // Render nodes to screen object (should use off screen buffer)
      if (m_DasherModel.Root()!=NULL) {
            RecursiveRender(m_DasherModel.Root(), m_DasherModel.Rootmin(), m_DasherModel.Rootmax(), 2, false);
            RecursiveRender(m_DasherModel.Root(), m_DasherModel.Rootmin(), m_DasherModel.Rootmax(), 2, true);
            Crosshair(m_DasherModel.DasherOX()); // add crosshair
      //    m_Screen->Display();                 // copy from buffer to screen
      }
}

inline void Dasher::CDasherView::MapScreen(screenint* DrawX, screenint* DrawY)
{
      using namespace Dasher::Opts;
      
      switch (ScreenOrientation) {
            case (LeftToRight):
                  break;
            case (RightToLeft):
                  *DrawX = m_Screen->GetWidth() - *DrawX;
                  break;
            case (TopToBottom): {
                  screenint Swapper = ( *DrawX * m_Screen->GetHeight()) / m_Screen->GetWidth();
                  *DrawX = (*DrawY  * m_Screen->GetWidth()) / m_Screen->GetHeight();
                  *DrawY = Swapper;
                  break;
                  }
            case (BottomToTop): {
                  // Note rotation by 90 degrees not reversible like others
                  screenint Swapper = m_Screen->GetHeight() - ( *DrawX * m_Screen->GetHeight()) / m_Screen->GetWidth();
                  *DrawX = (*DrawY  * m_Screen->GetWidth()) / m_Screen->GetHeight();
                  *DrawY = Swapper;
                  break;
                  }
            default:
                  break;
      }
}


inline void Dasher::CDasherView::UnMapScreen(screenint* MouseX, screenint* MouseY)
{
      using namespace Dasher::Opts;
      
      switch (ScreenOrientation) {
            case (LeftToRight):
                  break;
            case (RightToLeft):
                  *MouseX = m_Screen->GetWidth() - *MouseX;
                  break;
            case (TopToBottom): {
                  screenint Swapper = (*MouseX * m_Screen->GetHeight()) / m_Screen->GetWidth();
                  *MouseX = (*MouseY *m_Screen->GetWidth()) / m_Screen->GetHeight();;
                  *MouseY = Swapper;
                  break;
                  }
            case (BottomToTop): {
                  screenint Swapper = (*MouseX * m_Screen->GetHeight()) / m_Screen->GetWidth();
                  *MouseX = ((m_Screen->GetHeight() - *MouseY) * m_Screen->GetWidth()) / m_Screen->GetHeight();
                  *MouseY = Swapper;
                  break;
                  }
            default:
                  break;
      }
}

Generated by  Doxygen 1.6.0   Back to index