bool ScrollComponent::Update(float dt) { RETURN_FALSE_IF_FALSE(IComponent::Update(dt)); RETURN_FALSE_IF_FALSE(mScrollModel->UpdateModel(dt)); return true; }
bool cParsedNBT::ReadCompound(void) { // Reads the latest tag as a compound int ParentIdx = m_Tags.size() - 1; int PrevSibling = -1; while (true) { NEEDBYTES(1); eTagType TagType = (eTagType)(m_Data[m_Pos]); m_Pos++; if (TagType == TAG_End) { break; } m_Tags.push_back(cFastNBTTag(TagType, ParentIdx, PrevSibling)); if (PrevSibling >= 0) { m_Tags[PrevSibling].m_NextSibling = m_Tags.size() - 1; } else { m_Tags[ParentIdx].m_FirstChild = m_Tags.size() - 1; } PrevSibling = m_Tags.size() - 1; RETURN_FALSE_IF_FALSE(ReadString(m_Tags.back().m_NameStart, m_Tags.back().m_NameLength)); RETURN_FALSE_IF_FALSE(ReadTag()); } // while (true) m_Tags[ParentIdx].m_LastChild = PrevSibling; return true; }
bool SirenTextParser::Parse(StringRef& proto) { while (true) { StringRef token = SirenTextParser::ReadToken(proto); BREAK_IF_EMPTY(token);//reach end if (token == EnumKeyword) { std::unique_ptr<SirenCustomEnum> type(new SirenCustomEnum()); if (type->Parse(mAssembly, proto)) { RETURN_FALSE_IF_FALSE(mAssembly.AddType(type.release())); } else { Log::Error("Failed to parse class."); return false; } } else if (token == ClassKeyword) { std::unique_ptr<SirenCustomClass> type(new SirenCustomClass()); if (type->Parse(mAssembly, proto)) { RETURN_FALSE_IF_FALSE(mAssembly.AddType(type.release())); } else { Log::Error("Failed to parse class."); return false; } } else if (token == AttributeKeyword) { std::unique_ptr<SirenAttributeFunction> func(new SirenAttributeFunction()); if (func->Parse(mAssembly, proto)) { mAssembly.AddFunction(func.release()); } else { Log::Error("Failed to parse function."); return false; } } else { Log::FormatError("Invalid syntax:{}", token); return false; } } return true; }
bool SirenCustomEnum::LoadFrom(IStream& stream) { RETURN_FALSE_IF_FALSE(BaseSirenCustomType::LoadFrom(stream)); RETURN_FALSE_IF_FALSE(mAttribute.LoadFrom(stream)); mUnderlyType = stream.ReadString(); uint count = stream.Read<uint32>(); FOR_EACH_SIZE(i, count) { mFieldNames.NewAdd() = stream.ReadString(); mFieldValues.NewAdd() = stream.Read<int32>(); }
bool DepthStencilRenderState::Equals(const IRenderState& state) const { RETURN_FALSE_IF_FALSE(IRenderState::Equals(state)); const DepthStencilRenderState& val=(const DepthStencilRenderState&)state; return mDepthTestEnabled==val.IsDepthTestEnabled()&& mDepthWritable==val.IsDepthWriteEnabled()&& mDepthFunc==val.DepthFunc()&& Math::IsEqual(mDepthClearValue,val.DepthClearValue())&& mStencilTestEnabled==val.IsStencilTestEnabled()&& mStencilClearValue==val.StencilClearValue()&& mFrontStencilDepthFailOp==val.FrontStencilDepthFailOp()&& mFrontStencilFailOp==val.FrontStencilFailOp()&& mFrontStencilFunc==val.FrontStencilFunc()&& mFrontStencilPassOp==val.FrontStencilPassOp()&& mFrontRefValue==val.FrontRefValue()&& mFrontReadMask==val.FrontReadMask()&& mFrontWriteMask==val.FrontWriteMask()&& mBackStencilDepthFailOp==val.BackStencilDepthFailOp()&& mBackStencilFailOp==val.BackStencilFailOp()&& mBackStencilFunc==val.BackStencilFunc()&& mBackStencilPassOp==val.BackStencilPassOp()&& mBackRefValue==val.BackRefValue()&& mBackReadMask==val.BackReadMask()&& mBackWriteMask==val.BackWriteMask(); }
bool ParallaxComponentLayer::Initialize() { RETURN_FALSE_IF_FALSE(BaseCaseLayer::Initialize()); mMainSprite = NodeFactory::Instance().CreateQuadSprite("test2.png"); mMainSprite->DockToScreen(DockPoint::MiddleTop); mMainSprite->SetAnchorPoint(AnchorPoint::MiddleTop); AddChild(mMainSprite); mComponent = ComponentFactory::Instance().Create<ParallaxComponent>(); mMainSprite->AddComponent(mComponent); FOR_EACH_SIZE(i, mChildCount) { Sprite* child = NodeFactory::Instance().CreateQuadSprite("test2.png"); child->SetAnchorPoint(AnchorPoint::MiddleTop); child->SetPosition(mMainSprite->Position()); child->MoveY(-child->Height()*(i+1)); AddChild(child); Point3F ratio = Point3F::One; ratio.X = (float)(i + 1) / mChildCount; mComponent->EnableParallax(child, ratio, child->Position()); }
bool AndroidWindow::Initialize() { RETURN_FALSE_IF_FALSE(IWindow::Initialize()); return true; }
bool WinWindow::Pause() { RETURN_FALSE_IF_FALSE(IWindow::Pause()); mWatch.Reset(); return true; }
bool LuaSelector::ExecuteFunctor(uint retCount)const { RETURN_FALSE_IF_FALSE(mIsFunctorActive); mIsFunctorActive = false; LuaStack s(mState); int errorFunc = s.SetErrorHandler(); //func,err int funcIndex = errorFunc - 1; //swap error func and func s.Duplicate(funcIndex); s.Copy(errorFunc, funcIndex); s.Replace(errorFunc); //err,func errorFunc = errorFunc - 1; for (const auto& arg : mFunctorArguments) { s.Push(arg); } int statusCode = lua_pcall(mState, (int)mFunctorArguments.Count(), retCount, errorFunc); //err,func,ret s.RemoveAt(errorFunc); //func,ret s.RemoveAt(funcIndex - 1); //ret return statusCode == LUA_OK; }
bool BaseFontModel::Initialzie(ModelLoadingOptions loadingOptions/*=ModelLoadingOptions::None*/) { RETURN_FALSE_IF_FALSE(BaseMultipleModel::Initialzie(loadingOptions)); return true; }
bool cParsedNBT::ReadList(eTagType a_ChildrenType) { // Reads the latest tag as a list of items of type a_ChildrenType // Read the count: NEEDBYTES(4); int Count = ntohl(*((int *)(m_Data + m_Pos))); m_Pos += 4; if (Count < 0) { return false; } // Read items: int ParentIdx = m_Tags.size() - 1; int PrevSibling = -1; for (int i = 0; i < Count; i++) { m_Tags.push_back(cFastNBTTag(a_ChildrenType, ParentIdx, PrevSibling)); if (PrevSibling >= 0) { m_Tags[PrevSibling].m_NextSibling = m_Tags.size() - 1; } else { m_Tags[ParentIdx].m_FirstChild = m_Tags.size() - 1; } PrevSibling = m_Tags.size() - 1; RETURN_FALSE_IF_FALSE(ReadTag()); } // for (i) m_Tags[ParentIdx].m_LastChild = PrevSibling; return true; }
bool StringTable::LoadFromData(StringRef path, const MemoryByteData& data, uint format/*=0*/) { RETURN_FALSE_IF_FALSE(Siren::DeserializeBinaryTo(data, *this)); return true; }
bool ProgramRenderState::Equals(const IRenderState& state) const { RETURN_FALSE_IF_FALSE(IRenderState::Equals(state)); const ProgramRenderState& val=(const ProgramRenderState&)state; return mProgram==val.Program(); }
bool WinWindow::Initialize() { RETURN_FALSE_IF_FALSE(IWindow::Initialize()); //register window class WNDCLASSEX wcex; HINSTANCE instance = GetModuleHandle(nullptr); wcex.cbSize = sizeof(WNDCLASSEX); wcex.style = CS_HREDRAW | CS_VREDRAW | CS_OWNDC&~WS_CAPTION&~WS_SYSMENU; wcex.lpfnWndProc = _WndProc; wcex.cbClsExtra = 0; wcex.cbWndExtra = 0; wcex.hInstance = instance; wcex.hIcon = nullptr; wcex.hCursor = LoadCursor(nullptr, IDC_ARROW); wcex.hbrBackground = nullptr; wcex.lpszMenuName = nullptr; wcex.lpszClassName = L"MedusaGameWindow"; wcex.hIconSm = nullptr; if (!RegisterClassEx(&wcex)) { /*DWORD err= GetLastError();*/ //log error MEDUSA_ASSERT_FAILED(""); } ////get window rect WHeapString windowName = StringParser::ToW(mName); //int windowStyle=mParentWindowHandle==nullptr?WS_CAPTION | WS_POPUPWINDOW | WS_MINIMIZEBOX:WS_CHILDWINDOW|WS_VISIBLE; int windowStyle = mParentWindowHandle == nullptr ? WS_CAPTION | WS_OVERLAPPEDWINDOW | WS_MINIMIZEBOX : WS_CHILDWINDOW | WS_VISIBLE; mWindowHandle = CreateWindowEx(WS_EX_APPWINDOW | WS_EX_WINDOWEDGE, L"MedusaGameWindow", windowName.c_str(), windowStyle, 0, 0, (int)mSize.Width, (int)mSize.Height, mParentWindowHandle, nullptr, instance, nullptr); RegisterTouchWindow(mWindowHandle, 0); //ImmAssociateContext(mWindowHandle, nullptr); //disable ime if (!mWindowHandle) { /*DWORD err= GetLastError();*/ //log error MEDUSA_ASSERT_FAILED(""); } //SetForegroundWindow(mWindowHandle); MakeCenter(); Resize(mSize); ShowWindow(mWindowHandle, SW_SHOW); UpdateWindow(mWindowHandle); return true; }
bool TestGame::OnLoadInternalScripts() { RETURN_FALSE_IF_FALSE(IGame::OnLoadInternalScripts()); #ifdef MEDUSA_SCRIPT TestScript::Instance().InitializeInternal(); #endif return true; }
bool AndroidEGLView::Initialize() { RETURN_FALSE_IF_FALSE(BaseRenderView::Initialize()); return true; }
bool HelloWorldScene::Initialize() { RETURN_FALSE_IF_FALSE(Base2DScene::Initialize()); PushLayer<HelloWorldLayer>(); return true; }
bool TestGame::OnRegisterScriptTypes() { RETURN_FALSE_IF_FALSE(IGame::OnRegisterScriptTypes()); #ifdef MEDUSA_SCRIPT TestScript::Instance().RegisterTypes(); #endif return true; }
bool CocosHelloLayer::Initialize() { RETURN_FALSE_IF_FALSE(BaseCaseLayer::Initialize()); MEDUSA_INPUT_BIND(CocosHelloLayer,OnStart); return true; }
bool BattleScene::Initialize() { RETURN_FALSE_IF_FALSE(IScene::Initialize()); SetName("BattleScene"); BattleLayer* battleLayer = PushLayer<BattleLayer>(); BattleManager::Instance().SetBattleLayer(battleLayer); return true; }
bool IEntity::EnterComponents() { size_t count = mComponents.Count(); FOR_EACH_SIZE(i, count) { IComponent* component = mComponents[i]; RETURN_FALSE_IF_FALSE(component->Enter()); }
bool Base2DScene::Initialize() { RETURN_FALSE_IF_FALSE(IScene::Initialize()); mSceneGraph = new UISceneGraph(this); mSceneGraph->Initialize(); return true; }
bool RasterizerRenderState::Equals(const IRenderState& state) const { RETURN_FALSE_IF_FALSE(IRenderState::Equals(state)); const RasterizerRenderState& val=(const RasterizerRenderState&)state; return mCullFaceEnabled==val.IsEnabled()&& mCullMode==val.CullMode()&& mFrontFace==val.FrontFace()&& mColorMask==val.ColorMask(); }
FOR_EACH_SIZE(i, typeCount) { char isClass = (char)stream.ReadChar(); if (isClass == 1) { std::unique_ptr<SirenCustomClass> type(new SirenCustomClass()); RETURN_FALSE_IF_FALSE(type->LoadFrom(stream)); mTypes.Add(type->Name(), type.get()); type.release(); } else { std::unique_ptr<SirenCustomEnum> type(new SirenCustomEnum()); RETURN_FALSE_IF_FALSE(type->LoadFrom(stream)); mTypes.Add(type->Name(), type.get()); type.release(); } }
bool FadeInAction::Update(float dt, float blend /*= 1.f*/) { RETURN_FALSE_IF_FALSE(BaseFiniteAction::Update(dt,blend)); float percent=Percent(); percent=Math::Clamp(percent,0.f,1.f); INode* node = (INode*)mTarget; node->SetOpacity(percent); return true; }
bool TestScene::Initialize() { RETURN_FALSE_IF_FALSE(UIScene::Initialize()); PushLayer<TestLayer>(); //PushLayer<CocosHelloLayer>(); //SceneManager::Instance().Current()->PushLayer<CocosFeatureLayer>(); return true; }
bool SirenAssembly::IsCompleted() const { for (auto& typePair : mTypes) { auto* type = typePair.Value; RETURN_FALSE_IF_FALSE(type->IsCompleted()); } return true; }
bool SirenAssembly::Link() { //types for (auto& typePair : mTypes) { auto* type = typePair.Value; RETURN_FALSE_IF_FALSE(type->Link(*this)); } return true; }
bool TextureButtonLayer::Initialize() { RETURN_FALSE_IF_FALSE(BaseCaseLayer::Initialize()); TextureButton* button=NodeFactory::Instance().CreateTextureButton("Close.png","CloseSelected.png"); button->SetDock(DockPoint::MiddleCenter); button->SetAnchor(0.5f,0.5f); AddChild(button); button->OnTap+=Bind(&TextureButtonLayer::OnTap,this); return true; }
bool EditBoxLayer::Initialize() { RETURN_FALSE_IF_FALSE(BaseCaseLayer::Initialize()); INode* sprite=NodeFactory::Instance().CreateSingleLineEditBox(msize(500,180), FontId("PaperBlack.ttf",96),L"ABC"); sprite->SetDock(DockPoint::MiddleCenter); sprite->SetAnchor(0.5f, 0.5f); AddChild(sprite); return true; }