I had the opportunity to use Objective-C's UIView in Cocos 2d-x 3.2, but all UIViews are located before Sprite.
All views referred to by Objective-C, as well as UIView, are hierarchically located in front of the Cocos2d-x view.
When calling the addChild method, increasing the ZOrder value resulted in the same result.
Is it possible to place Sprite above UIView in the hierarchy?
Please let me know if you know more.
// Place UIView UIView* view = [[UIView alloc] initWithFrame: CGRectMake(0,0,200,200)]; [ view setBackgroundColor: [UIColor blueColor]; UIView*rootView=(UIView*) cocos2d::Director::getInstance()->getOpenGLView()->getEAGLView(); rootView addSubview:view; // Place Sprite Sprite*sprite=Sprite::create("sprite.png"); sprite->setPosition (Point (430,320)); this ->addChild(sprite,100,100);
The cocos2d-x sprite is not added as View, but uses OpenGL.
Directly drawn in a specific View (rootView in your code).
Therefore, I think it is not possible to display it above the UIView attached to the rootView.
If you want to make sure you prioritize it, add the normal view to underView as shown in the picture below.
+-[rootView]---------+ | | | +- [underView] -----+ | | | | | + - [EAGLView] ----- + +--| | | | | | +--| | | | +----------------+
CGRect frame= (full screen?); // Root view UIView*rootView=[[UIView alloc] initWithFrame:frame]; rootView.backgroundColor=UIColor.clearColor; // Low prio view UIView* underView = [[UIView alloc] initWithFrame: frame ]; rootView.backgroundColor=UIColor.clearColor; // EAGLView UIView* EAGLView= (omitted); // Add subview rootView addSubview:underView; rootView addSubview:EAGLView; // The blue one UIView* view = [[UIView alloc] initWithFrame: CGRectMake(0,0,200,200)]; [ view setBackgroundColor: [UIColor blueColor]; underView addSubview:view;
The background color of rootView and underView should be black instead of transparent. (Speedwise)
Normally, you don't generate rootViews, but you use ViewController views.
I don't know how it's configured this time, so I can't say anything.
341 Understanding the Meaning of mpm prefork Settings
356 Unity Virtual Stick Does Not Return to Center When You Release Your Finger
354 I have saved several codes written in python to a visual studio file.
340 Scrap text information after the "View More" button when searching in the Yahoo! News search window
© 2023 OneMinuteCode. All rights reserved.