Example #1
0
bool GamePageAppLobby::SetUp(MkDataNode& sharingNode)
{
	if (!GamePageBase::SetUp(sharingNode))
		return false;

	m_RootSceneNode->SetLocalDepth(10.f);

	// window factory
	MkWindowFactory winFactory;
	winFactory.SetFrameType(MkWindowThemeData::eFT_Large);
	winFactory.SetMinClientSizeForButton(MkFloat2(200.f, 50.f));

	// window mgr
	GPAppLobbyWinMgr* winMgrNode = new GPAppLobbyWinMgr(L"WinMgr");
	if (winMgrNode != NULL)
	{
		m_RootSceneNode->AttachChildNode(winMgrNode);

		// battle
		MkWindowBaseNode* battleBtn = winFactory.CreateNormalButtonNode(BattleBtnName, L"ÀüÅõ »ùÇÃ");
		if (winMgrNode->AttachWindow(battleBtn))
		{
			winMgrNode->ActivateWindow(battleBtn->GetNodeName());
			battleBtn->SetLocalPosition(MkFloat2(600.f, 300.f));
		}
	}
	
	return true;
}
Example #2
0
bool GamePageAppBriefingRoom::SetUp(MkDataNode& sharingNode)
{
	if (!GamePageBase::SetUp(sharingNode))
		return false;

	m_RootSceneNode->SetLocalDepth(10.f);

	MkFloat2 screenSize = MkFloat2(static_cast<float>(MK_DEVICE_MGR.GetCurrentResolution().x), static_cast<float>(MK_DEVICE_MGR.GetCurrentResolution().y));

	// window factory
	MkWindowFactory winFactory;
	winFactory.SetFrameType(MkWindowThemeData::eFT_Large);
	winFactory.SetMinClientSizeForButton(MkFloat2(200.f, 50.f));

	// window mgr
	GPAppBriefingRoomWinMgr* winMgrNode = new GPAppBriefingRoomWinMgr(L"WinMgr");
	if (winMgrNode != NULL)
	{
		m_RootSceneNode->AttachChildNode(winMgrNode);

		// battle
		MkWindowBaseNode* battleBtn = winFactory.CreateNormalButtonNode(BattleBtnName, L"ÀüÅõ ½ÃÀÛ");
		if (winMgrNode->AttachWindow(battleBtn))
		{
			winMgrNode->ActivateWindow(battleBtn->GetNodeName());
			MkFloat2 pos;
			pos.x = screenSize.x - winFactory.GetMinClientSizeForButton().x - 30.f;
			pos.y = 20.f;
			battleBtn->SetLocalPosition(pos);
		}
	}
	
	return true;
}
void MkBodyFrameControlNode::SetClientSize(const MkFloat2& clientSize)
{
	MkWindowBaseNode::SetClientSize(clientSize);

	if ((m_ParentNodePtr != NULL) && (m_ParentNodePtr->IsDerivedFrom(ePA_SNT_TitleBarControlNode)))
	{
		MkTitleBarControlNode* parentNode = dynamic_cast<MkTitleBarControlNode*>(m_ParentNodePtr);
		if (parentNode != NULL)
		{
			// 부모의 크기(length)를 변경
			float sizeOffset = 0.f;
			if ((m_HangingType == eHT_IncludeParentAtTop) || (m_HangingType == eHT_IncludeParentAtBottom))
			{
				const MkWindowThemeFormData* formData = MK_STATIC_RES.GetWindowThemeSet().GetFormData(GetThemeName(), GetComponentType(), GetCustomForm());
				if (formData != NULL)
				{
					sizeOffset += formData->GetLeftMargin();
					sizeOffset += formData->GetRightMargin();
				}
			}

			float frameSize = MK_STATIC_RES.GetWindowThemeSet().GetFrameSize(parentNode->GetThemeName(), parentNode->GetFrameType());
			float titleLength = GetMax<float>(m_ClientRect.size.x - sizeOffset, 0.f);
			parentNode->SetClientSize(MkFloat2(titleLength, frameSize));
		}
	}
}
MkOrthogonalCamera::MkOrthogonalCamera()
{
	m_NearClip = MKDEF_CAMERA_DEPTH_OFFSET - 0.0000001f;
	m_FarClip = MKDEF_PA_MAX_WORLD_DEPTH + MKDEF_CAMERA_DEPTH_OFFSET;

	MkInt2 ss = MK_DEVICE_MGR.GetCurrentResolution();
	SetSize(MkFloat2(static_cast<float>(ss.x), static_cast<float>(ss.y)));
}
MkWindowFactory::MkWindowFactory()
{
	m_ThemeName = MkWindowThemeData::DefaultThemeName;
	m_FrameType = MkWindowThemeData::eFT_Small;

	float frameSize = MK_STATIC_RES.GetWindowThemeSet().GetFrameSize(m_ThemeName, m_FrameType);
	m_MinClientSizeForButton = MkFloat2(80.f, frameSize);
}
Example #6
0
bool ApResourceUnit::_AddImagePanelToRightBottom(const MkHashStr& name, const MkPathName& imgPath, const MkHashStr& ssName, float localDepth)
{
	if (m_SceneNode == NULL)
		return true;

	if (!_AddImagePanel(name, imgPath, ssName, localDepth))
		return false;

	MkPanel& panel = *m_SceneNode->GetPanel(name);
	const MkFloat2& indexSize = panel.GetPanelSize();
	MkFloat2 localPos(ApStaticDefinition::Instance().GetResourceTileSize().x - indexSize.x, 0.f); // right bottom
	localPos += MkFloat2(-5.f, 5.f); // offset
	localPos -= ApStaticDefinition::Instance().GetResourceTileSize() * 0.5f; // pivot to center
	panel.SetLocalPosition(localPos);
	return true;
}
void MkCheckBoxControlNode::_SetCheckBox
(const MkHashStr& themeName, MkWindowThemeData::eFrameType frameType, const MkArray<MkHashStr>& textNode, const MkStr& caption, bool onCheck)
{
	m_FrameType = frameType;
	float frameSize = MK_STATIC_RES.GetWindowThemeSet().GetFrameSize(themeName, m_FrameType);

	// check box
	SetThemeName(themeName);
	SetComponentType(MkWindowThemeData::eCT_CheckBoxBtn);
	SetClientSize(MkFloat2(frameSize, frameSize));
	SetFormState(MkWindowThemeFormData::eS_Normal);

	// caption
	_SetCaption(textNode, caption);

	// on check
	_SetCheck(onCheck, false);
}
void MkCheckBoxControlNode::_SetCaption(const MkArray<MkHashStr>& textNode, const MkStr& caption)
{
	if (textNode.Empty() || (!MK_STATIC_RES.TextNodeExist(textNode)))
	{
		RemoveChildNode(CaptionNodeName);
		m_CaptionString.Clear();
		return;
	}

	// MkWindowTagNode 사용
	MkWindowTagNode* node = NULL;
	if (ChildExist(CaptionNodeName))
	{
		node = dynamic_cast<MkWindowTagNode*>(GetChildNode(CaptionNodeName));
	}
	else
	{
		node = MkWindowTagNode::CreateChildNode(this, CaptionNodeName);
		if (node != NULL)
		{
			node->SetAlignmentPivotIsWindowRect(true);
			node->SetAlignmentPosition(eRAP_RMostCenter);
			node->SetAlignmentOffset(MkFloat2(node->GetLengthOfBetweenIconAndText(), 0.f));
		}
	}

	if (node != NULL)
	{
		m_CaptionString = caption;
		if (caption.Empty())
		{
			node->SetTextName(textNode);
		}
		else
		{
			node->SetTextName(textNode, caption);
		}
	}
}
MkWindowTagNode* MkWindowFactory::_CreateTextTagNode(const MkHashStr& name, const MkStr& message, const MkArray<MkHashStr>& textName, MkFloat2& textRegion) const
{
	MkWindowTagNode* node = MkWindowTagNode::CreateChildNode(NULL, name);
	if (node != NULL)
	{
		node->SetLocalDepth(-0.1f); // parent와 겹치는 것을 피하기 위해 0.1f만큼 앞에 위치
		
		if (textName.Empty())
		{
			node->SetTextName(MK_STATIC_RES.GetWindowThemeSet().GetCaptionTextNode(m_ThemeName, m_FrameType), message); // message 삽입
		}
		else
		{
			node->SetTextName(textName); // text name 삽입
		}

		// text 영역의 크기를 반환
		const MkInt2& iTextSize = node->GetTagTextPtr()->GetWholePixelSize();
		textRegion = MkFloat2(static_cast<float>(iTextSize.x), static_cast<float>(iTextSize.y));
	}
	return node;
}
Example #10
0
void MkImageInfo::SetUp(const MkInt2& imageSize, const MkDataNode* node)
{
	Clear();

	// ready to uv converting
	MkFloat2 fImageSize(static_cast<float>(imageSize.x), static_cast<float>(imageSize.y));

	// empty subset
	Subset& emptySubset = m_Subsets.Create(MkHashStr::EMPTY);
	emptySubset.rectSize = fImageSize;
	emptySubset.uv[MkFloatRect::eLeftTop] = MkFloat2::Zero;
	emptySubset.uv[MkFloatRect::eRightTop] = MkFloat2(1.f, 0.f);
	emptySubset.uv[MkFloatRect::eLeftBottom] = MkFloat2(0.f, 1.f);
	emptySubset.uv[MkFloatRect::eRightBottom] = MkFloat2(1.f, 1.f);

	if (node == NULL)
		return;

	// group
	node->GetDataEx(GROUP_KEY, m_Group, 0);

	// parse nodes
	MkArray<MkHashStr> keyList;
	node->GetChildNodeList(keyList);
	MK_INDEXING_LOOP(keyList, i)
	{
		const MkHashStr& childName = keyList[i];
		const MkDataNode& childNode = *node->GetChildNode(childName);

		do
		{
			// 필수 key로 subset/sequence 종류 판단
			if (childNode.IsValidKey(SIZE_KEY)) // subset
			{
				MkInt2 position;
				childNode.GetData(POSITION_KEY, position, 0);

				MkInt2 size;
				childNode.GetData(SIZE_KEY, size, 0);
				MK_CHECK(size.IsPositive(), childName.GetString() + L" 노드의 " + SIZE_KEY.GetString() + L" 값 오류")
					break;

				MkInt2 table(1, 1);
				childNode.GetData(TABLE_KEY, table, 0);
				MK_CHECK(table.IsPositive(), childName.GetString() + L" 노드의 " + TABLE_KEY.GetString() + L" 값 오류")
					break;

				MkFloat2 fSubsetSize(static_cast<float>(size.x), static_cast<float>(size.y));
				MkFloat2 fUVSize(fSubsetSize.x / fImageSize.x, fSubsetSize.y / fImageSize.y);

				// single subset
				if ((table.x == 1) && (table.y == 1))
				{
					_RegisterSubset(childName, fSubsetSize, position, fImageSize, fUVSize);
				}
				// multi subset
				else
				{
					MkInt2 offset = size;
					childNode.GetData(OFFSET_KEY, offset, 0);

					MkInt2 currPivot = position;
					for (int y = 0; y < table.y; ++y)
					{
						for (int x = 0; x < table.x; ++x)
						{
							_RegisterSubset(childName.GetString() + MkStr(y * table.x + x), fSubsetSize, currPivot, fImageSize, fUVSize);
							currPivot.x += offset.x;
						}
						currPivot.x = position.x;
						currPivot.y += offset.y;
					}
				}
			}
			else if (childNode.IsValidKey(TOTAL_RANGE_KEY) && childNode.IsValidKey(SUBSET_LIST_KEY)) // sequence
			{
				float totalRange = 0.f;
				childNode.GetData(TOTAL_RANGE_KEY, totalRange, 0);
				MK_CHECK(totalRange > 0.f, childName.GetString() + L" 노드의 " + TOTAL_RANGE_KEY.GetString() + L" 값 오류")
					break;

				MkArray<MkHashStr> subsetList;
				childNode.GetDataEx(SUBSET_LIST_KEY, subsetList);
				MK_CHECK(!subsetList.Empty(), childName.GetString() + L" 노드의 " + SUBSET_LIST_KEY.GetString() + L" 값 오류")
					break;

				MkArray<float> timeList;
				childNode.GetData(TIME_LIST_KEY, timeList);

				bool loop = true;
				childNode.GetData(LOOP_KEY, loop, 0);

				// time list 검증 및 자동생성
				if (timeList.Empty())
				{
					timeList.Reserve(subsetList.GetSize());
					float oneFrameTime = totalRange / static_cast<float>(subsetList.GetSize());
					float timeStamp = 0.f;
					MK_INDEXING_LOOP(subsetList, j)
					{
						timeList.PushBack(timeStamp);
						timeStamp += oneFrameTime;
					}
				}
Example #11
0
MkTitleBarControlNode* MkWindowFactory::_CreateMessageBox
(const MkHashStr& name, const MkStr& titleStr, const MkArray<MkHashStr>& titleTextName, const MkStr& descStr, const MkArray<MkHashStr>& descTextName,
 MkWindowBaseNode* callBackWindow, eMsgBoxType boxType, eMsgBoxButton btnType) const
{
	// icon type
	MkWindowThemeData::eIconType iconType = MkWindowThemeData::eIT_None;
	MkWindowThemeData::eComponentType bodyType = MkWindowThemeData::eCT_None;
	switch (boxType)
	{
	case eMBT_Default:
		iconType = MkWindowThemeData::eIT_Default;
		bodyType = MkWindowThemeData::eCT_DefaultBox;
		break;
	case eMBT_Notice:
		iconType = MkWindowThemeData::eIT_Notice;
		bodyType = MkWindowThemeData::eCT_DefaultBox;
		break;
	case eMBT_Information:
		iconType = MkWindowThemeData::eIT_Information;
		bodyType = MkWindowThemeData::eCT_DefaultBox;
		break;
	case eMBT_Warning:
		iconType = MkWindowThemeData::eIT_Warning;
		bodyType = MkWindowThemeData::eCT_NoticeBox;
		break;
	case eMBT_EditMode:
		iconType = MkWindowThemeData::eIT_EditMode;
		bodyType = MkWindowThemeData::eCT_DefaultBox;
		break;
	}

	if ((iconType == MkWindowThemeData::eIT_None) || (bodyType == MkWindowThemeData::eCT_None))
		return NULL;

	// create title
	MkTitleBarControlNode* titleNode = MkTitleBarControlNode::CreateChildNode(NULL, name);
	if (titleNode != NULL)
	{
		do
		{
			titleNode->SetTitleBar(m_ThemeName, m_FrameType, 10.f, (btnType == eMBB_None)); // length는 의미 없음. 이후 body frame에서 재설정 할 것임
			titleNode->SetIcon(iconType);

			if (titleTextName.Empty())
			{
				titleNode->SetCaption(titleStr);
			}
			else
			{
				titleNode->SetCaption(titleTextName);
			}
			
			// create body frame
			MkBodyFrameControlNode* bodyFrame = MkBodyFrameControlNode::CreateChildNode(titleNode, BodyFrameName);
			if (bodyFrame == NULL)
				break;

			// body frame dispositioner
			MkWindowDispositioner windowDispositioner;
			windowDispositioner.SetMargin(MkFloat2(8.f, 8.f)); // border
			windowDispositioner.AddNewLine(); // title에 해당하는 빈 영역
			windowDispositioner.AddDummyToCurrentLine(titleNode->CalculateWindowSize());

			// create text tag
			MkFloat2 textRegion;
			MkWindowTagNode* tagNode = descTextName.Empty() ?
				CreateTextTagNode(OneAndOnlyTagName, descStr, textRegion) : CreateTextTagNode(OneAndOnlyTagName, descTextName, textRegion);
			
			if (tagNode == NULL)
				break;

			bodyFrame->AttachChildNode(tagNode);

			windowDispositioner.AddNewLine(MkWindowDispositioner::eLHA_Center); // text tag는 중앙 정렬
			windowDispositioner.AddRectToCurrentLine(OneAndOnlyTagName, textRegion);

			// call back target path
			MkArray<MkHashStr> callbackTarget;
			if (callBackWindow != NULL)
			{
				callBackWindow->GetWindowPath(callbackTarget);
			}

			MkWindowBaseNode* okBtn = NULL;
			MkWindowBaseNode* cancelBtn = NULL;
			if (btnType != eMBB_None)
			{
				// create ok btn
				okBtn = CreateOkButtonNode();
				if (okBtn == NULL)
					break;

				bodyFrame->AttachChildNode(okBtn);

				if (!callbackTarget.Empty())
				{
					okBtn->SetCallBackTargetWindowPath(callbackTarget);
				}

				windowDispositioner.AddNewLine(MkWindowDispositioner::eLHA_Center); // button set도 중앙 정렬
				windowDispositioner.AddRectToCurrentLine(okBtn->GetNodeName(), okBtn->CalculateWindowSize());

				// create cancel btn
				if (btnType == eMBB_OkCancel)
				{
					cancelBtn = CreateCancelButtonNode();
					if (cancelBtn == NULL)
						break;
					
					bodyFrame->AttachChildNode(cancelBtn);

					if (!callbackTarget.Empty())
					{
						cancelBtn->SetCallBackTargetWindowPath(callbackTarget);
					}

					windowDispositioner.AddRectToCurrentLine(cancelBtn->GetNodeName(), cancelBtn->CalculateWindowSize());
				}
			}

			// dispositioner 계산
			windowDispositioner.Calculate();

			// body frame size
			MkFloat2 clientSize = windowDispositioner.GetRegion();
			//clientSize += MkFloat2(10.f, 10.f); // border
			bodyFrame->SetBodyFrame(m_ThemeName, bodyType, true, MkBodyFrameControlNode::eHT_IncludeParentAtTop, clientSize);

			// 하위 node 위치 반영
			windowDispositioner.ApplyPositionToNode(tagNode);
			windowDispositioner.ApplyPositionToNode(okBtn);
			windowDispositioner.ApplyPositionToNode(cancelBtn);

			return titleNode;
		}
		while (false);

		MK_DELETE(titleNode);
	}
	return NULL;
}