bool Overlay::Initialize( const Graphics &Gfx ) { FontLoader fntLoader; bool result = fntLoader.Initialize(); RETURN_IF_FALSE( result ); m_Font = fntLoader.MakeFont( L"Arial",24.f ); RETURN_IF_FALSE( m_Font != nullptr ); float left = 100.f; float top = 100.f; float right = left + 450.f; float bottom = top + 40.f; D2D1_RECT_F rect( D2D1::RectF( left, top, right, bottom ) ); // Multi-line strings have to use the \ at the end, and the spacing // from the first column of the file it is declared in, is the offset // it will have on screen. std::wstring mesg( L"Congratulations!!!\n\ You've reached the end of the maze.\n\ Would you like to load another one? \n\ Press Y to regenerate the maze, ESC to close program.\n" ); msg.reset( new MessageBox_Goal( mesg, rect ) ); return true; }
void StopWatch::Step() { RETURN_IF_FALSE(mEnabled); mEndTime = ClockType::now(); mElapsedTime = mEndTime - mStartTime; mStartTime = mEndTime; }
void ITimelineModel::Precompute(float fps) { RETURN_IF_FALSE(SupportPrecompute()); RETURN_IF_TRUE(mIsPrecomputed); RETURN_IF(fps < 0.f); RETURN_IF_EMPTY(mFrames); mIsPrecomputed = true; mFPS = fps; int preCalculatedframeCount = (int)Math::Ceil(mDuration * fps); RETURN_IF(preCalculatedframeCount <= 0); mFrameCount = (uint)preCalculatedframeCount; OnPrecomputeBegin(); float firstTime = mFrames.First().Time; AddPrecomputedItem(Math::IsZero(firstTime), 0U, 0U, 0.f); //add zero frame const float frameInterval = 1.f / mFPS; float time = 0.f; uint outPrevFrameIndex; uint outNextFrameIndex; float outPercent; uint prevIndex = 0; FOR_EACH_SIZE(i, mFrameCount) { time += frameInterval; bool isFound = TryGetFrameHelper(time, outPrevFrameIndex, outNextFrameIndex, outPercent, prevIndex); if (isFound) { prevIndex = outPrevFrameIndex; } AddPrecomputedItem(isFound, outPrevFrameIndex, outNextFrameIndex, outPercent); }
void BaseBufferRenderBatch::Apply() { RETURN_IF_FALSE(RenderingContext::Instance().IsBatchStep()); auto pass = RenderingContext::Instance().ProgramRenderPass(); //set model view matrix ShaderAttribute* texCoords = pass->FindAttributeByIndex(ShaderAttributeIndex::TexCoordArray); if (texCoords != nullptr) { mTexcoordBufferObject.Apply(); texCoords->SetPointerFromBufferObject(mTexcoordBufferObject); } ShaderAttribute* vertices = pass->FindAttributeByIndex(ShaderAttributeIndex::VertexArray); if (vertices != nullptr) { mVertexBufferObject.Apply(); vertices->SetPointerFromBufferObject(mVertexBufferObject); } ShaderAttribute* colors = pass->FindAttributeByIndex(ShaderAttributeIndex::ColorArray); if (colors != nullptr) { mColorBufferObject.Apply(); colors->SetPointerFromBufferObject(mColorBufferObject); } ShaderAttribute* normals = pass->FindAttributeByIndex(ShaderAttributeIndex::NormalArray); if (normals != nullptr) { mNormalBufferObject.Apply(); normals->SetPointerFromBufferObject(mNormalBufferObject); } mIndexBufferObject.Apply(); }
LuaSelector::~LuaSelector(void) { RETURN_IF_FALSE(mIsFunctorActive); LuaStackAutoReset save(mState); //reset stack after functor call, no matter how many ret returns Get().PushToStack(); ExecuteFunctor(0); }
void InputManager::UpdateInputPassingRecursively() { RETURN_IF_FALSE(mIsDirty); IScene* scene = SceneManager::Instance().RunningScene(); scene->ResetInputPassing(); FOR_EACH_COLLECTION(i, mDispatchers) { INode* node = *i; node->EnableInputPassing(); }
void StopWatch::PrintResult() const { RETURN_IF_FALSE(mEnabled); float dt = ElapsedMilliseconds(); HeapString str("***"); if (!mName.IsEmpty()) { str.AppendFormat("{}\t", mName.Buffer()); } if (mRunTimes > 0 && dt != 0) { str.AppendFormat("{} / {} = {}", dt, mRunTimes, dt / mRunTimes); } str += '\n'; Log::Info(str); }
void ApplicationStatics::SetDebugTouch(const Point2F& pos) { RETURN_IF_FALSE(IsShowTouch()); mDebugString.Format(L"{},{}", (int)pos.X, (int)pos.Y); }
void StopWatch::Go() { RETURN_IF_FALSE(mEnabled); mStartTime = mEndTime; }
void StopWatch::Start() { RETURN_IF_FALSE(mEnabled); mStartTime = ClockType::now(); }
void DateTime::ConvertToLocal() { RETURN_IF_FALSE(mIsUTC); mIsUTC = false; UpdateTimePointToLocalDate(); }