diff --git a/CCGameFramework/render/Direct2DAllocator.cpp b/CCGameFramework/render/Direct2DAllocator.cpp index ae00369..b93b777 100644 --- a/CCGameFramework/render/Direct2DAllocator.cpp +++ b/CCGameFramework/render/Direct2DAllocator.cpp @@ -9,7 +9,7 @@ CComPtr CachedTextFormatAllocator::CreateDirect2DFont(const F CComPtr dwriteFactory = Direct2D::Singleton().GetDirectWriteFactory(); CComPtr format; HRESULT hr = dwriteFactory->CreateTextFormat( - font.fontFamily, + CString(font.fontFamily), NULL, (font.bold ? DWRITE_FONT_WEIGHT_BOLD : DWRITE_FONT_WEIGHT_NORMAL), (font.italic ? DWRITE_FONT_STYLE_ITALIC : DWRITE_FONT_STYLE_NORMAL), diff --git a/CCGameFramework/render/Direct2DRenderTarget.cpp b/CCGameFramework/render/Direct2DRenderTarget.cpp index 8060f40..d452b94 100644 --- a/CCGameFramework/render/Direct2DRenderTarget.cpp +++ b/CCGameFramework/render/Direct2DRenderTarget.cpp @@ -93,13 +93,13 @@ bool Direct2DRenderTarget::RecreateRenderTarget(CSize size) { d2dRenderTarget.Attach(renderTarget); d2dRenderTarget->SetTextAntialiasMode(D2D1_TEXT_ANTIALIAS_MODE_CLEARTYPE); - ATLTRACE(atlTraceWindowing, 0, "D2D::Create %S\n", (LPCTSTR)size.ToString()); + ATLTRACE(atlTraceWindowing, 0, "D2D::Create %s\n", (LPCSTR)size.ToString()); } } else if (previousSize != size) { HRESULT hr = d2dRenderTarget->Resize(D2D1::SizeU((int)size.cx, (int)size.cy)); - ATLTRACE(atlTraceWindowing, 0, "D2D::Resize %S\n", (LPCTSTR)size.ToString()); + ATLTRACE(atlTraceWindowing, 0, "D2D::Resize %s\n", (LPCSTR)size.ToString()); } else { diff --git a/CCGameFramework/ui/gdi/Color.cpp b/CCGameFramework/ui/gdi/Color.cpp index 0517a31..d9c00c4 100644 --- a/CCGameFramework/ui/gdi/Color.cpp +++ b/CCGameFramework/ui/gdi/Color.cpp @@ -25,7 +25,7 @@ cint CColor::Compare(CColor color) const CColor CColor::Parse(const CStringA& value) { auto code = "0123456789ABCDEF"; - if ((value.GetLength() == 7 || value.GetLength() == 9) && value[0] == _T('#')) + if ((value.GetLength() == 7 || value.GetLength() == 9) && value[0] == '#') { cint index[8] = { 0xF, 0xF, 0xF, 0xF, 0xF, 0xF, 0xF, 0xF }; for (cint i = 0; i < value.GetLength() - 1; i++) @@ -38,10 +38,10 @@ CColor CColor::Parse(const CStringA& value) } CColor c; - c.r = (unsigned char)(index[0] * 16 + index[1]); - c.g = (unsigned char)(index[2] * 16 + index[3]); - c.b = (unsigned char)(index[4] * 16 + index[5]); - c.a = (unsigned char)(index[6] * 16 + index[7]); + c.r = (BYTE)(index[0] * 16 + index[1]); + c.g = (BYTE)(index[2] * 16 + index[3]); + c.b = (BYTE)(index[4] * 16 + index[5]); + c.a = (BYTE)(index[6] * 16 + index[7]); return c; } return CColor(); @@ -77,10 +77,10 @@ bool CColor::operator>=(CColor color) const return Compare(color) >= 0; } -CString CColor::ToString() const +CStringA CColor::ToString() const { - LPCTSTR code = _T("0123456789ABCDEF"); - TCHAR result[] = _T("#00000000"); + LPCSTR code = "0123456789ABCDEF"; + char result[] = "#00000000"; result[1] = code[r / 0x10]; result[2] = code[r % 0x10]; result[3] = code[g / 0x10]; @@ -89,7 +89,7 @@ CString CColor::ToString() const result[6] = code[b % 0x10]; if (a == 0xFF) { - result[7] = _T('\0'); + result[7] = '\0'; } else { diff --git a/CCGameFramework/ui/gdi/Font.cpp b/CCGameFramework/ui/gdi/Font.cpp index 5c9d113..93fa681 100644 --- a/CCGameFramework/ui/gdi/Font.cpp +++ b/CCGameFramework/ui/gdi/Font.cpp @@ -1,13 +1,14 @@ #include "stdafx.h" #include "Gdi.h" -Font::Font() : size(0) -, bold(false) -, italic(false) -, underline(false) -, strikeline(false) -, antialias(true) -, verticalAntialias(true) +Font::Font() + : size(0) + , bold(false) + , italic(false) + , underline(false) + , strikeline(false) + , antialias(true) + , verticalAntialias(true) { } diff --git a/CCGameFramework/ui/gdi/Gdi.h b/CCGameFramework/ui/gdi/Gdi.h index 34c8f46..e1b07bb 100644 --- a/CCGameFramework/ui/gdi/Gdi.h +++ b/CCGameFramework/ui/gdi/Gdi.h @@ -51,7 +51,7 @@ class CPoint : public POINT CRect operator+(const RECT* lpRect) const; CRect operator-(const RECT* lpRect) const; - CString ToString(); + CStringA ToString(); }; @@ -95,7 +95,7 @@ class CSize : public SIZE CRect operator+(const RECT* lpRect) const; CRect operator-(const RECT* lpRect) const; - CString ToString() const; + CStringA ToString() const; }; @@ -224,7 +224,7 @@ class CRect : public RECT CRect operator|(const RECT& rect2) const; CRect MulDiv(int nMultiplier, int nDivisor) const; - CString ToString() const; + CStringA ToString() const; }; @@ -261,20 +261,20 @@ class CColor bool operator> (CColor color) const; bool operator>=(CColor color) const; - CString ToString() const; + CStringA ToString() const; }; struct Font { - CString fontFamily; - cint size; - bool bold; - bool italic; - bool underline; - bool strikeline; - bool antialias; - bool verticalAntialias; + CStringA fontFamily; + cint size; + bool bold; + bool italic; + bool underline; + bool strikeline; + bool antialias; + bool verticalAntialias; Font(); @@ -287,7 +287,7 @@ struct Font bool operator>(const Font& value)const; bool operator>=(const Font& value)const; - CString ToString() const; + CStringA ToString() const; }; #endif \ No newline at end of file diff --git a/CCGameFramework/ui/gdi/Point.cpp b/CCGameFramework/ui/gdi/Point.cpp index bfd8ad8..aaed7b8 100644 --- a/CCGameFramework/ui/gdi/Point.cpp +++ b/CCGameFramework/ui/gdi/Point.cpp @@ -91,9 +91,9 @@ CRect CPoint::operator-(const RECT* lpRect) const return CRect(lpRect) - *this; } -CString CPoint::ToString() +CStringA CPoint::ToString() { - CString str; - str.Format(_T("Point(%d, %d)"), x, y); + CStringA str; + str.Format("Point(%d, %d)", x, y); return str; } \ No newline at end of file diff --git a/CCGameFramework/ui/gdi/Rect.cpp b/CCGameFramework/ui/gdi/Rect.cpp index bcd8cb6..6c18f16 100644 --- a/CCGameFramework/ui/gdi/Rect.cpp +++ b/CCGameFramework/ui/gdi/Rect.cpp @@ -282,9 +282,9 @@ BOOL CRect::RestrictRect(const RECT& srcRect) return bFitness == 0x00FF ? TRUE : FALSE; } -CString CRect::ToString() const +CStringA CRect::ToString() const { - CString str; - str.Format(_T("Rect(%d, %d, %d, %d)"), left, top, right, bottom); + CStringA str; + str.Format("Rect(%d, %d, %d, %d)", left, top, right, bottom); return str; } diff --git a/CCGameFramework/ui/gdi/Size.cpp b/CCGameFramework/ui/gdi/Size.cpp index ad0958d..4cd99ab 100644 --- a/CCGameFramework/ui/gdi/Size.cpp +++ b/CCGameFramework/ui/gdi/Size.cpp @@ -80,9 +80,9 @@ CRect CSize::operator-(const RECT* lpRect) const return CRect(lpRect) - *this; } -CString CSize::ToString() const +CStringA CSize::ToString() const { - CString str; - str.Format(_T("Size(%d, %d)"), cx, cy); + CStringA str; + str.Format("Size(%d, %d)", cx, cy); return str; }