This commit is contained in:
Daveo 2001-04-28 15:20:54 +00:00
parent 8804162061
commit 1bf8e68d21
2 changed files with 146 additions and 0 deletions

View File

@ -0,0 +1,85 @@
// GUILayerActor.cpp : implementation file
//
#include "stdafx.h"
#include "mapedit.h"
#include "GUILayerActor.h"
#include "MapEditDoc.h"
#include "MainFrm.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CGUILayerActor dialog
CGUILayerActor::CGUILayerActor(CWnd* pParent /*=NULL*/)
: CDialog(CGUILayerActor::IDD, pParent)
{
DisableCallback(true);
//{{AFX_DATA_INIT(CGUILayerActor)
//}}AFX_DATA_INIT
DisableCallback(false);
}
void CGUILayerActor::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CGUILayerActor)
DDX_Control(pDX, IDC_ACTOR_TURNRATE_SPIN, m_TurnRateSpin);
DDX_Control(pDX, IDC_ACTOR_SPEED_SPIN, m_SpeedSpin);
DDX_Control(pDX, IDC_ACTOR_HEALTH_SPIN, m_HealthSpin);
DDX_Control(pDX, IDC_ACTOR_ATTACK_SPIN, m_AttackSpin);
DDX_Control(pDX, IDC_ACTOR_COLLISION, m_Collision);
DDX_Control(pDX, IDC_ACTOR_PLAYER, m_Player);
DDX_Control(pDX, IDC_ACTOR_TURNRATE, m_TurnRate);
DDX_Control(pDX, IDC_ACTOR_SPEED, m_Speed);
DDX_Control(pDX, IDC_ACTOR_ATTACK, m_Attack);
DDX_Control(pDX, IDC_ACTOR_HEALTH, m_Health);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CGUILayerActor, CDialog)
//{{AFX_MSG_MAP(CGUILayerActor)
ON_EN_CHANGE(IDC_ACTOR_HEALTH, OnChangeParam)
ON_EN_CHANGE(IDC_ACTOR_ATTACK, OnChangeParam)
ON_BN_CLICKED(IDC_ACTOR_COLLISION, OnChangeParam)
ON_EN_CHANGE(IDC_ACTOR_SPEED, OnChangeParam)
ON_EN_CHANGE(IDC_ACTOR_TURNRATE, OnChangeParam)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
void CGUILayerActor::SetVal(CEdit &Dlg,int Val)
{
CString Str;
if (!Dlg) return;
DisableCallback(true);
Str.Format("%i",Val);
Dlg.SetWindowText(Str);
DisableCallback(false);
}
/////////////////////////////////////////////////////////////////////////////
int CGUILayerActor::GetVal(CEdit &Dlg)
{
CString Str;
int Val=0;
if (!Dlg) return(0);
Dlg.GetWindowText(Str);
if (Str.GetLength())
Val=atoi(Str);
return(Val);
}
/////////////////////////////////////////////////////////////////////////////
// CGUILayerActor message handlers
void CGUILayerActor::OnChangeParam() {if (!CallbackFlag) theApp.GetCurrent()->GUIChanged();}

View File

@ -0,0 +1,61 @@
#if !defined(AFX_GUILAYERACTOR_H__D2268E7C_1D7E_4C2F_AF3C_49BB374ED65B__INCLUDED_)
#define AFX_GUILAYERACTOR_H__D2268E7C_1D7E_4C2F_AF3C_49BB374ED65B__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
// GUILayerActor.h : header file
//
/////////////////////////////////////////////////////////////////////////////
// CGUILayerActor dialog
class CGUILayerActor : public CDialog
{
// Construction
public:
CGUILayerActor(CWnd* pParent = NULL); // standard constructor
// Dialog Data
//{{AFX_DATA(CGUILayerActor)
enum { IDD = IDD_LAYER_ACTOR };
CSpinButtonCtrl m_TurnRateSpin;
CSpinButtonCtrl m_SpeedSpin;
CSpinButtonCtrl m_HealthSpin;
CSpinButtonCtrl m_AttackSpin;
CButton m_Collision;
CButton m_Player;
CEdit m_TurnRate;
CEdit m_Speed;
CEdit m_Attack;
CEdit m_Health;
//}}AFX_DATA
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CGUILayerActor)
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
// Implementation
public:
void DisableCallback(bool f) {CallbackFlag=f;}
void SetVal(CEdit &Dlg,int Number);
int GetVal(CEdit &Dlg);
protected:
bool CallbackFlag;
// Generated message map functions
//{{AFX_MSG(CGUILayerActor)
afx_msg void OnChangeParam();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_GUILAYERACTOR_H__D2268E7C_1D7E_4C2F_AF3C_49BB374ED65B__INCLUDED_)