Exemplo n.º 1
0
bool ApResourceUnit::SetRowColumnType(eRowColumnType rcType)
{
	if (rcType == m_RowColumnType)
		return true;

	MkStr ssPrefix;
	switch (rcType)
	{
	case eRCT_None: break;
	case eRCT_Light: ssPrefix = L"ResIndexLight_"; break;
	case eRCT_Dark: ssPrefix = L"ResIndexDark_"; break;
	}

	if (ssPrefix.Empty())
	{
		if (m_SceneNode != NULL)
		{
			m_SceneNode->DeletePanel(L"Row");
			m_SceneNode->DeletePanel(L"Column");
		}
		m_RowColumnType = rcType;
		return true;
	}

	bool ok =
		(_AddImagePanelToLeftTop(L"Row", m_ImagePath, ssPrefix + MkStr(m_Type.GetRow()), -0.1f) &&
		_AddImagePanelToRightBottom(L"Column", m_ImagePath, ssPrefix + MkStr(m_Type.GetColumn()), -0.1f));
	if (ok)
	{
		m_RowColumnType = rcType;
	}
	return ok;
}
Exemplo n.º 2
0
	virtual bool SetUp(MkDataNode& sharingNode)
	{
		MK_DEV_PANEL.MsgToFreeboard(0, L"vector 멤버 수 : " + MkStr(VECTOR_MEMBER_COUNT));
		MK_DEV_PANEL.MsgToFreeboard(1, L"map 멤버 수 : " + MkStr(MAP_MEMBER_COUNT));

		return true;
	}
void MkSystemEnvironment::_Initialize(void)
{
    // build mode
#ifdef _DEBUG
    m_BuildMode = eDebug;
#else

#ifdef MK_SHIPPING
    m_BuildMode = eShipping;
#else
    m_BuildMode = eRelease;
#endif	// MK_SHIPPING

#endif	// _DEBUG

    // system 정보
    SYSTEM_INFO systemInfo;
    GetSystemInfo(&systemInfo);

    // cpu 연산방식
    m_ProcessorArchitecture = eEtcPA;
    if (systemInfo.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_INTEL)
    {
        m_ProcessorArchitecture = eX86;
    }
    else if (systemInfo.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_AMD64)
    {
        m_ProcessorArchitecture = eX64;
    }

    // core 수
    m_NumberOfProcessors = static_cast<unsigned int>(systemInfo.dwNumberOfProcessors);

    // OS 버전
    OSVERSIONINFO osVer;
    osVer.dwOSVersionInfoSize = sizeof(osVer);
    GetVersionEx(&osVer);
    unsigned int osMajor = static_cast<unsigned int>(osVer.dwMajorVersion);
    unsigned int osMinor = static_cast<unsigned int>(osVer.dwMinorVersion);
    m_WindowsVersion = MkStr(osMajor) + L"." + MkStr(osMinor) + MkStr::SPACE + MkStr(osVer.szCSDVersion);
    m_WindowsIsXpOrHigher = ((osMajor * 10 + osMinor) >= 51); // XP == 5.1
    m_WindowsIsVistaOrHigher = ((osMajor * 10) >= 60); // Vista == 6.0

    // 바탕화면 해상도
    RECT rect;
    GetWindowRect(GetDesktopWindow(), &rect);
    m_BackgroundResolution.x = static_cast<int>(rect.right);
    m_BackgroundResolution.y = static_cast<int>(rect.bottom);

    // 유저 정보
    DWORD userNameSize = 256;
    wchar_t userName[256];
    GetUserName(userName, &userNameSize);
    m_CurrentUserName = userName;
}
Exemplo n.º 4
0
SupplementDef::eResult SupplementDef::GetResult(const MkArray<eUnit>& units, MkArray<unsigned int>& targetIndice)
{
	unsigned int unitSize = units.GetSize();

	// 유효성 검증
	MK_CHECK(unitSize <= ADEF_MAX_COMBINATION_SLOT_SIZE, L"입력된 unit 갯수가 " + MkStr(ADEF_MAX_COMBINATION_SLOT_SIZE) + L"개를 넘음 : " + MkStr(unitSize))
		return eR_None;

	MK_INDEXING_LOOP(units, i)
	{
		eUnit unit = units[i];
		MK_CHECK((unit == eU_Void) || IsNormalUnit(unit), L"입력된 unit list의 " + MkStr(i) + L"번째에 비정상 unit 존재 : " + MkStr(unit))
			return eR_None;
	}
Exemplo n.º 5
0
void MkHiddenEditBox::Update(const MkSceneNode* ownerMgr)
{
	// target node가 존재할 경우 해당 owner manager update시 실행
	if ((m_hWnd != NULL) && (m_TargetEditBox != NULL) && (ownerMgr == m_TargetWindowMgr))
	{
		// target node가 disable이면 자동 해제
		if (!m_TargetEditBox->GetEnable())
		{
			_ClearTargetEditBox(true);
		}
		// target node가 그려지지 않으면 자동 해제
		else
		{
			MkSceneNode* targetNode = m_TargetEditBox;
			while (targetNode != NULL)
			{
				if (targetNode->GetVisible())
				{
					targetNode = targetNode->GetParentNode();
				}
				else
				{
					_ClearTargetEditBox(true);
					break;
				}
			}
		}

		// 해제되지 않았으면 갱신
		if (m_TargetEditBox != NULL)
		{
			// cursor toggle
			MkTimeState timeState;
			MK_TIME_MGR.GetCurrentTimeState(timeState);
			if (m_ToggleCursorCounter.OnTick(timeState))
			{
				m_TargetEditBox->__ToggleNormalCursor();
			}

			// input에 변경이 감지되었으면 반영
			if (m_Modified)
			{
				wchar_t buffer[MKDEF_MAX_INPUT_COUNT + 1] = {0, };
				GetWindowText(m_hWnd, buffer, MKDEF_MAX_INPUT_COUNT + 1);
				
				DWORD selStart, selEnd;
				SendMessage(m_hWnd, EM_GETSEL, reinterpret_cast<WPARAM>(&selStart), reinterpret_cast<LPARAM>(&selEnd));

				m_TargetEditBox->__UpdateText(MkStr(buffer), selStart, selEnd);
				m_Modified = false;
			}
		}
	}
}
Exemplo n.º 6
0
	virtual bool SetUp(MkDataNode& sharingNode)
	{
		// 파일로부터 읽음
		MkDataNode dataNode;
		dataNode.Load(L"..\\..\\test01.txt");

		// 노드 탐색
		MkDataNode* orcNode = dataNode.GetChildNode(L"MonsterTable")->GetChildNode(L"Orc");

		// 값 확인 : KoreanName(overwrite)
		MkStr koreanName;
		if (orcNode->GetData(L"KoreanName", koreanName, 0))
		{
			MK_DEV_PANEL.MsgToLog(L"");
			MK_DEV_PANEL.MsgToLog(L"KoreanName : " + koreanName);
		}

		// 값 확인 : intelligence(overwrite)
		int intelligence;
		if (orcNode->GetData(L"intelligence", intelligence, 0))
		{
			MK_DEV_PANEL.MsgToLog(L"");
			MK_DEV_PANEL.MsgToLog(L"intelligence : " + MkStr(intelligence));
		}

		// 값 확인 : threeSize(템플릿에만 존재)
		MkArray<unsigned int> threeSize;
		if (orcNode->GetData(L"threeSize", threeSize))
		{
			MK_DEV_PANEL.MsgToLog(L"");
			MK_DEV_PANEL.MsgToLog(L"threeSize :");

			MK_INDEXING_LOOP(threeSize, i)
			{
				MK_DEV_PANEL.MsgToLog(L"   - " + MkStr(threeSize[i]));
			}
Exemplo n.º 7
0
bool MkCheck::ExceptionForRelease(const char* function, long lineNum, const wchar_t* expression, const wchar_t* message)
{
	MkStr funcBuf;
	funcBuf.ImportMultiByteString(std::string(function));

	MkStr msg;
	msg.Reserve(1024);
	msg += L"FUNCTION : ";
	msg += funcBuf;
	msg += L" (";
	msg += MkStr(lineNum);
	msg += L")\nEXPRESSION : ";
	msg += expression;
	msg += L"\nMESSAGE : ";
	msg += message;

#if (MKDEF_CHECK_EXCEPTION_BREAK)
	int rlt = MessageBox(NULL, msg.GetPtr(), L"Oops!!! Break?", MB_YESNO);
	if (rlt == IDYES)
	{
		// crash log
		MK_LOG_MGR.CreateCrashPage(msg);

		// 강제예외
		throw;
	}
	else if (rlt == IDNO)
#else
	int rlt = MessageBox(NULL, msg.GetPtr(), L"Oops!!!", MB_OK);
	if (rlt == IDOK)
#endif
	{
		// log 기록 후 진행
		MK_LOG_MGR.Msg(L"<Error> " + msg, true);
	}
	
	return true; // excute action
}
#include "MkCore_MkCheck.h"
#include "MkCore_MkDataNode.h"

#include "MkPA_MkProjectDefinition.h"
#include "MkPA_MkStaticResourceContainer.h"
#include "MkPA_MkWindowTagNode.h"
#include "MkPA_MkCheckBoxControlNode.h"


const MkHashStr MkCheckBoxControlNode::CaptionNodeName = MkStr(MKDEF_PA_WIN_CONTROL_PREFIX) + L"Caption";
const MkHashStr MkCheckBoxControlNode::CheckIconName = MkStr(MKDEF_PA_WIN_CONTROL_PREFIX) + L"CheckIcon";

const MkHashStr MkCheckBoxControlNode::ObjKey_CaptionTextName(L"CaptionTextName");
const MkHashStr MkCheckBoxControlNode::ObjKey_CaptionString(L"CaptionString");
const MkHashStr MkCheckBoxControlNode::ObjKey_OnCheck(L"OnCheck");

//------------------------------------------------------------------------------------------------//

MkCheckBoxControlNode* MkCheckBoxControlNode::CreateChildNode(MkSceneNode* parentNode, const MkHashStr& childNodeName)
{
	MkCheckBoxControlNode* node = __TSI_SceneNodeDerivedInstanceOp<MkCheckBoxControlNode>::Alloc(parentNode, childNodeName);
	MK_CHECK(node != NULL, childNodeName.GetString() + L" MkCheckBoxControlNode 생성 실패") {}
	return node;
}

//------------------------------------------------------------------------------------------------//

void MkCheckBoxControlNode::SetCheckBox(const MkHashStr& themeName, MkWindowThemeData::eFrameType frameType, const MkArray<MkHashStr>& textNode, bool onCheck)
{
	_SetCheckBox(themeName, frameType, textNode, MkStr::EMPTY, onCheck);
Exemplo n.º 9
0
	virtual bool SetUp(MkDataNode& sharingNode)
	{
		// 선택 할 테이블들의 pair 수
		const unsigned int sampleCount = 100000;
		MK_DEV_PANEL.MsgToFreeboard(0, L"선택 할 테이블들의 pair 수 : " + MkStr(sampleCount));

		// 샘플 문자열의 최소 길이
		const unsigned int minLengthOfString = 20;
		
		// 샘플 문자열의 최대 길이
		const unsigned int maxLengthOfString = 50;
		MK_DEV_PANEL.MsgToFreeboard(1, L"샘플 문자열의 길이 : " + MkStr(minLengthOfString) + L" ~ " + MkStr(maxLengthOfString));

		m_SelectionDice.SetMinMax(0, sampleCount - 1);
		m_Keys.Reserve(sampleCount);

		// 샘플 테이블 생성
		MkUniformDice lengthDice(minLengthOfString, maxLengthOfString);
		lengthDice.SetSeed(static_cast<unsigned int>(timeGetTime()));

		MkUniformDice charDice(32, 126);
		charDice.SetSeed(static_cast<unsigned int>(timeGetTime()) + 12345);

		wchar_t buffer[maxLengthOfString + 1];
		unsigned int bufSize = sizeof(wchar_t) * (maxLengthOfString + 1);
		unsigned int length;
		MkHashStr keyStr;

		for (unsigned int i=0; i<sampleCount; ++i)
		{
			ZeroMemory(buffer, bufSize);

			length = lengthDice.GenerateRandomNumber();
			for (unsigned int j=0; j<length; ++j)
			{
				buffer[j] = static_cast<wchar_t>(charDice.GenerateRandomNumber());
			}

			keyStr = buffer;

			// key list
			m_Keys.PushBack(keyStr);

			// MkMap & int
			m_MapAndInt.Create(i, i);

			// MkMap & MkStr
			m_MapAndStr.Create(keyStr.GetString(), i);

			// MkHashMap & int
			m_HashMapAndInt.Create(i, i);

			// MkHashMap & MkHashStr
			m_HashMapAndHashStr.Create(keyStr, i);
		}

		m_HashMapAndInt.Rehash();
		m_HashMapAndHashStr.Rehash();

		return true;
	}
Exemplo n.º 10
0
bool GameTroopState::SetUp(const GameNormalPlayer* player)
{
	m_Player = player;
	if (m_Player == NULL)
		return false;

	// wizard
	unsigned int wizardID = m_Player->GetWizardInfo().GetWizardID();
	MkHashStr wizardKey = MkStr(wizardID);
	const MkDataNode* wizardData = GameDataNode::WizardSet->GetChildNode(wizardKey);
	if (wizardData == NULL)
		return false;

	const MkDataNode* baseState = wizardData->GetChildNode(L"BaseState");

	int wizardLvIndex = m_Player->GetWizardInfo().GetWizardLevel() - 1;
	
	int baseHP = 0;
	wizardData->GetData(L"BaseHP", baseHP, 0);

	int levelHP = 0;
	wizardData->GetData(L"LevelHP", levelHP, 0);

	// base
	m_HitPointGage.Initialize(baseHP + wizardLvIndex * levelHP);

	// attack
	_SetState(baseState, GameStateName::Troop::A_BonusAttackPower, 0, 0, 0xffff);
	_SetState(baseState, GameStateName::Troop::A_AttackPowerRate, 100, 1, 0xffff);
	_SetState(baseState, GameStateName::Troop::A_OnPairBonusAP, 0, 0, 0xffff);
	_SetState(baseState, GameStateName::Troop::A_TrippleBonusAP, 0, 0, 0xffff);
	_SetState(baseState, GameStateName::Troop::A_FullHouseBonusAP, 0, 0, 0xffff);
	_SetState(baseState, GameStateName::Troop::A_FourCardBonusAP, 0, 0, 0xffff);
	_SetState(baseState, GameStateName::Troop::A_FiveCardBonusAP, 0, 0, 0xffff);
	_SetState(baseState, GameStateName::Troop::A_CriticalDamageRate, 20, 1, 100);
	_SetState(baseState, GameStateName::Troop::A_DrainHPAtFourCard, 0, 0, 100);
	_SetState(baseState, GameStateName::Troop::A_DrainHPAtFiveCard, 0, 0, 100);
	_SetState(baseState, GameStateName::Troop::A_DecayEnemyHPt, 0, 0, 100);

	// defense
	_SetState(baseState, GameStateName::Troop::D_DamageResistance, 5, 0, 100);
	_SetState(baseState, GameStateName::Troop::D_DefensePower, 0, 0, 0xffff);
	_SetState(baseState, GameStateName::Troop::D_BonusDRAtRest, 5, 0, 100);
	_SetState(baseState, GameStateName::Troop::D_Toughness, 0, 0, 0xffff);
	_SetState(baseState, GameStateName::Troop::D_CritRecoveryAtFourCard, 0, 0, 0xffff);
	_SetState(baseState, GameStateName::Troop::D_CritRecoveryAtFiveCard, 0, 0, 0xffff);

	// support
	_SetState(baseState, GameStateName::Troop::S_SupplimentCapacity, 4, 0, 20);
	_SetState(baseState, GameStateName::Troop::S_BonusTransformTime, 0, 0, 0xffff);
	_SetState(baseState, GameStateName::Troop::S_HealPower, 100, 1, 0xffff);
	_SetState(baseState, GameStateName::Troop::S_PtToGainHeal, 100, 1, 0xffff);
	_SetState(baseState, GameStateName::Troop::S_HPtAtRest, 15, 0, 0xffff);
	_SetState(baseState, GameStateName::Troop::S_HPtForEveryTurn, 0, 0, 0xffff);
	_SetState(baseState, GameStateName::Troop::S_HPtAtLoss, 0, 0, 0xffff);
	_SetState(baseState, GameStateName::Troop::S_ViewEnemyInfo, eSTIL_None, eSTIL_None, eSTIL_All);
	_SetState(baseState, GameStateName::Troop::S_WinnerBonusAPR, 100, 0, 0xffff);

	// resource
	_SetState(baseState, GameStateName::Troop::R_RedResWeight, 100, 0, 0xffff);
	_SetState(baseState, GameStateName::Troop::R_GreenResWeight, 100, 0, 0xffff);
	_SetState(baseState, GameStateName::Troop::R_VioletResWeight, 100, 0, 0xffff);
	_SetState(baseState, GameStateName::Troop::R_BlueResWeight, 100, 0, 0xffff);
	_SetState(baseState, GameStateName::Troop::R_VoidResWeight, 0, 0, 0xffff);
	_SetState(baseState, GameStateName::Troop::R_PtToGainRes, 100, 1, 0xffff);
	_SetState(baseState, GameStateName::Troop::R_RPtAtRest, 10, 1, 0xffff);
	_SetState(baseState, GameStateName::Troop::R_RPtForEveryTurn, 0, 0, 0xffff);
	_SetState(baseState, GameStateName::Troop::R_ResSlotSize, 5, 0, 8);
	_SetState(baseState, GameStateName::Troop::R_OnPairPower, 10, 1, 0xffff);
	_SetState(baseState, GameStateName::Troop::R_TripplePower, 20, 1, 0xffff);
	_SetState(baseState, GameStateName::Troop::R_FullHousePower, 40, 1, 0xffff);
	_SetState(baseState, GameStateName::Troop::R_FourCardPower, 45, 1, 0xffff);
	_SetState(baseState, GameStateName::Troop::R_FiveCardPower, 60, 1, 0xffff);
	_SetState(baseState, GameStateName::Troop::R_DecayEnemyRPtAtFourCard, 0, 0, 0xffff);
	_SetState(baseState, GameStateName::Troop::R_DecayEnemyRPtAtFiveCard, 0, 0, 0xffff);

	return true;
}
Exemplo n.º 11
0
#include "MkCore_MkCheck.h"
//#include "MkCore_MkDataNode.h"

#include "MkPA_MkProjectDefinition.h"
#include "MkPA_MkStaticResourceContainer.h"
#include "MkPA_MkWindowTagNode.h"
#include "MkPA_MkBodyFrameControlNode.h"
#include "MkPA_MkSystemWindow.h"

//------------------------------------------------------------------------------------------------//

const MkHashStr MkSystemWindow::OneAndOnlyTagName = MkStr(MKDEF_PA_WIN_CONTROL_PREFIX) + L"OAOTag";

MkWindowBaseNode* MkSystemWindow::CreateNormalButton(const MkHashStr& name)
{
	return NULL;
}

MkWindowBaseNode* MkSystemWindow::CreateOkButton(const MkHashStr& name)
{
	return NULL;
}

MkWindowBaseNode* MkSystemWindow::CreateCancelButton(const MkHashStr& name)
{
	return NULL;
}

const MkHashStr MkSystemWindow::MkMessageBox::TitleNodeName = MkStr(MKDEF_PA_WIN_CONTROL_PREFIX) + L"Title";
const MkHashStr MkSystemWindow::MkMessageBox::BodyNodeName = MkStr(MKDEF_PA_WIN_CONTROL_PREFIX) + L"Body";
Exemplo n.º 12
0
	virtual bool SetUp(MkDataNode& sharingNode)
	{
		// [ data 형태 정의 ]
		//------------------------------------------------------------------------------------------------//
		// int a;
		// float b;
		// MkVec3 c;
		// wchar_t d[64];
		//------------------------------------------------------------------------------------------------//

		// srcArray 생성
		MkInterfaceForDataWriting dwInterface;
		dwInterface.SetInputSize(ePDT_Int, SIZE_COUNT);
		dwInterface.SetInputSize(ePDT_Float, SIZE_COUNT);
		dwInterface.SetInputSize(ePDT_Vec3, SIZE_COUNT);
		dwInterface.SetInputSize(ePDT_Str, SIZE_COUNT);
		dwInterface.UpdateInputSize();

		for (int i=0; i<SIZE_COUNT; ++i)
		{
			float f = static_cast<float>(i);

			dwInterface.Write(static_cast<int>(i));
			dwInterface.Write(static_cast<float>(f * -10.f));
			dwInterface.Write(MkVec3(f, f * -2.f, f * 3.f));
			dwInterface.Write(MkStr(L"잘생겨서 죄송요~"));
		}

		MkByteArray srcArray;
		dwInterface.Flush(srcArray);
		dwInterface.Clear();

		// srcArray -> 파일로 출력
		MkInterfaceForFileWriting fwInterface;
		fwInterface.SetUp(L"test.data", true, true);
		fwInterface.Write(srcArray, MkArraySection(0));
		fwInterface.Clear();

		srcArray.Clear();
		
		// 파일을 destBuffer에 읽음
		MkByteArray destBuffer;
		MkInterfaceForFileReading frInterface;
		frInterface.SetUp(L"test.data");
		frInterface.Read(destBuffer, MkArraySection(0));
		frInterface.Clear();

		MK_DEV_PANEL.MsgToLog(MkStr::EMPTY); // 빈 칸 하나 넣고,

		// 읽어들인 결과 출력. 첫번째와 마지막 unit 대상
		MkInterfaceForDataReading drInterface;
		drInterface.SetUp(destBuffer, 0);

		for (int i=0; i<SIZE_COUNT; ++i)
		{
			int a = 0;
			drInterface.Read(a);

			float b = 0.f;
			drInterface.Read(b);

			MkVec3 c = MkVec3::Zero;
			drInterface.Read(c);

			MkStr d;
			drInterface.Read(d);

			if (i == 0)
			{
				MK_DEV_PANEL.MsgToLog(L"[ First unit ]");
				MK_DEV_PANEL.MsgToLog(L"   a : " + MkStr(a));
				MK_DEV_PANEL.MsgToLog(L"   b : " + MkStr(b));
				MK_DEV_PANEL.MsgToLog(L"   c : " + MkStr(c));
				MK_DEV_PANEL.MsgToLog(L"   d : " + MkStr(d));
			}
			else if (i == (SIZE_COUNT - 1))
			{
				MK_DEV_PANEL.MsgToLog(L"[ Last unit ]");
				MK_DEV_PANEL.MsgToLog(L"   a : " + MkStr(a));
				MK_DEV_PANEL.MsgToLog(L"   b : " + MkStr(b));
				MK_DEV_PANEL.MsgToLog(L"   c : " + MkStr(c));
				MK_DEV_PANEL.MsgToLog(L"   d : " + MkStr(d));
			}
		}

		destBuffer.Clear();

		// 출력 폴더 열기
		MkPathName::GetRootDirectory().OpenDirectoryInExplorer();

		return true;
	}
Exemplo n.º 13
0
#include "MkCore_MkCheck.h"
#include "MkCore_MkDataNode.h"

#include "MkPA_MkProjectDefinition.h"
#include "MkPA_MkStaticResourceContainer.h"
#include "MkPA_MkWindowThemedNode.h"


const MkHashStr MkWindowThemedNode::ShadowNodeName(MkStr(MKDEF_PA_WIN_VISUAL_PATTERN_PREFIX) + L"Shadow");

const MkHashStr MkWindowThemedNode::ArgKey_ChangeTheme(L"ChangeTheme");

const MkHashStr MkWindowThemedNode::ObjKey_ThemeName(L"ThemeName");
const MkHashStr MkWindowThemedNode::ObjKey_ComponentType(L"ComponentType");
const MkHashStr MkWindowThemedNode::ObjKey_CustomFormName(L"CustomFormName");
const MkHashStr MkWindowThemedNode::ObjKey_UseShadow(L"UseShadow");
const MkHashStr MkWindowThemedNode::ObjKey_ClientSize(L"ClientSize");
const MkHashStr MkWindowThemedNode::ObjKey_FrameType(L"FrameType");

//------------------------------------------------------------------------------------------------//

MkWindowThemedNode* MkWindowThemedNode::CreateChildNode(MkSceneNode* parentNode, const MkHashStr& childNodeName)
{
	MkWindowThemedNode* node = __TSI_SceneNodeDerivedInstanceOp<MkWindowThemedNode>::Alloc(parentNode, childNodeName);
	MK_CHECK(node != NULL, childNodeName.GetString() + L" MkWindowThemedNode 생성 실패") {}
	return node;
}

//------------------------------------------------------------------------------------------------//
Exemplo n.º 14
0
	virtual void Update(const MkTimeState& timeState)
	{
		// 한 프레임에 검색 할 횟수
		// 최종적으로 sampleCount 크기의 테이블에서 findCount 번 검색 한 결과가 프로파일링 됨
		const unsigned int findCount = 1000;
		MK_DEV_PANEL.MsgToFreeboard(2, L"검색 횟수 : " + MkStr(findCount));

		MkArray<unsigned int> index(findCount);
		MkArray<MkHashStr> hashKey(findCount);
		MkArray<MkStr> strKey(findCount);

		unsigned int target;
		for (unsigned int i=0; i<findCount; ++i)
		{
			target = m_SelectionDice.GenerateRandomNumber();
			index.PushBack(target);
			hashKey.PushBack(m_Keys[target]);
			strKey.PushBack(m_Keys[target].GetString());
		}

		const static MkHashStr ProfKeyMI = L"MkMap<int>";
		const static MkHashStr ProfKeyMS = L"MkMap<MkStr>";
		const static MkHashStr ProfKeyHI = L"MkHashMap<int>";
		const static MkHashStr ProfKeyHS = L"MkHashMap<MkHashStr>";

		unsigned int tmp = 0;

		// MkMap & int
		MK_PROF_MGR.Begin(ProfKeyMI);
		MK_INDEXING_LOOP(index, i)
		{
			tmp = m_MapAndInt[index[i]];
		}
		MK_PROF_MGR.End(ProfKeyMI);

		// MkMap & MkStr
		MK_PROF_MGR.Begin(ProfKeyMS);
		MK_INDEXING_LOOP(strKey, i)
		{
			tmp = m_MapAndStr[strKey[i]];
		}
		MK_PROF_MGR.End(ProfKeyMS);

		// MkHashMap & int
		MK_PROF_MGR.Begin(ProfKeyHI);
		MK_INDEXING_LOOP(index, i)
		{
			tmp = m_HashMapAndInt[index[i]];
		}
		MK_PROF_MGR.End(ProfKeyHI);

		// MkHashMap & MkHashStr
		MK_PROF_MGR.Begin(ProfKeyHS);
		MK_INDEXING_LOOP(hashKey, i)
		{
			tmp = m_HashMapAndHashStr[hashKey[i]];
		}
		MK_PROF_MGR.End(ProfKeyHS);

		MK_DEV_PANEL.MsgToFreeboard(4, MkStr(tmp));
	}
Exemplo n.º 15
0
void MkSystemEnvironment::__PrintSystemInformationToLog(void) const
{
    // 시스템 기본 정보 출력
    MkStr buffer;
    buffer.Reserve(2048);
    buffer += L"< System environment >";
    buffer += MkStr::CRLF;

    // application version
    buffer += L"   - Application version : ";
    buffer += m_ApplicationVersion.ToString();
    buffer += MkStr::CRLF;

    // minikey version
    buffer += L"   - MiniKey version : ";
    buffer += m_MiniKeyVersion.ToString();
    buffer += MkStr::CRLF;

    // build mode
    MkStr currMode;
    buffer += L"   - Build mode : ";
    switch (m_BuildMode)
    {
    case eDebug:
        buffer += L"Debug";
        break;
    case eRelease:
        buffer += L"Release";
        break;
    case eShipping:
        buffer += L"Shipping";
        break;
    }
    buffer += MkStr::CRLF;

    // user
    buffer += L"   - User name : ";
    buffer += m_CurrentUserName;
    buffer += MkStr::CRLF;

    // OS
    buffer += L"   - OS : Windows ";
    buffer += m_WindowsVersion;
    switch (m_ProcessorArchitecture)
    {
    case eEtcPA:
        buffer += L" (EtcPA)";
        break;
    case eX86:
        buffer += L" (x86)";
        break;
    case eX64:
        buffer += L" (x64)";
        break;
    }
    buffer += MkStr::CRLF;

    // core
    buffer += L"   - Cores : ";
    buffer += MkStr(m_NumberOfProcessors);
    buffer += MkStr::CRLF;

    // locale
    buffer += L"   - Code page : ";
    buffer += MkStr(MkStr::GetCodePage());
    buffer += MkStr::CRLF;

    // background resolution
    buffer += L"   - Background resolution : ";
    buffer += m_BackgroundResolution.x;
    buffer += L" * ";
    buffer += m_BackgroundResolution.y;
    buffer += MkStr::CRLF;

    // module directory
    buffer += L"   - Module directory :";
    buffer += MkStr::CRLF;
    buffer += L"     ";
    buffer += MkStr(MkPathName::GetModuleDirectory());
    buffer += MkStr::CRLF;

    // root directory
    buffer += L"   - Root directory :";
    buffer += MkStr::CRLF;
    buffer += L"     ";
    buffer += MkStr(MkPathName::GetRootDirectory());
    buffer += MkStr::CRLF;

    // print to log
    MK_DEV_PANEL.MsgToLog(buffer, false);
}
Exemplo n.º 16
0
#include "MkCore_MkCheck.h"
//#include "MkCore_MkDataNode.h"

#include "MkPA_MkProjectDefinition.h"
#include "MkPA_MkWindowDispositioner.h"
#include "MkPA_MkStaticResourceContainer.h"
#include "MkPA_MkWindowTagNode.h"
#include "MkPA_MkTitleBarControlNode.h"
#include "MkPA_MkBodyFrameControlNode.h"
#include "MkPA_MkWindowFactory.h"

const MkHashStr MkWindowFactory::OneAndOnlyTagName = MkStr(MKDEF_PA_WIN_CONTROL_PREFIX) + L"OAOTag";
const MkHashStr MkWindowFactory::OkButtonName = MkStr(MKDEF_PA_WIN_CONTROL_PREFIX) + L"Ok";
const MkHashStr MkWindowFactory::CancelButtonName = MkStr(MKDEF_PA_WIN_CONTROL_PREFIX) + L"Cancel";
const MkHashStr MkWindowFactory::BodyFrameName = MkStr(MKDEF_PA_WIN_CONTROL_PREFIX) + L"BodyFrame";

//------------------------------------------------------------------------------------------------//

void MkWindowFactory::SetThemeName(const MkHashStr& themeName)
{
	m_ThemeName = MK_STATIC_RES.GetWindowThemeSet().IsValidTheme(themeName) ? themeName : MkWindowThemeData::DefaultThemeName;
}

MkWindowTagNode* MkWindowFactory::CreateTextTagNode(const MkHashStr& name, const MkStr& message, MkFloat2& textRegion) const
{
	MkArray<MkHashStr> textName;
	return _CreateTextTagNode(name, message, textName, textRegion);
}

MkWindowTagNode* MkWindowFactory::CreateTextTagNode(const MkHashStr& name, const MkArray<MkHashStr>& message, MkFloat2& textRegion) const
Exemplo n.º 17
0
	virtual bool SetUp(MkDataNode& sharingNode)
	{
		// [ data 형태 정의 ]
		//------------------------------------------------------------------------------------------------//
		// int a;
		// float b;
		// MkVec3 c;
		// wchar_t d[64];
		//------------------------------------------------------------------------------------------------//

		// data 크기 계산
		const unsigned int sizeOfUnit =
			sizeof(int) // a
			+ sizeof(float) // b
			+ sizeof(MkVec3) // c
			+ sizeof(wchar_t) * 64; // d

		const unsigned int sizeOfData = sizeOfUnit * SIZE_COUNT;

		// chunk data 생성
		unsigned char* chunkData = new unsigned char[sizeOfData];
		ZeroMemory(chunkData, sizeOfData);

		unsigned int recordPosition = 0;
		for (int i=0; i<SIZE_COUNT; ++i)
		{
			float f = static_cast<float>(i);

			// a
			const int a = i;
			memcpy_s(&chunkData[recordPosition], sizeof(int), reinterpret_cast<const unsigned char*>(&a), sizeof(int));
			recordPosition += sizeof(int);

			// b
			const float b = f * -10.f;
			memcpy_s(&chunkData[recordPosition], sizeof(float), reinterpret_cast<const unsigned char*>(&b), sizeof(float));
			recordPosition += sizeof(float);

			// c
			const MkVec3 c = MkVec3(f, f * -2.f, f * 3.f);
			memcpy_s(&chunkData[recordPosition], sizeof(MkVec3), reinterpret_cast<const unsigned char*>(&c), sizeof(MkVec3));
			recordPosition += sizeof(MkVec3);

			// d
			wcscpy_s(reinterpret_cast<wchar_t*>(&chunkData[recordPosition]), 64, L"잘생겨서 죄송요~");
			recordPosition += sizeof(wchar_t) * 64;
		}

		// chunkData -> 파일로 출력
		std::ofstream ostream;
		ostream.open(L"test.data", std::ios::out | std::ios::binary | std::ios::trunc);
		if (ostream.is_open())
		{
			ostream.write(reinterpret_cast<const char*>(chunkData), sizeOfData);
			ostream.close();
		}

		delete [] chunkData;

		// chunk data 버퍼 생성 및 초기화
		unsigned char* chunkBuffer = new unsigned char[sizeOfData];
		ZeroMemory(chunkBuffer, sizeOfData);

		// 파일에서 읽기 -> chunkBuffer
		std::ifstream rstream;
		rstream.open(L"test.data", std::ios::in | std::ios::binary);
		if (rstream.is_open())
		{
			rstream.read(reinterpret_cast<char*>(chunkBuffer), sizeOfData);
			rstream.close();
		}

		MK_DEV_PANEL.MsgToLog(MkStr::EMPTY); // 빈 칸 하나 넣고,

		// 읽어들인 결과 출력. 첫번째와 마지막 unit 대상
		unsigned int readPosition = 0;

		// 첫번째 unit
		int a = 0;
		memcpy_s(reinterpret_cast<unsigned char*>(&a), sizeof(int), &chunkBuffer[readPosition], sizeof(int));
		readPosition += sizeof(int);

		float b = 0.f;
		memcpy_s(reinterpret_cast<unsigned char*>(&b), sizeof(float), &chunkBuffer[readPosition], sizeof(float));
		readPosition += sizeof(float);

		MkVec3 c = MkVec3::Zero;
		memcpy_s(reinterpret_cast<unsigned char*>(&c), sizeof(MkVec3), &chunkBuffer[readPosition], sizeof(MkVec3));
		readPosition += sizeof(MkVec3);

		wchar_t d[64] = {0, };
		memcpy_s(reinterpret_cast<unsigned char*>(d), sizeof(wchar_t) * 64, &chunkBuffer[readPosition], sizeof(wchar_t) * 64);

		MK_DEV_PANEL.MsgToLog(L"[ First unit ]");
		MK_DEV_PANEL.MsgToLog(L"   a : " + MkStr(a));
		MK_DEV_PANEL.MsgToLog(L"   b : " + MkStr(b));
		MK_DEV_PANEL.MsgToLog(L"   c : " + MkStr(c));
		MK_DEV_PANEL.MsgToLog(L"   d : " + MkStr(d));

		// 마지막 unit
		readPosition = sizeOfUnit * (SIZE_COUNT - 1);

		a = 0;
		memcpy_s(reinterpret_cast<unsigned char*>(&a), sizeof(int), &chunkBuffer[readPosition], sizeof(int));
		readPosition += sizeof(int);

		b = 0.f;
		memcpy_s(reinterpret_cast<unsigned char*>(&b), sizeof(float), &chunkBuffer[readPosition], sizeof(float));
		readPosition += sizeof(float);

		c = MkVec3::Zero;
		memcpy_s(reinterpret_cast<unsigned char*>(&c), sizeof(MkVec3), &chunkBuffer[readPosition], sizeof(MkVec3));
		readPosition += sizeof(MkVec3);

		ZeroMemory(d, sizeof(wchar_t) * 64);
		memcpy_s(reinterpret_cast<unsigned char*>(d), sizeof(wchar_t) * 64, &chunkBuffer[readPosition], sizeof(wchar_t) * 64);

		MK_DEV_PANEL.MsgToLog(L"[ Last unit ]");
		MK_DEV_PANEL.MsgToLog(L"   a : " + MkStr(a));
		MK_DEV_PANEL.MsgToLog(L"   b : " + MkStr(b));
		MK_DEV_PANEL.MsgToLog(L"   c : " + MkStr(c));
		MK_DEV_PANEL.MsgToLog(L"   d : " + MkStr(d));

		delete [] chunkBuffer;

		// 출력 폴더 열기
		MkPathName targetDir = MkPathName::GetRootDirectory() + L"..\\..\\"; // project foler
		targetDir.OpenDirectoryInExplorer();

		return true;
	}
Exemplo n.º 18
0
#include "MkCore_MkInputManager.h"
#include "MkCore_MkDevPanel.h"
#include "MkCore_MkDataNode.h"

#include "MkPA_MkProjectDefinition.h"
#include "MkPA_MkDeviceManager.h"
#include "MkPA_MkRenderer.h"
#include "MkPA_MkHiddenEditBox.h"
#include "MkPA_MkScrollBarControlNode.h"
#include "MkPA_MkSliderControlNode.h"
#include "MkPA_MkEditBoxControlNode.h"
#include "MkPA_MkListBoxControlNode.h"
#include "MkPA_MkWindowManagerNode.h"


const MkHashStr MkWindowManagerNode::ModalEffectNodeName(MkStr(MKDEF_PA_WIN_CONTROL_PREFIX) + L"MEN");

const MkHashStr MkWindowManagerNode::ObjKey_DepthBandwidth(L"DepthBW");
const MkHashStr MkWindowManagerNode::ObjKey_DeactivatingWindows(L"DeactivateWins");
const MkHashStr MkWindowManagerNode::ObjKey_ActivatingWindows(L"ActivateWins");
const MkHashStr MkWindowManagerNode::ObjKey_ModalWindow(L"Modal");

#define MKDEF_DEAULT_DEPTH_BANDWIDTH 1000.f

//------------------------------------------------------------------------------------------------//

MkWindowManagerNode* MkWindowManagerNode::CreateChildNode(MkSceneNode* parentNode, const MkHashStr& childNodeName)
{
	MkWindowManagerNode* node = __TSI_SceneNodeDerivedInstanceOp<MkWindowManagerNode>::Alloc(parentNode, childNodeName);
	MK_CHECK(node != NULL, childNodeName.GetString() + L" MkWindowManagerNode 생성 실패") {}
	return node;
Exemplo n.º 19
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;
					}
				}