Example #1
0
void Image::Reset()
{
	// Set amount of rows & cols if animation is non-null
	rows = (animation == nullptr) ? 1 : animation->rows;
	cols = (animation == nullptr) ? 1 : animation->cols;

	max_frame = rows * cols - 1;
	
	// Find dimensions of the texture
	int _query = SDL_QueryTexture(texture, NULL, NULL, &width, &height);

	// Check for texture error
	if (_query < 0) Log::s(Log::e << "Texture query error occured on an Image" << SDL_GetError());

	frame_width = width / cols;
	frame_height = height / rows;
	src->w = frame_width;
	src->h = frame_height;

	// Reset routine for position, animation data, frame, and scale
	SetFrameDelay( (animation == nullptr) ? 1 : animation->delay );
	SetAnimate(true);
	SetPosition(0, 0);
	SetFrame(0);
	Scale(1.0f);
}
Example #2
0
void CMagneticView::ClearAll(void)
{
  CMagneticApp* pApp = (CMagneticApp*)AfxGetApp();

  m_strOutput.Empty();
  m_strStatLocation.Empty();
  m_strStatScore.Empty();
  m_strStatCurrent.Empty();
  m_Scrollback.GetScrollback().Empty();
  m_PageTable.RemoveAll();
  m_Input.RemoveAll();
  m_History.RemoveAll();
  m_iLines = 0;
  m_iMaxLines = 0;
  m_bStatusBar = false;
  m_bAnimate = false;

  pApp->SetGameLoaded(0);

  m_Recording = Recording::RecordingOff;
  if (m_pFileRecord)
    fclose(m_pFileRecord);
  m_pFileRecord = NULL;
  m_Scripting = Scripting::ScriptingOff;
  if (m_pFileScript)
    fclose(m_pFileScript);
  m_pFileScript = NULL;
  m_strScript.Empty();

  if (m_PicWnd.GetSafeHwnd())
    m_PicWnd.SendMessage(WM_CLOSE,0,0);
  m_Picture.ClearAll();
  SetAnimate(FALSE);
  ClearAnims();
}