Skip to content

Instantly share code, notes, and snippets.

@kw0006667
kw0006667 / MainPage.xaml.cs
Created October 20, 2012 18:03
在主頁面的程式碼中,加入控制項的呼叫
public sealed partial class MainPage : Page
{
public Popup headerMenuPopup;
// 自訂的控制項
public HeaderMenuControl headerMenuCtl;
// 是否已加入到 Popup 物件中
public bool isAddedToPopup;
@kw0006667
kw0006667 / MainPage.xaml
Created October 20, 2012 18:00
在主頁面新增一個 Page Title
<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">
@kw0006667
kw0006667 / HeaderMenuControl.xaml
Created October 20, 2012 17:57
自訂 Header Menu 使用者控制項
<UserControl
x:Class="HeaderMenu.HeaderMenuControl"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:HeaderMenu"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
d:DesignHeight="210"
d:DesignWidth="250">
@kw0006667
kw0006667 / HeaderMenuControl.xaml
Created October 20, 2012 10:34
使用者控制項
<UserControl
x:Class="HeaderMenu.HeaderMenuControl"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:HeaderMenu"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
d:DesignHeight="180"
d:DesignWidth="300">
@kw0006667
kw0006667 / HellowWorldScene.cpp
Created October 11, 2012 12:53
Add sprite by plist
CCSpriteFrameCache *frameCache = CCSpriteFrameCache::sharedSpriteFrameCache();
frameCache->addSpriteFramesWithFile("Charlie_plist.plist");
@kw0006667
kw0006667 / HelloWorldScene.cpp
Created October 11, 2012 12:50
Add sprite to your scene(.cpp)
// on "init" you need to initialize your instance
bool HelloWorld::init()
{
//////////////////////////////
// 1. super init first
if ( !CCLayer::init() )
{
return false;
}
@kw0006667
kw0006667 / HelloWorldScene.h
Created October 11, 2012 04:33
Add sprite to your scene(.h)
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();