fix : win32 system label has wrong scale factor (#18520)

* Update UIEditBoxImpl-win32.cpp

* Fix a fixme
This commit is contained in:
Jeff Wang 2017-12-08 18:18:04 +08:00 committed by minggo
parent 78f2d9940a
commit 7916beb314
2 changed files with 3 additions and 7 deletions

View File

@ -72,7 +72,6 @@ namespace ui {
EditBoxImplWin::EditBoxImplWin(EditBox* pEditText) EditBoxImplWin::EditBoxImplWin(EditBox* pEditText)
: EditBoxImplCommon(pEditText), : EditBoxImplCommon(pEditText),
_fontSize(40),
_changedTextManually(false), _changedTextManually(false),
_hasFocus(false) _hasFocus(false)
{ {
@ -174,9 +173,8 @@ namespace ui {
void EditBoxImplWin::setNativeFont(const char * pFontName, int fontSize) void EditBoxImplWin::setNativeFont(const char * pFontName, int fontSize)
{ {
//not implemented yet auto glView = Director::getInstance()->getOpenGLView();
this->_fontSize = fontSize; HFONT hFont = CreateFontW(static_cast<int>(fontSize * glView->getScaleX()), 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, DEFAULT_CHARSET, OUT_OUTLINE_PRECIS,
HFONT hFont = CreateFontW(fontSize, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, DEFAULT_CHARSET, OUT_OUTLINE_PRECIS,
CLIP_DEFAULT_PRECIS, ANTIALIASED_QUALITY, VARIABLE_PITCH, TEXT("Arial")); CLIP_DEFAULT_PRECIS, ANTIALIASED_QUALITY, VARIABLE_PITCH, TEXT("Arial"));
SendMessage(hwndEdit, // Handle of edit control SendMessage(hwndEdit, // Handle of edit control

View File

@ -75,8 +75,6 @@ namespace ui {
static LRESULT CALLBACK hookGLFWWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam); static LRESULT CALLBACK hookGLFWWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
HWND hwndEdit; HWND hwndEdit;
//FIXME: fontSize should be in parent class
int _fontSize;
bool _changedTextManually; bool _changedTextManually;
bool _hasFocus; bool _hasFocus;
static WNDPROC s_prevCocosWndProc; static WNDPROC s_prevCocosWndProc;