⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 windowscaledialog.cpp

📁 骨骼动画....把魔兽模型解出的代码..
💻 CPP
字号:
//+-----------------------------------------------------------------------------
//| Included files
//+-----------------------------------------------------------------------------
#include "WindowScaleDialog.h"


//+-----------------------------------------------------------------------------
//| Global objects
//+-----------------------------------------------------------------------------
WINDOW_SCALE_DIALOG ScaleDialog;


//+-----------------------------------------------------------------------------
//| Static member variables
//+-----------------------------------------------------------------------------
SCALE_INFO WINDOW_SCALE_DIALOG::StaticScaleInfo;


//+-----------------------------------------------------------------------------
//| Constructor
//+-----------------------------------------------------------------------------
WINDOW_SCALE_DIALOG::WINDOW_SCALE_DIALOG()
{
	//Empty
}


//+-----------------------------------------------------------------------------
//| Destructor
//+-----------------------------------------------------------------------------
WINDOW_SCALE_DIALOG::~WINDOW_SCALE_DIALOG()
{
	//Empty
}


//+-----------------------------------------------------------------------------
//| Displays the dialog
//+-----------------------------------------------------------------------------
BOOL WINDOW_SCALE_DIALOG::Display(HWND ParentWindow, SCALE_INFO& ScaleInfo) CONST
{
	StaticScaleInfo.PivotPoint = ScaleInfo.PivotPoint;
	if(DialogBoxParam(GetModuleHandle(NULL), MAKEINTRESOURCE(DialogScale), ParentWindow, DialogMessageHandler, 0))
	{
		ScaleInfo = StaticScaleInfo;
		return TRUE;
	}

	return FALSE;
}


//+-----------------------------------------------------------------------------
//| Handles the dialog messages
//+-----------------------------------------------------------------------------
BOOL CALLBACK WINDOW_SCALE_DIALOG::DialogMessageHandler(HWND Window, UINT Message, WPARAM W, LPARAM L)
{
	switch(Message)
	{
		case WM_INITDIALOG:
		{
			AddWindow(Window);
			CenterWindow(Window);

			SetFloat(GetDlgItem(Window, DialogScaleEditX), StaticScaleInfo.Scaling.x);
			SetFloat(GetDlgItem(Window, DialogScaleEditY), StaticScaleInfo.Scaling.y);
			SetFloat(GetDlgItem(Window, DialogScaleEditZ), StaticScaleInfo.Scaling.z);
			SetFloat(GetDlgItem(Window, DialogScaleEditPivotX), StaticScaleInfo.PivotPoint.x);
			SetFloat(GetDlgItem(Window, DialogScaleEditPivotY), StaticScaleInfo.PivotPoint.y);
			SetFloat(GetDlgItem(Window, DialogScaleEditPivotZ), StaticScaleInfo.PivotPoint.z);

			CheckDlgButton(Window, DialogScaleButtonUsePivotPoint, StaticScaleInfo.AroundPivotPoint);
			CheckDlgButton(Window, DialogScaleButtonUseCentreOfMass, !StaticScaleInfo.AroundPivotPoint);

			if(!StaticScaleInfo.AroundPivotPoint)
			{
				EnableWindow(GetDlgItem(Window, DialogScaleEditPivotX), FALSE);
				EnableWindow(GetDlgItem(Window, DialogScaleEditPivotY), FALSE);
				EnableWindow(GetDlgItem(Window, DialogScaleEditPivotZ), FALSE);
			}

			return TRUE;
		}

		case WM_COMMAND:
		{
			switch(LOWORD(W))
			{
				case DialogScaleButtonUsePivotPoint:
				{
					EnableWindow(GetDlgItem(Window, DialogScaleEditPivotX), TRUE);
					EnableWindow(GetDlgItem(Window, DialogScaleEditPivotY), TRUE);
					EnableWindow(GetDlgItem(Window, DialogScaleEditPivotZ), TRUE);
					return TRUE;
				}

				case DialogScaleButtonUseCentreOfMass:
				{
					EnableWindow(GetDlgItem(Window, DialogScaleEditPivotX), FALSE);
					EnableWindow(GetDlgItem(Window, DialogScaleEditPivotY), FALSE);
					EnableWindow(GetDlgItem(Window, DialogScaleEditPivotZ), FALSE);
					return TRUE;
				}

				case DialogScaleButtonOk:
				{
					StaticScaleInfo.Scaling.x = GetFloat(GetDlgItem(Window, DialogScaleEditX), 1.0f);
					StaticScaleInfo.Scaling.y = GetFloat(GetDlgItem(Window, DialogScaleEditY), 1.0f);
					StaticScaleInfo.Scaling.z = GetFloat(GetDlgItem(Window, DialogScaleEditZ), 1.0f);
					StaticScaleInfo.PivotPoint.x = GetFloat(GetDlgItem(Window, DialogScaleEditPivotX), 0.0f);
					StaticScaleInfo.PivotPoint.y = GetFloat(GetDlgItem(Window, DialogScaleEditPivotY), 0.0f);
					StaticScaleInfo.PivotPoint.z = GetFloat(GetDlgItem(Window, DialogScaleEditPivotZ), 0.0f);

					StaticScaleInfo.AroundPivotPoint = CheckStateToBool(IsDlgButtonChecked(Window, DialogScaleButtonUsePivotPoint));

					RemoveWindow(Window);
					EndDialog(Window, 1);
					return TRUE;
				}

				case DialogScaleButtonCancel:
				{
					RemoveWindow(Window);
					EndDialog(Window, 0);
					return TRUE;
				}
			}

			return FALSE;
		}

		case WM_CLOSE:
		{
			::SendMessage(Window, WM_COMMAND, DialogScaleButtonCancel, 0);
			return TRUE;
		}
	}

	return FALSE;
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -