Skip to content

Commit

Permalink
Fix encoding
Browse files Browse the repository at this point in the history
* wchar -> char
* lua <--> char
  • Loading branch information
bajdcc committed Feb 10, 2017
1 parent d198474 commit d273d9b
Show file tree
Hide file tree
Showing 8 changed files with 42 additions and 41 deletions.
2 changes: 1 addition & 1 deletion CCGameFramework/render/Direct2DAllocator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ CComPtr<IDWriteTextFormat> CachedTextFormatAllocator::CreateDirect2DFont(const F
CComPtr<IDWriteFactory> dwriteFactory = Direct2D::Singleton().GetDirectWriteFactory();
CComPtr<IDWriteTextFormat> 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),
Expand Down
4 changes: 2 additions & 2 deletions CCGameFramework/render/Direct2DRenderTarget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down
18 changes: 9 additions & 9 deletions CCGameFramework/ui/gdi/Color.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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++)
Expand All @@ -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();
Expand Down Expand Up @@ -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];
Expand All @@ -89,7 +89,7 @@ CString CColor::ToString() const
result[6] = code[b % 0x10];
if (a == 0xFF)
{
result[7] = _T('\0');
result[7] = '\0';
}
else
{
Expand Down
15 changes: 8 additions & 7 deletions CCGameFramework/ui/gdi/Font.cpp
Original file line number Diff line number Diff line change
@@ -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)
{

}
Expand Down
26 changes: 13 additions & 13 deletions CCGameFramework/ui/gdi/Gdi.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ class CPoint : public POINT
CRect operator+(const RECT* lpRect) const;
CRect operator-(const RECT* lpRect) const;

CString ToString();
CStringA ToString();
};


Expand Down Expand Up @@ -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;
};


Expand Down Expand Up @@ -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;
};


Expand Down Expand Up @@ -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();

Expand All @@ -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
6 changes: 3 additions & 3 deletions CCGameFramework/ui/gdi/Point.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
6 changes: 3 additions & 3 deletions CCGameFramework/ui/gdi/Rect.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
6 changes: 3 additions & 3 deletions CCGameFramework/ui/gdi/Size.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

0 comments on commit d273d9b

Please sign in to comment.