コード例 #1
0
ファイル: ScrollComponent.cpp プロジェクト: fjz13/Medusa
bool ScrollComponent::Update(float dt)
{
	RETURN_FALSE_IF_FALSE(IComponent::Update(dt));
	RETURN_FALSE_IF_FALSE(mScrollModel->UpdateModel(dt));
	
	return true;
}
コード例 #2
0
ファイル: FastNBT.cpp プロジェクト: Hillvith/MCServer
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;
}
コード例 #3
0
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;
}
コード例 #4
0
ファイル: SirenCustomEnum.cpp プロジェクト: fjz13/Medusa
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>();
	}
コード例 #5
0
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();


}
コード例 #6
0
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());
	}
コード例 #7
0
ファイル: AndroidWindow.cpp プロジェクト: fjz13/Medusa
bool AndroidWindow::Initialize()
{
	RETURN_FALSE_IF_FALSE(IWindow::Initialize());

	
	return true;
}
コード例 #8
0
ファイル: WinWindow.cpp プロジェクト: fjz13/Medusa
bool WinWindow::Pause()
{
	RETURN_FALSE_IF_FALSE(IWindow::Pause());
	mWatch.Reset();

	return true;
}
コード例 #9
0
ファイル: LuaSelector.cpp プロジェクト: fjz13/Medusa
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;
}
コード例 #10
0
ファイル: BaseFontModel.cpp プロジェクト: whztt07/Medusa
bool BaseFontModel::Initialzie(ModelLoadingOptions loadingOptions/*=ModelLoadingOptions::None*/)
{
    RETURN_FALSE_IF_FALSE(BaseMultipleModel::Initialzie(loadingOptions));


    return true;
}
コード例 #11
0
ファイル: FastNBT.cpp プロジェクト: Hillvith/MCServer
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;
}
コード例 #12
0
ファイル: StringTable.cpp プロジェクト: johndpope/Medusa
bool StringTable::LoadFromData(StringRef path, const MemoryByteData& data, uint format/*=0*/)
{
	RETURN_FALSE_IF_FALSE(Siren::DeserializeBinaryTo(data, *this));


	return true;
}
コード例 #13
0
bool ProgramRenderState::Equals(const IRenderState& state) const
{
	RETURN_FALSE_IF_FALSE(IRenderState::Equals(state));
	const ProgramRenderState& val=(const ProgramRenderState&)state;

	return mProgram==val.Program();
}
コード例 #14
0
ファイル: WinWindow.cpp プロジェクト: fjz13/Medusa
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;
}
コード例 #15
0
ファイル: TestGame.cpp プロジェクト: johndpope/Medusa
bool TestGame::OnLoadInternalScripts()
{
	RETURN_FALSE_IF_FALSE(IGame::OnLoadInternalScripts());
#ifdef MEDUSA_SCRIPT
	TestScript::Instance().InitializeInternal();
#endif
	return true;
}
コード例 #16
0
ファイル: AndroidEGLView.cpp プロジェクト: johndpope/Medusa
bool AndroidEGLView::Initialize()
{
	RETURN_FALSE_IF_FALSE(BaseRenderView::Initialize());


	return true;

}
コード例 #17
0
ファイル: HelloWorldScene.cpp プロジェクト: hxingchh/Medusa
bool HelloWorldScene::Initialize()
{
	RETURN_FALSE_IF_FALSE(Base2DScene::Initialize());

	PushLayer<HelloWorldLayer>();
	
	return true;
}
コード例 #18
0
ファイル: TestGame.cpp プロジェクト: johndpope/Medusa
bool TestGame::OnRegisterScriptTypes()
{
	RETURN_FALSE_IF_FALSE(IGame::OnRegisterScriptTypes());
#ifdef MEDUSA_SCRIPT
	TestScript::Instance().RegisterTypes();
#endif
	return true;
}
コード例 #19
0
ファイル: CocosHelloLayer.cpp プロジェクト: fjz13/Medusa
bool CocosHelloLayer::Initialize()
{
	RETURN_FALSE_IF_FALSE(BaseCaseLayer::Initialize());

	MEDUSA_INPUT_BIND(CocosHelloLayer,OnStart);

	return true;
}
コード例 #20
0
ファイル: BattleScene.cpp プロジェクト: alkaidlong/PaperDemo
bool BattleScene::Initialize()
{
	RETURN_FALSE_IF_FALSE(IScene::Initialize());
	SetName("BattleScene");
	BattleLayer* battleLayer = PushLayer<BattleLayer>();
	BattleManager::Instance().SetBattleLayer(battleLayer);
	return true;
}
コード例 #21
0
ファイル: IEntity.cpp プロジェクト: fjz13/Medusa
bool IEntity::EnterComponents()
{
	size_t count = mComponents.Count();
	FOR_EACH_SIZE(i, count)
	{
		IComponent* component = mComponents[i];
		RETURN_FALSE_IF_FALSE(component->Enter());
	}
コード例 #22
0
ファイル: Base2DScene.cpp プロジェクト: whztt07/Medusa
bool Base2DScene::Initialize()
{
    RETURN_FALSE_IF_FALSE(IScene::Initialize());
    mSceneGraph = new UISceneGraph(this);
    mSceneGraph->Initialize();

    return true;
}
コード例 #23
0
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();
}
コード例 #24
0
ファイル: SirenAssembly.cpp プロジェクト: fjz13/Medusa
	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();
		}
	}
コード例 #25
0
ファイル: FadeInAction.cpp プロジェクト: johndpope/Medusa
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;
}
コード例 #26
0
ファイル: TestScene.cpp プロジェクト: fjz13/Medusa
bool TestScene::Initialize()
{
	RETURN_FALSE_IF_FALSE(UIScene::Initialize());
	PushLayer<TestLayer>();
	//PushLayer<CocosHelloLayer>();

	//SceneManager::Instance().Current()->PushLayer<CocosFeatureLayer>();

	return true;
}
コード例 #27
0
ファイル: SirenAssembly.cpp プロジェクト: fjz13/Medusa
bool SirenAssembly::IsCompleted() const
{
	for (auto& typePair : mTypes)
	{
		auto* type = typePair.Value;
		RETURN_FALSE_IF_FALSE(type->IsCompleted());
	}

	return true;
}
コード例 #28
0
ファイル: SirenAssembly.cpp プロジェクト: fjz13/Medusa
bool SirenAssembly::Link()
{
	//types
	for (auto& typePair : mTypes)
	{
		auto* type = typePair.Value;
		RETURN_FALSE_IF_FALSE(type->Link(*this));
	}
	return true;
}
コード例 #29
0
ファイル: TextureButtonLayer.cpp プロジェクト: fjz13/Medusa
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;
}
コード例 #30
0
ファイル: EditBoxLayer.cpp プロジェクト: johndpope/Medusa
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;
}