//--------------------------------------------------------------------------
void VeGraphicsTest::OnTouchCancelled(VeUInt32 u32Time, VeVector<VeInputMessage::TouchPointParam>& kParams)
{
    for(VeVector<VeInputMessage::TouchPointParam>::iterator it = kParams.Begin(); it != kParams.End(); ++it)
    {
        VeDebugOutput("OnTouchCancelled[time:%d,id:%d,x:%.0f,y:%.0f]", u32Time, it->id, it->x, it->y);
    }
}
//--------------------------------------------------------------------------
void VeGraphicsTest::OnTouchBegan(VeUInt32 u32Time, VeUInt32 id, VeFloat32 x, VeFloat32 y)
{
    VeDebugOutput("OnTouchBegan[time:%d,id:%d,x:%.0f,y:%.0f]", u32Time, id, x, y);
    g_pAudioSystem->Play(m_spTestSound);
    
    //g_pAudioSystem->Play(m_spTestMusic);
}
//--------------------------------------------------------------------------
void VeGraphicsTest::OnMousePressed(VeMouse::State eBtn, VeUInt16 x, VeUInt16 y)
{
	VeDebugOutput("MouseButton%d:Pressed Pos:%d,%d", eBtn, x, y);
	g_pAudioSystem->Play(m_spTestSound);

	//g_pAudioSystem->Play(m_spTestMusic);
}
Version NativeGetVersion()
{
	Version kVersion;
#	if(CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
	JniMethodInfo t;
	if(JniHelper::getStaticMethodInfo(t,
		"cn/VenusIE/TexasPoker/TexasPokerActivity",
		"jni_GetVersionCode",
		"()I"))
	{
		jint iVersionCode = t.env->CallStaticIntMethod(t.classID, t.methodID);
		t.env->DeleteLocalRef(t.classID);
		kVersion.m_au8Version[0] = iVersionCode / 1000;
		iVersionCode -= kVersion.m_au8Version[0] * 1000;
		kVersion.m_au8Version[1] = iVersionCode / 100;
		iVersionCode -= kVersion.m_au8Version[1] * 100;
		kVersion.m_au8Version[2] = iVersionCode / 10;
		iVersionCode -= kVersion.m_au8Version[2] * 10;
		kVersion.m_au8Version[3] = iVersionCode;
	}
#	endif
#	if(CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
    CocoaHelper::GetAppVersion(kVersion.m_au8Version);
#	endif
#	if(CC_TARGET_PLATFORM == CC_PLATFORM_WIN32)
	VeChar8 acFullPath[MAX_PATH]; 
	GetModuleFileNameA(NULL, acFullPath, sizeof(acFullPath));
	DWORD dwVerHnd(NULL);
	DWORD dwVerInfoSize = GetFileVersionInfoSize(acFullPath, &dwVerHnd);
	VE_ASSERT(dwVerInfoSize);
	HANDLE hMem; 
	LPVOID lpvMem; 
	VeUInt32 u32InfoSize(0); 
	hMem = GlobalAlloc(GMEM_MOVEABLE, dwVerInfoSize); 
	lpvMem = GlobalLock(hMem); 
	GetFileVersionInfo(acFullPath, dwVerHnd, dwVerInfoSize, lpvMem);
	VS_FIXEDFILEINFO* pkFileInfo(NULL);
	VerQueryValue(lpvMem, "\\", (void**)&pkFileInfo, &u32InfoSize);
	VE_ASSERT(pkFileInfo);
	kVersion.m_au8Version[0] = HIWORD(pkFileInfo->dwProductVersionMS);
	kVersion.m_au8Version[1] = LOWORD(pkFileInfo->dwProductVersionMS);
	kVersion.m_au8Version[2] = HIWORD(pkFileInfo->dwProductVersionLS);
	kVersion.m_au8Version[3] = LOWORD(pkFileInfo->dwProductVersionLS);
	GlobalUnlock(hMem);
	GlobalFree(hMem);
#	endif
	VeDebugOutput("Version:%d.%d.%d.%d", kVersion.m_au8Version[0], kVersion.m_au8Version[1], kVersion.m_au8Version[2], kVersion.m_au8Version[3]);
	return kVersion;
}
//--------------------------------------------------------------------------
void VeGraphicsTest::OnMouseReleased(VeMouse::State eBtn, VeUInt16 x, VeUInt16 y)
{
	VeDebugOutput("MouseButton%d:Released Pos:%d,%d", eBtn, x, y);
	//m_spTestMusic->Stop();

	//VeFiniteTimeActionPtr spAction = VeRotateBy2D::Create(1.0f, VE_MATH_PI_F);
	//g_pSceneManager->GetRootNode2D()->RunAction(
	//	VeSequence::Create(VeRotateTo2D::Create(1.0f, VE_MATH_PI_F), spAction, spAction->Reverse(), spAction, spAction->Reverse(), NULL));
	//g_pSceneManager->GetRootNode2D()->RunAction(VeRepeatForever::Create(VeRotateBy2D::Create(1.0f, VE_MATH_PI_F)));
	//g_pSceneManager->GetRootNode2D()->RunAction(VeMoveBy2D::Create(0.5f, 100, 100));
	/*g_pSceneManager->GetRootNode2D()->RunAction(VeSpawn::Create(
		VeMoveBy2D::Create(1.0f, 100, 100),
		VeMoveBy2D::Create(1.0f, 100, 100),
		VeRotateBy2D::Create(1.0f, VE_MATH_PI_F),
		NULL));*/
}
void NativeOnEvent(const VeChar8* pcEvent)
{
	VeDebugOutput("NativeOnEvent:%s", pcEvent);
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
	JniMethodInfo t;
	if(JniHelper::getStaticMethodInfo(t,
		"cn/VenusIE/TexasPoker/TexasPokerActivity",
		"jni_OnEvent",
		"(Ljava/lang/String;)V"))
	{
		jstring strEvent = t.env->NewStringUTF(pcEvent);
		t.env->CallStaticVoidMethod(t.classID, t.methodID, strEvent);
		t.env->DeleteLocalRef(t.classID);
	}
#endif
#if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
	CocoaHelper::OnEvent(pcEvent);
#endif
}
//--------------------------------------------------------------------------
void VeGraphicsTest::OnCallback()
{
	VeDebugOutput("Callback");
}
//--------------------------------------------------------------------------
void VeGraphicsTest::OnTouchEnded(VeUInt32 u32Time, VeUInt32 id, VeFloat32 x, VeFloat32 y)
{
    VeDebugOutput("OnTouchEnded[time:%d,id:%d,x:%.0f,y:%.0f]", u32Time, id, x, y);
    //m_spTestMusic->Stop();
}
//--------------------------------------------------------------------------
void VeGraphicsTest::OnJoyStickAxisChanged(VeUInt32 u32Axis, VeUInt32 u32Value)
{
	VeDebugOutput("Axis%dChanged: %d", u32Axis, u32Value);
}
//--------------------------------------------------------------------------
void VeGraphicsTest::OnJoyStickReleased(VeUInt32 u32Button)
{
	VeDebugOutput("OnJoyStickReleased: %d", u32Button);
}
//--------------------------------------------------------------------------
void VeGraphicsTest::OnBufferResized(VeUInt32 u32Width, VeUInt32 u32Height)
{
	VeDebugOutput("OnBufferResized: %dx%d", u32Width, u32Height);
}