Files
Cyd 2b8ca921cb Initial full mirror of c:\VWE (source + assets + toolchain + outputs) via Git LFS
Complete disaster-recovery snapshot: engine/game source, game data assets,
VC6 toolchain + DX SDKs, build outputs, deployed game, and _UNUSED archive.
Large binaries in Git LFS; text preserved byte-for-byte (core.autocrlf=false,
no eol attributes). See RECOVERY.md for the one-clone rebuild procedure.
2026-06-24 21:28:16 -05:00

95 lines
2.0 KiB
C++

// MsgDlg.cpp : implementation file
//
#include "stdafx.h"
#include "mw4gameed.h"
#include "MsgDlg.h"
/////////////////////////////////////////////////////////////////////////////
// CMsgDlg dialog
CMsgDlg::CMsgDlg(char* msg, char* font, int fontSize, CWnd* pParent, int x, int y, int cx, int cy)
: CDialog(CMsgDlg::IDD, pParent)
{
//{{AFX_DATA_INIT(CMsgDlg)
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
if (!font)
m_Font = "Arial";
else
m_Font = font;
m_Text = msg;
m_Size = fontSize;
backColor = GetSysColor(COLOR_3DFACE);
textColor = RGB(0,30,240);
Create(CMsgDlg::IDD,pParent);
if (x > 0)
{
SetWindowPos(NULL,x,y,cx,cy,0);
sized = true;
}
else
sized = false;
}
void CMsgDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CMsgDlg)
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CMsgDlg, CDialog)
//{{AFX_MSG_MAP(CMsgDlg)
ON_WM_PAINT()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CMsgDlg message handlers
void CMsgDlg::OnPaint()
{
CPaintDC dc(this); // device context for painting
dc.SetBkColor(backColor);
dc.SetTextColor(textColor);
CFont font;
font.CreatePointFont(m_Size,m_Font,&dc);
SetFont(&font,FALSE);
CFont* def_font = dc.SelectObject(&font);
CSize size = dc.GetTextExtent(m_Text);
RECT r;
if (!sized)
{
CWnd* pParent = GetParent();
if (pParent)
pParent->GetClientRect(&r);
else
{
r.right = GetSystemMetrics(SM_CXSCREEN);
r.bottom = GetSystemMetrics(SM_CYSCREEN);
}
size.cx += 15;
size.cy += 15;
SetWindowPos(NULL,r.right / 2 - size.cx / 2,r.bottom / 2 - size.cy / 2,size.cx,size.cy,0);
sized = true;
}
GetClientRect(&r);
CRect etor(r.right / 2 - size.cx / 2,r.bottom / 2 - size.cy / 2,size.cx,size.cy);
dc.ExtTextOut(r.right / 2 - size.cx / 2,r.bottom / 2 - size.cy / 2,ETO_OPAQUE,&etor,m_Text,NULL);
dc.SelectObject(def_font);
font.DeleteObject();
}