issue #1177:Updated some files for ios port.

This commit is contained in:
James Chen 2012-04-23 15:40:46 +08:00
parent 5b77e6e80e
commit af86a52f27
5 changed files with 49 additions and 20 deletions

View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IDEWorkspaceSharedSettings_AutocreateContextsIfNeeded</key>
<true/>
</dict>
</plist>

View File

@ -195,9 +195,15 @@ void CCEGLViewProtocol::handleTouchesBegin(int num, int ids[], float xs[], float
} }
CCTouch* pTouch = s_pTouches[nUnusedIndex] = new CCTouch(); CCTouch* pTouch = s_pTouches[nUnusedIndex] = new CCTouch();
pTouch->SetTouchInfo(nUnusedIndex, (x - m_rcViewPort.origin.x) / m_fScreenScaleFactor, if (m_bNeedScale)
(y - m_rcViewPort.origin.y) / m_fScreenScaleFactor); {
pTouch->SetTouchInfo(nUnusedIndex, (x - m_rcViewPort.origin.x) / m_fScreenScaleFactor,
(y - m_rcViewPort.origin.y) / m_fScreenScaleFactor);
}
else
{
pTouch->SetTouchInfo(nUnusedIndex, x, y);
}
CCInteger* pInterObj = new CCInteger(nUnusedIndex); CCInteger* pInterObj = new CCInteger(nUnusedIndex);
s_TouchesIntergerDict.setObject(pInterObj, id); s_TouchesIntergerDict.setObject(pInterObj, id);
set.addObject(pTouch); set.addObject(pTouch);
@ -233,8 +239,15 @@ void CCEGLViewProtocol::handleTouchesMove(int num, int ids[], float xs[], float
CCTouch* pTouch = s_pTouches[pIndex->getValue()]; CCTouch* pTouch = s_pTouches[pIndex->getValue()];
if (pTouch) if (pTouch)
{ {
pTouch->SetTouchInfo(pIndex->getValue(), (x - m_rcViewPort.origin.x) / m_fScreenScaleFactor, if (m_bNeedScale)
(y - m_rcViewPort.origin.y) / m_fScreenScaleFactor); {
pTouch->SetTouchInfo(pIndex->getValue(), (x - m_rcViewPort.origin.x) / m_fScreenScaleFactor,
(y - m_rcViewPort.origin.y) / m_fScreenScaleFactor);
}
else
{
pTouch->SetTouchInfo(pIndex->getValue(), x, y);
}
set.addObject(pTouch); set.addObject(pTouch);
} }
else else
@ -274,8 +287,16 @@ void CCEGLViewProtocol::getSetOfTouchesEndOrCancel(CCSet& set, int num, int ids[
{ {
CCLOG("Ending touches with id: %d, x=%f, y=%f", id, x, y); CCLOG("Ending touches with id: %d, x=%f, y=%f", id, x, y);
pTouch->SetTouchInfo(pIndex->getValue(), (x - m_rcViewPort.origin.x) / m_fScreenScaleFactor, if (m_bNeedScale)
(y - m_rcViewPort.origin.y) / m_fScreenScaleFactor); {
pTouch->SetTouchInfo(pIndex->getValue(), (x - m_rcViewPort.origin.x) / m_fScreenScaleFactor,
(y - m_rcViewPort.origin.y) / m_fScreenScaleFactor);
}
else
{
pTouch->SetTouchInfo(pIndex->getValue(), x, y);
}
set.addObject(pTouch); set.addObject(pTouch);
// release the object // release the object

View File

@ -57,17 +57,17 @@ bool CCEGLView::isOpenGLReady()
return [EAGLView sharedEGLView] != NULL; return [EAGLView sharedEGLView] != NULL;
} }
bool CCEGLView::canSetContentScaleFactor() bool CCEGLView::canSetContentScaleFactor()
{ {
return [[EAGLView sharedEGLView] respondsToSelector:@selector(setContentScaleFactor:)]; return [[EAGLView sharedEGLView] respondsToSelector:@selector(setContentScaleFactor:)];
} }
void CCEGLView::setContentScaleFactor(float contentScaleFactor) void CCEGLView::setContentScaleFactor(float contentScaleFactor)
{ {
UIView * view = [EAGLView sharedEGLView]; UIView * view = [EAGLView sharedEGLView];
view.contentScaleFactor = contentScaleFactor; view.contentScaleFactor = contentScaleFactor;
[view setNeedsLayout]; [view setNeedsLayout];
} }
void CCEGLView::end() void CCEGLView::end()
{ {

View File

@ -229,7 +229,7 @@ static EAGLView *view = 0;
//discardFramebufferSupported_ = [[CCConfiguration sharedConfiguration] supportsDiscardFramebuffer]; //discardFramebufferSupported_ = [[CCConfiguration sharedConfiguration] supportsDiscardFramebuffer];
CHECK_GL_ERROR_DEBUG(); CHECK_GL_ERROR();
return YES; return YES;
} }

View File

@ -1 +1 @@
f46f3ef49ab63a9336441503e20945a3e8a6d6f6 8b5c548106a7fde2f85a35a0b0ac330b836d21ad