This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class HelloWorld : public cocos2d::CCLayer | |
{ | |
private: | |
CCSprite *charlie; | |
float totalTime; | |
public: | |
// Here's a difference. Method 'init' in cocos2d-x returns bool, instead of returning 'id' in cocos2d-iphone | |
virtual bool init(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// on "init" you need to initialize your instance | |
bool HelloWorld::init() | |
{ | |
////////////////////////////// | |
// 1. super init first | |
if ( !CCLayer::init() ) | |
{ | |
return false; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CCSpriteFrameCache *frameCache = CCSpriteFrameCache::sharedSpriteFrameCache(); | |
frameCache->addSpriteFramesWithFile("Charlie_plist.plist"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<Page | |
x:Class="HeaderMenu.MainPage" | |
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | |
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | |
xmlns:local="using:HeaderMenu" | |
xmlns:common="using:HeaderMenu.Common" | |
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" | |
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | |
mc:Ignorable="d"> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public sealed partial class MainPage : Page | |
{ | |
public Popup headerMenuPopup; | |
// 自訂的控制項 | |
public HeaderMenuControl headerMenuCtl; | |
// 是否已加入到 Popup 物件中 | |
public bool isAddedToPopup; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private void pageTitle_Click_1(object sender, RoutedEventArgs e) | |
{ | |
// 若是第一次按,則將物件新增到 Popup 物件裡。 | |
if (!this.isAddedToPopup) | |
{ | |
this.headerMenuPopup = ShowPopup(this.pageTitle, this.headerMenuCtl); | |
this.headerMenuCtl.Tapped += headerMenuCtl_Tapped; | |
this.isAddedToPopup = true; | |
} | |
// 顯示 Popup |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace ListConsoleApp | |
{ | |
public class Student | |
{ | |
public string Name; | |
public int Score; | |
public Student(string name, int score) | |
{ | |
this.Name = name; | |
this.Score = score; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
students.Sort((x, y) => { return -x.Score.CompareTo(y.Score); }); |
OlderNewer