Closed NgVThangBz closed 1 year ago
Would you care to state how you resolved this issue? Was it an issue in your own code, or a bug in Axmol?
you can see it here: https://github.com/axmolengine/axmol/discussions/1356#discussioncomment-7118266 just need : [__glView setMultipleTouchEnabled:YES]; you can enable it default
you can enable it default
It's actually already in the code, and enabled by default in the view creation, but I just found out that it's being explicitly disabled in the project code:
You can see here that it is enabled:
bool GLViewImpl::initWithRect(std::string_view viewName, const Rect& rect, float frameZoomFactor)
{
CGRect r = CGRectMake(rect.origin.x, rect.origin.y, rect.size.width, rect.size.height);
convertAttrs();
CCEAGLView* eaglView = [CCEAGLView viewWithFrame:r
pixelFormat:(NSString*)_pixelFormat
depthFormat:_depthFormat
preserveBackbuffer:NO
sharegroup:nil
multiSampling:NO
numberOfSamples:0];
// Not available on tvOS
#if !defined(AX_TARGET_OS_TVOS)
[eaglView setMultipleTouchEnabled:YES];
#endif
_screenSize.width = _designResolutionSize.width = [eaglView getWidth];
_screenSize.height = _designResolutionSize.height = [eaglView getHeight];
// _scaleX = _scaleY = [eaglView contentScaleFactor];
_eaglView = eaglView;
return true;
}
But then it is disabled in several places:
Such as the RootViewController.mm of the cpp and lua project templates:
// Implement loadView to create a view hierarchy programmatically, without using a nib.
- (void)loadView
{
// Initialize the CCEAGLView
CCEAGLView* eaglView = [CCEAGLView viewWithFrame:[UIScreen mainScreen].bounds
pixelFormat:(__bridge NSString*)ax::GLViewImpl::_pixelFormat
depthFormat:ax::GLViewImpl::_depthFormat
preserveBackbuffer:NO
sharegroup:nil
multiSampling:ax::GLViewImpl::_multisamplingCount > 0 ? YES : NO
numberOfSamples:ax::GLViewImpl::_multisamplingCount];
// Enable or disable multiple touches
#if !defined(AX_TARGET_OS_TVOS)
[eaglView setMultipleTouchEnabled:NO];
#endif
// Set EAGLView as view of RootViewController
self.view = eaglView;
}
That's been the case since Cocos2d-x, and I'm not sure why it was set to NO by default in the template code.
I'm not sure about this, but if possible you should fix it a bit
@halx99 Should the iOS project template code be change to enable multi-touch by default?
@halx99 Should the iOS project template code be change to enable multi-touch by default?
shoud be, do it
always
= 1;touches size
is 1, but(UIEvent*)event.allTouches
have size 2 please check it