stay cocos2d-x All visual objects in are inherited from Node( Like words (label)、 spirit (sprite)、 scene (scene)、 Layout (layer)). This is a pure virtual class . It's mainly responsible for determining where elements are displayed .

By the director (Director) Responsible for the scene (Scene) Handoff , Add different layouts to the scene (Layer), Here's one zOrder Value , There is only one in the same zOrder Medium Layer Ability to interact .

Scene and Layer It plays a basic role in object display , We are usually in Scene and Layer To deal with the layout of visual objects 、 Collision 、 The display of scores and other states .

Scene Is an abstract class , It is only used to place the object in the correct position in the scene according to the pixel coordinates of the object .

Layer Class itself has no special function . But it can be used to receive touch events and speed up input .

stay Node Several more important methods in need to be implemented in subclasses :

virtual bool init() override;

stay cococs2d-x in , Use init Method to initialize , In this way , You need to call the init Method , Then we can initialize the subclass , This method returns false Indicates initialization failed .cocos2d-x No interface drawing .

static Layer *create();

Used to create and initialize Node object . Use... In subclasses CREATE_FUNC This macro implements this method . This implements the subclass constructor and init Method call :

#define CREATE_FUNC(__TYPE__) \

static __TYPE__* create() \

{ \

__TYPE__ *pRet = new __TYPE__(); \

if (pRet && pRet->init()) \

{ \

pRet->autorelease(); \

return pRet; \

} \

else \

{ \

delete pRet; \

pRet = NULL; \

return NULL; \

} \


I learned cocos2d-x ( 3、 ... and ) Node: More about the ancestors of all visual objects

  1. Follow vczh Let's look at the compilation principle of case study —— 3、 ... and :Tinymoe And unambiguous grammar analysis

    The code cited in this article comes from   I read the three previous articles , You should be basically right Tinymoe The code has a preliminary feeling . In the correct analysis "print ...

  2. [ Be honest and practical WCF] Third articles stay IIS Check in service

    Be honest and practical WCF Third articles stay IIS Boarding service in China Through the study of the first two chapters , We learned how to build the simplest WCF Communication model , Including defining and implementing service agreements . Configure the service . Boarding Services . Configure clients and access services by adding service references . I ...

  3. Learn from scratch Xamarin.Forms( 3、 ... and ) Android Make a splash screen

    original text : Learn from scratch Xamarin.Forms( 3、 ... and ) Android Make a splash screen     Xamarin.Forms It's quite slow to start , You have to add a startup interface , Steps are as follows : 1. Name the image of the splash screen :s ...

  4. WPF,Silverlight And XAML Reading notes 39 - Visualization of 3D graphics

    original text :WPF,Silverlight And XAML Reading notes 39 - Visualization of 3D graphics explain : This series is basically <WPF reveal > Reading notes of . In the structure and content of the article <WPF reveal > ...

  5. Follow me SpringCloud | Third articles : Service provision and Feign call

    Follow me SpringCloud | Third articles : Service provision and Feign call Last one , We introduced the construction of the registration center , Including the construction of the registry in the cluster environment , This article introduces how to use the registry , Create a service provider , Use a Jane ...

  6. 30.Node.js Global object

    from : Learning points : - __filename - __dirname - setTimeou ...

  7. 【WPF Study 】 Chapter 45 Visualization objects

    The previous chapters described the best way to handle moderate amounts of graphic content . By using geometry . Pictures and paths , Can reduce the 2D Graphics overhead . Even if you're using complex composite shapes and gradient brushes with layered effects , This method can still work well . However , This design ...

  8. 《JavaScript Authoritative guide 》 Learning notes On the third day Find an object

    The real object in real life is not found , stay JavaScript There's one object on the left and another object on the left , I'm so dizzy that I don't know what to say . People are complicated , It's hard to understand . I'm a liberal arts student , But I'm not good at speaking . Still js Let's find someone inside . So today we start with ...

  9. [Effective Java] The third chapter Methods common to all objects

    Statement : Original works , Please indicate that the article is from SAP Abbess technology blog ( Bo / customer / garden, And indicate the original source of the article in the form of hyperlinks , Otherwise it would be ...

Random recommendation

  1. MFC Use TRACKMOUSEEVENT Trigger mouseHover and mouseLeave

    Add... To the dialog WM_MOUSEHOVER or WM_MOUSELEAVE The message doesn't respond .MFC Require special treatment , One way is to use TRACKMOUSEEVENT void CmfcDlgDlg::OnMouseM ...

  2. POJ 1681---Painter&#39;s Problem( Gauss elimination )

    POJ   1681---Painter's Problem( Gauss elimination ) Description There is a square wall which is made of n*n small s ...

  3. ( turn )C# Data type mapping (SQLite,MySQL,MSSQL,Oracle)

    One .C# vs SQLite: C# SQLite Field name type Library type GetFieldType(#) transformation remarks F_BOOL bool BIT NOT NULL Boolean F_BOOL_N ...

  4. Codevs_1166_[NOIP2007]_ Matrix access game _( Dynamic programming + High precision )

    describe analysis #include <iostream> #include <cstring> #include < ...

  5. 【NOIP 2011】 Sightseeing bus

    Title Description  Description It's a beautiful town Y City , Have n A beautiful scenic spot . Because more and more tourists are attracted to it ,Y The city specially arranged a sightseeing bus , To provide more convenient transportation services for tourists . The sightseeing bus is on the third 0 Minutes appear in 1 Number ...

  6. XPath Conclusion 1

    Here's an introduction XPath Usage of : It generates a string object , As XmlNode Methods SelectSingleNode,SelectNodes Input parameters of  , To query the qualified nodes . Select the current node :  . ...

  7. DB Query Analyzer 5.03 is distributed, EXCEL table name will be enclosed in square bracket

      DB Query Analyzer 5.03 is distributed, table name will be enclosed in square bracket automatically ...

  8. vi Cursor movement

    1. Move up, down, left and right k  : Move up a line j  : Down the line h : Move one line to the left l : Move one line to the right 2. Move to the top of the current screen . in . The tail H : Move to the top of the current screen M    : Move to the middle of the current screen L : Move to the end of the current screen ...

  9. SQL Server get SP parameters and get output fields type information

    Summary This article mainly introduces ,SQL There are two very practical operations : Get the parameter information of the stored procedure SELECT * FROM INFORMATION_SCHEMA.PARAMETERS WHERE SPE ...

  10. I am AI Knowledge system navigation - AI menu

    Relevant Readable Links Name Interesting topic Comment Edwin Chen Nonparametric Bayes   Boss Xu Yida Dirichlet Process Study ...