Cocos2dx [3.x] (4) -- Analysis of ccdeprecated. h

Source: Internet
Author: User

[Nagging]

Ccdeprecated. hAre all 2.x naming conventions to be discarded, including class names and enumeration types.

Although these naming conventions of 2.x are reserved by ccdeprecated. H. However, to thoroughly learn the new features of 3.x, we must try not to use the 2.x naming convention.

Some changes are:Cocos2dx [3.x] (3) -- great changes 3.x.



[Ccdeprecated. H]


1. Major changes include the following:

(1) Remove the C ++ class"Cc" Prefix

(2) Remove global functions and constants"Cc"The prefix is changed to the static member functions and constants in the corresponding class.

(3) Remove coordinate functions"CCP"The prefix is changed to the static member functions and constants in vec2.

(4) Remove the drawing primitive"Ccdraw"Prefix, useDrawprimitivesNamespace.

(5) Remove the OpenGL primitive"Ccgl"Prefix, useGLNamespace.

(6) Take"K"The constant and enumeration quantity starting with "strong enumeration" are now replaced by "strong enumeration.

(7) Other changes

For detailed descriptions of these changes, see:Cocos2dx [3.x] (3) -- great changes 3.x


2. Some special changes


2.1 substitution of class names

>ClonableSubstitutionCccopying

Cccopying has been permanently abandoned and has not been retained.

>RefSubstitutionObject

Although ccobject is retained (typedef ref object), do not use it any more. Use Ref!

The object name will be abandoned soon.

>Vec2SubstitutionPoint

Vec2 represents the 2D coordinate system,Vec3It represents the 3D coordinate system.

The point name is about to be abandoned.

>GlprogramcacheSubstitutionShadercache

The coloring er Class isGlprogram

The name of shadercache is about to be abandoned.

>GlviewSubstitutionCceglview


2.2 Integration

> PairNodeIntegrated

TypedefNodeCcnode;

TypedefNodeCcnodergba;

TypedefNodeCcrgbaprotocol;

It can be seen that ccnodergba and ccrgbaprotocol have been integrated into the node class in 3.x.

That is, color and transparency control is added to the node class: setcolor (color3b &) and setopacity ().

> PairLayerIntegrated

TypedefLayerCclayer;

TypedefLayerCclayerrgba;

It can be seen that the cclayerrgba class has been integrated into the layer class in 3.x.

That is, color and transparency control is added to the layer class: setcolor (color3b &) and setopacity ().


2.3 Replace "K" with a strong Enumeration type"

See the ccdeprecated. h file for more information about the changes to the enumerated types.

Of course"K"The name of the enumerated variable at the beginning will also be abandoned.

// Ccdirectorprojection

Typedef Director: Projection ccdirectorprojection;

Kccdirectorprojection2d = Director: Projection: _ 2D;

Kccdirectorprojection3d = Director: Projection: _ 3D;

Kccdirectorprojectioncustom = Director: Projection: custom;

Kccdirectorprojectiondefault = Director: Projection: default;


// Ccverticaltextalignment

Typedef textvalignment ccverticaltextalignment;

Kccverticaltextalignmenttop = textvalignment: top;

Kccverticaltextalignmentcenter = textvalignment: center;

Kccverticaltextalignmentbottom = textvalignment: bottom;


// Cctextalignment

Typedef texthalignment cctextalignment;

Kcctextalignmentleft = texthalignment: left;

Kcctextalignmentcenter = texthalignment: center;

Kcctextalignmentright = texthalignment: right;


// Progresstimertype

Typedef progresstimer: Type progresstimertype;

Kccprogresstimertyperadial = progresstimer: Type: radial;

Kccprogresstimertypebar = progresstbar: Type: bar;


// Particle System

Particle System: Mode

Kccparticlemodegravity = participant system: Mode: gravity;

Kccparticlemoderadius = participant system: Mode: radius;


Particle System: positiontype

Kccpositiontypefree = participant system: positiontype: free;

Kccpositiontyperelative = participant system: positiontype: relative;

Kccpositiontypegrouped = participant system: positiontype: Grouped;


// Transitionscene

Transitionscene: Orientation

Kcctransitionorientationleftover = transitionscene: orientation: left_over;

Kcctransitionorientationrightover = transitionscene: orientation: right_over;

Kcctransitionorientationupover = transitionscene: orientation: up_over;

Kcctransitionorientationdownover = transitionscene: orientation: down_over;


// Resolutionpolicy

Resolutionpolicy

Kresolutionexactfit = resolutionpolicy: exact_fit;

Kresolutionnoborder = resolutionpolicy: no_border;

Kresolutionshowall = resolutionpolicy: show_all;

Kresolutionfixedheight = resolutionpolicy: fixed_height;

Kresolutionfixedwidth = resolutionpolicy: fixed_width;

Kresolutionunknown = resolutionpolicy: unknown;


2.4. Other abandoned classes

To prevent duplicate names"__"Prefix.

Typedef _ icationicationcenter ccnotificationcenter;

Typedef _ icationicationcenter;

Typedef _ cccallfuncnd;

Typedef _ cccallfunco;



Typedef _ rgbaprotocol;

Typedef _ nodergba;

Typedef _ layerrgba;



// Will be replaced by map and vector

Typedef _ set ccset;

Typedef _ set;

Typedef _ setiterator ccsetiterator;

Typedef _ setiterator;

Typedef _ array ccarray;

Typedef _ array;

Typedef _ dictionary;

Typedef _ dictionary ccdictionary;



// Replace the value

Typedef _ double;

Typedef _ double ccdouble;

Typedef _ float;

Typedef _ float ccfloat;

Typedef _ integer;

Typedef _ integer ccinteger;

Typedef _ bool;

Typedef _ bool ccbool;

Typedef _ string ccstring;

Typedef _ string;



This article is from the "summer wind" blog, please be sure to keep this source http://shahdza.blog.51cto.com/2410787/1550017

Cocos2dx [3.x] (4) -- Analysis of ccdeprecated. h

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.