diff --git a/HelloWorld/wophone/HelloWorld.wophone.vcproj b/HelloWorld/wophone/HelloWorld.wophone.vcproj index 9bc2808bfe..147e00f8bb 100644 --- a/HelloWorld/wophone/HelloWorld.wophone.vcproj +++ b/HelloWorld/wophone/HelloWorld.wophone.vcproj @@ -181,7 +181,7 @@ @@ -203,19 +203,7 @@ - - - - - - - - - - - - - - + + + + + diff --git a/cocos2dx/platform/wophone/CCEGLView_wophone.cpp b/cocos2dx/platform/wophone/CCEGLView_wophone.cpp index e63c175830..9ae78d50c4 100644 --- a/cocos2dx/platform/wophone/CCEGLView_wophone.cpp +++ b/cocos2dx/platform/wophone/CCEGLView_wophone.cpp @@ -206,6 +206,7 @@ CCEGLView::CCEGLView(TApplication * pApp) , m_pTextField(NULL) , m_nTextLen(0) { + memset(&m_rcKeyboard, 0, sizeof(m_rcKeyboard)); } CCEGLView::~CCEGLView() @@ -214,7 +215,7 @@ CCEGLView::~CCEGLView() CC_SAFE_DELETE(m_pEGL); } -Boolean CCEGLView::Create(int nWidthInPoints, int nHeightInPoints) +Boolean CCEGLView::Create(int nWidthInPoints, int nHeightInPoints, UInt32 eRotateMode) { // record the window size in points m_tSizeInPoints.SetWidth(nWidthInPoints); @@ -236,6 +237,23 @@ Boolean CCEGLView::Create(int nWidthInPoints, int nHeightInPoints) Boolean bRet = TWindow::Create(&TRectangle(0, 0, nWidth, nHeight)); + Coord temp; + Int32 tmp; + if (WM_WINDOW_ROTATE_MODE_CW == eRotateMode + || WM_WINDOW_ROTATE_MODE_CCW == eRotateMode) + { + temp = m_rcViewPort.X(); + m_rcViewPort.SetX(m_rcViewPort.Y()); + m_rcViewPort.SetY(temp); + temp = m_rcViewPort.Width(); + m_rcViewPort.SetWidth(m_rcViewPort.Height()); + m_rcViewPort.SetHeight(temp); + + tmp = m_tSizeInPoints.Width(); + m_tSizeInPoints.SetWidth(m_tSizeInPoints.Height()); + m_tSizeInPoints.SetHeight(tmp); + } + this->RotateWindow(eRotateMode); if (bRet) { s_pMainWindow = this; @@ -310,6 +328,46 @@ Boolean CCEGLView::EventHandler(TApplication * pApp, EventType * pEvent) } break; + case EVENT_WinImeStatusNotify: + { + EosImeNotifyEventType * pNotify = (EosImeNotifyEventType*)pEvent; + if (IME_NOTIFY_TYPE_KEYBOARD_SIZE == pNotify->notifyType) + { + m_rcKeyboard = pNotify->rtKeyboard; + + //keyboard open + CCIMEKeyboardNotificationInfo info; + info.begin = CCRectMake((float)0 + , (float)0 - m_rcKeyboard.extent.Y + , (float)m_rcKeyboard.extent.X + , (float)m_rcKeyboard.extent.Y); + info.end = CCRectMake((float)0 + , (float)0 + , (float)m_rcKeyboard.extent.X + , (float)m_rcKeyboard.extent.Y); + info.duration = 0; + CCIMEDispatcher::sharedDispatcher()->dispatchKeyboardWillShow(info); + CCIMEDispatcher::sharedDispatcher()->dispatchKeyboardDidShow(info); + } + else if (IME_NOTIFY_TYPE_IME_CLOSE == pNotify->notifyType) + { + CCIMEKeyboardNotificationInfo info; + info.begin = CCRectMake((float)0 + , (float)0 + , (float)m_rcKeyboard.extent.X + , (float)m_rcKeyboard.extent.Y); + info.end = CCRectMake((float)0 + , (float)0 - m_rcKeyboard.extent.Y + , (float)m_rcKeyboard.extent.X + , (float)m_rcKeyboard.extent.Y); + info.duration = 0; + CCIMEDispatcher::sharedDispatcher()->dispatchKeyboardWillHide(info); + CCIMEDispatcher::sharedDispatcher()->dispatchKeyboardDidHide(info); + } + pEvent->sParam1 = pEvent->sParam1; + } + break; + case EVENT_FieldChanged: do { diff --git a/cocos2dx/platform/wophone/CCEGLView_wophone.h b/cocos2dx/platform/wophone/CCEGLView_wophone.h index 949b894844..7c8df9f3d3 100644 --- a/cocos2dx/platform/wophone/CCEGLView_wophone.h +++ b/cocos2dx/platform/wophone/CCEGLView_wophone.h @@ -47,7 +47,7 @@ public: CCEGLView(TApplication * pApp); virtual ~CCEGLView(); - virtual Boolean Create(int nWidthInPoints, int nHeightInPoints); + virtual Boolean Create(int nWidthInPoints, int nHeightInPoints, UInt32 eRotateMode = WM_WINDOW_ROTATE_MODE_NORMAL); virtual Boolean AfterCreate(void); virtual Boolean EventHandler(TApplication * pApp, EventType * pEvent); @@ -84,6 +84,7 @@ private: TRectangle m_rcViewPort; TEdit * m_pTextField; int m_nTextLen; + RectangleType m_rcKeyboard; }; } // end of namespace cocos2d diff --git a/tests/AppDelegate.cpp b/tests/AppDelegate.cpp index a4bf309764..6ac18fc83c 100644 --- a/tests/AppDelegate.cpp +++ b/tests/AppDelegate.cpp @@ -46,7 +46,7 @@ bool AppDelegate::initInstance() // Initialize OpenGLView instance, that release by CCDirector when application terminate. // The tests is designed as HVGA. CCEGLView* pMainWnd = new CCEGLView(this); - CC_BREAK_IF(! pMainWnd || ! pMainWnd->Create(320,480)); + CC_BREAK_IF(! pMainWnd || ! pMainWnd->Create(320 ,480, WM_WINDOW_ROTATE_MODE_CW)); #ifndef _TRANZDA_VM_ // on wophone emulator, we copy resources files to Work7/NEWPLUS/TDA_DATA/Data folder instead of zip file diff --git a/tests/test.wophone/Makefile.ARM b/tests/test.wophone/Makefile.ARM index 3dba224e46..8c71c7d592 100644 --- a/tests/test.wophone/Makefile.ARM +++ b/tests/test.wophone/Makefile.ARM @@ -83,6 +83,7 @@ OBJECTS = \ $(OBJECTS_DIR)/KeypadTest.o \ $(OBJECTS_DIR)/LabelTest.o \ $(OBJECTS_DIR)/LayerTest.o \ + $(OBJECTS_DIR)/TextInputTest.o \ $(OBJECTS_DIR)/MenuTest.o \ $(OBJECTS_DIR)/MotionStreakTest.o \ $(OBJECTS_DIR)/ParallaxTest.o \ @@ -258,6 +259,9 @@ $(OBJECTS_DIR)/KeypadTest.o : ../tests/KeypadTest/KeypadTest.cpp $(OBJECTS_DIR)/LabelTest.o : ../tests/LabelTest/LabelTest.cpp $(CXX) -c $(CXX_FLAGS) $(INCLUDE_PATH) $(LAST_INCLUDE_PATH) -o $(OBJECTS_DIR)/LabelTest.o ../tests/LabelTest/LabelTest.cpp +$(OBJECTS_DIR)/TextInputTest.o : ../tests/TextInputTest/TextInputTest.cpp + $(CXX) -c $(CXX_FLAGS) $(INCLUDE_PATH) $(LAST_INCLUDE_PATH) -o $(OBJECTS_DIR)/TextInputTest.o ../tests/TextInputTest/TextInputTest.cpp + $(OBJECTS_DIR)/LayerTest.o : ../tests/LayerTest/LayerTest.cpp $(CXX) -c $(CXX_FLAGS) $(INCLUDE_PATH) $(LAST_INCLUDE_PATH) -o $(OBJECTS_DIR)/LayerTest.o ../tests/LayerTest/LayerTest.cpp diff --git a/tests/test.wophone/test.wophone.vcproj b/tests/test.wophone/test.wophone.vcproj index 210304320d..e64b2d6e59 100644 --- a/tests/test.wophone/test.wophone.vcproj +++ b/tests/test.wophone/test.wophone.vcproj @@ -183,7 +183,7 @@ @@ -195,21 +195,769 @@ RelativePath="..\AppDelegate.h" > + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -