Study on 1.02 main.cpp

Source: Internet
Author: User

Study on 1.02 main.cpp
  
 
  1. // create the application instance
  2. AppDelegate app;
  3. CCEGLView* eglView = CCEGLView::sharedOpenGLView();
  4. eglView->setViewName("Fei");
  5. eglView->setFrameSize(480, 320);
  6. return CCApplication::sharedApplication()->run();

First, static class member functions    Cceglview::sharedopenglview
    Ccapplication::sharedapplication
This is a class member static function that starts with share

Twosingle-case modeSingleton mode: Once I come in, this pointer (each with a static pointer), if the static pointer is empty, I create directly, not empty I will return directly. Guarantee only one single case

Three, polymorphic subclasses overwrite the virtual function of the parent class
To have a pointer to a child class object
The child pointer is assigned to the parent class, and the parent pointer calls the virtual interface

Four, this water is very deep
Five, AppDelegate.h three big interface virtual bool applicationdidfinishlaunching (); Game Start Interface
virtual void Applicationdidenterbackground (); Home Key Interface
virtual void Applicationwillenterforeground (); //come tothe interface that interrupts the phone when the phone is answered
vi. relations of Appdelegate, Ccapplication and CcapplicationprotocolAppdelegate and Ccapplicationprotocol will never change.
and ccapplication but put the cross-platform things, change is always ccapplication

Design ideas: The top and the bottom are always unchanged, and the middle can always adapt to different things, which may also be the original intention of the proxy model




From for notes (Wiz)

Study on 1.02 main.cpp

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.