Cocos2d X 學習筆記3 常用巨集

2021-06-26 06:36:53 字數 2523 閱讀 7486

// 控制台輸出

#define cclog(...)

// 控制台警告輸出

#define cclogwarn(...)

// 控制台資訊輸出

#define ccloginfo(...)

// 交換 x,y的值

#define cc_swap(x, y)

// 生成乙個 -1 到 1的隨機數

#define ccrandom_minus1_1()

// 生成乙個 0 到 1的隨機數

#define ccrandom_0_1()

// 角度轉弧度

#define cc_degrees_to_radians(__angle__)

// 弧度轉角度

#define cc_radians_to_degrees(__angle__)

// gl 混合源和目標函式

#define cc_blend_src

#define cc_blend_dst

// ccdirector初始化

#define cc_director_init()

// 設定gl服務狀態, 校正 gl 程式, 設定 模型/檢視/透視矩陣

#define cc_node_draw_setup()

// 停止 director 並從記憶體中移除, 從父級移除 ccglview

#define cc_director_end()

/*********************/

/** retina display  **/

/*********************/

// 縮放因數

#define cc_content_scale_factor()

// 畫素矩形轉點矩形

#define cc_rect_pixels_to_points(__rect_in_pixels__)

// 點矩形轉畫素矩形

#define cc_rect_points_to_pixels(__rect_in_points_points__)

// 畫素座標轉點座標

#define cc_point_pixels_to_points(__pixels__)

// 點座標轉畫素座標

#define cc_point_points_to_pixels(__points__)

// 畫素範圍轉點範圍

#define cc_size_pixels_to_points(__size_in_pixels__)

// 點範圍轉畫素範圍

#define cc_size_points_to_pixels(__size_in_points__)

/**********************/

/** profiling macros **/

/**********************/

// ...

/*****************/

/** arc macros  **/

/*****************/

// ...

// 設定gl渲染增量數字

#define cc_increment_gl_draws(__n__)

/*******************/

/** notifications **/

/*******************/

// ccspriteframe顯示時傳送的訊息

#define ccanimationframedisplayednotification

Cocos2d x學習筆記1

1.建立新的cocos2d x 3.0 專案 在命令列中輸入 cocos new helloworld 專案名稱 p com.ss.pku 包名字 l cpp 專案型別 d d cocos workspace 專案存放路徑 2.資料夾分析 resource 資料夾 存放資源檔案 include和so...

Cocos2d x學習筆記(7)

1 動作基本概念 ccactiong是動作類的基類,動作作用於ccnode,因此,任何乙個動作都需要ccnode物件來執行。ccaction作為乙個基類,其實質是乙個介面 抽象類 由它派生的實現類才是實際使用的動作。ccaction的絕大多數實現類都派生自ccfinitetimeaction,這個類...

Cocos2d x動作學習筆記

action類如其名,它可以改變node物件的屬性,action物件是隨著時間改變node的屬性。任何乙個以node為基類的物件都有可執行的動作物件。例如,你可以在乙個時間段內將sprite精靈從乙個位置移動到另乙個位置。每個動作都有by和to兩個狀態。為什麼呢?因為它們所執行的結果是不同的。by相...