Example #1
0
void CFluidFX::ObstacleCollisionCheck(int xpos, int ypos)
{
    float relx = (float)xpos / m_width;
    float rely = (float)ypos / m_height;

    float dx = m_mouseX - relx;
    float dy = m_mouseY - rely;
    // roughly distance check !
    float collideDist = 0.01f * (AdjustX() * AdjustX() + AdjustY() * AdjustY());

    m_mouseOnObstacle = false;
    if (dx*dx + dy*dy <= collideDist)
    {
        m_mouseOnObstacle = true;
    }
}
Example #2
0
void CFluidFX::SetMousePosition(int xpos, int ypos)
{
    m_mouseX = (float)xpos / m_width;
    m_mouseY = (float)ypos / m_height;

    // Only need to update circle position
    FluidSetCirclePosition(m_mouseX, m_mouseY, RealWidth(), RealHeight(), AdjustX(), AdjustY());
}
Example #3
0
/* Process the movement of one line. */
void TList::LineTick( HDC DC )
{
  EraseLine(DC, CurrentLine);
  if (ColorDuration < 0)   SelectNewColor();
  if (!IncrementCount)     SelectNewDeltaValues();
  AdjustX(X1,DeltaX1);  AdjustX(X2,DeltaX2);
  AdjustY(Y1,DeltaY1);  AdjustY(Y2,DeltaY2);

  Line[CurrentLine].LX1 = X1;
  Line[CurrentLine].LX2 = X2;
  Line[CurrentLine].LY1 = Y1;
  Line[CurrentLine].LY2 = Y2;
  Line[CurrentLine].Color = PenColor;

  DrawLine(DC, CurrentLine);
  CurrentLine++;
  if (CurrentLine >= MaxLines)  CurrentLine = 1;
  ColorDuration--;
  IncrementCount--;
};
Example #4
0
bool CFluidFX::WindowResize(int width, int height)
{
    if (! CEffect::WindowResize(width, height))
        return false;

    if (width > m_widthLimit && height > m_heightLimit)
    {
        // re-create obstacle to maintain correct visual ratio, so
        // the circle won't looks like ellipsoid, and put obstacle in
        // correct position.
        //
        // So, don't return here, even though our real textures size
        // are unchanged. Re-create all to avoid strange result.
    }

    FluidResize(RealWidth(), RealHeight());
    FluidObstacleResize(m_mouseX, m_mouseY, RealWidth(), RealHeight(), AdjustX(), AdjustY());

    return true;
}