Advertisement
Guest User

Untitled

a guest
Sep 22nd, 2017
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.55 KB | None | 0 0
  1. #define CLAMP(v, l, u) (v)<(l):(l):(((v)>(u)):(u):(v))
  2.  
  3. void PSP::TileEngine::CCameraNew::Clamp()
  4. {
  5.     float fXAbs((((float)PSP::TileEngine::CGrid::Instance().Width() *
  6.         (float)(PSP::TileEngine::CGrid::Instance().CellWidth() * m_fScale)) / 2) - (PSP_SCREEN_WIDTH / 2));
  7.     float fYAbs((((float)PSP::TileEngine::CGrid::Instance().Height() *
  8.         (float)(PSP::TileEngine::CGrid::Instance().CellHeight() * m_fScale)) / 2) - (PSP_SCREEN_HEIGHT / 2));
  9.  
  10.     m_fv2Offset.x = CLAMP(m_fv2Offset.x, -fXAbs, fXAbs);
  11.     m_fv2Offset.y = CLAMP(m_fv2Offset.y, -fYAbs, fYAbs);
  12. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement