Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Hello CocosSharp
Search
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
Mike Bluestein
October 11, 2014
Technology
190
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Hello CocosSharp
Mike Bluestein
October 11, 2014
More Decks by Mike Bluestein
See All by Mike Bluestein
Intro_to_Scene_Kit.pdf
mikebluestein
1
130
Other Decks in Technology
See All in Technology
Claude CodeとAmazon Bedrock AgentCoreでつくる、自分だけのAIアシスタント
ymae
0
110
論語・武士道・産業革命から見る かわるもの、かわらないもの
ichimichi
8
1.2k
AI研修(Day2)【MIXI 26新卒技術研修】
mixi_engineers
PRO
1
780
AIコード生成×サプライチェーン攻撃 — PHPが直面する“二重の信頼問題
shinyasaita
0
490
CTOキーノート:AI時代の「つなぐ」を再定義 ― 真のIoTとリアルワールドAI【SORACOM Discovery 2026】
soracom
PRO
0
150
Vポイント分析基盤におけるデータモデリング20年史
taromatsui_cccmkhd
4
770
事業成長とAI活用を止めないデータ基盤アーキテクチャの設計思想
hiracky16
0
730
大 AI 時代におけるC# の事情 ~ぶっちゃけトークを交えながら~
nenonaninu
1
210
探索・可視化・自動化を一本化 Amazon Quickでデータ活用スピードを上げる方法
koheiyoshikawa
0
210
AI研修(Day1)【MIXI 26新卒技術研修】
mixi_engineers
PRO
1
1.3k
コンテナ・K8s研修【MIXI 26新卒技術研修】#2
mixi_engineers
PRO
1
200
StepFunctionsとGraphRAGを活用した暗黙知活用のためのRAG基盤
yakumo
0
180
Featured
See All Featured
Save Time (by Creating Custom Rails Generators)
garrettdimon
PRO
32
4k
Practical Orchestrator
shlominoach
191
11k
The Invisible Side of Design
smashingmag
301
52k
How To Speak Unicorn (iThemes Webinar)
marktimemedia
1
510
Easily Structure & Communicate Ideas using Wireframe
afnizarnur
194
17k
How to Grow Your eCommerce with AI & Automation
katarinadahlin
PRO
1
230
"I'm Feeling Lucky" - Building Great Search Experiences for Today's Users (#IAC19)
danielanewman
230
23k
Public Speaking Without Barfing On Your Shoes - THAT 2023
reverentgeek
1
460
SEO in 2025: How to Prepare for the Future of Search
ipullrank
3
3.7k
ピンチをチャンスに:未来をつくるプロダクトロードマップ #pmconf2020
aki_iinuma
128
56k
Rebuilding a faster, lazier Slack
samanthasiow
85
9.6k
What Being in a Rock Band Can Teach Us About Real World SEO
427marketing
0
1.1k
Transcript
Hello CocosSharp Developer Evangelist @mikebluestein Mike Bluestein
“CocosSharp blends the power of the Cocos2D programming model with
C# and the .NET Framework…the API has been designed to follow C# and .NET idioms.” Miguel de Icaza Xamarin
“It’s so cool” Mike Bluestein Xamarin
Cross Platform
What Makes Up the Game • Application • Scenes •
Layers • Sprites • Actions • Other cool stuff - Particle systems, audio, physics …
CocosSharp API
CCApplication • Creates and initializes the graphics device • Sets
the application delegate • Starts the game
var app = new CCApplication (); app.ApplicationDelegate = new
GoneBananasApplicationDelegate (); app.StartGame (); CCApplication
• Handles application lifecycle • Similar to UIApplicationDelegate in iOS
• Set the application’s content folder • Load the main window’s first scene CCApplicationDelegate
public virtual void ApplicationDidEnterBackground (CCApplication application) public virtual void
ApplicationDidFinishLaunching (CCApplication application, CCWindow mainWindow) public virtual void ApplicationWillEnterForeground (CCApplication application) CCApplicationDelegate
Content Folder Project Folder Containing Resources ▪ Fonts ▪ Sounds
▪ Images Set via application’s ContentRootDirector application.ContentRootDirectory = "Content";
CCDirector Window.DefaultDirector.ReplaceScene (GameLayer.GameScene (Window)); • Available via Window.DefaultDirector • Manages
any additional scene loading
CCDirector
CCDirector
CCScene • Manages game logic for various portions of the
game • Contains layers (CCLayer)
CCScene • Manages game logic for various portions of the
game • Contains layers (CCLayer)
CCLayer • Added to scene • Contains node tree (sprites,
labels, menus, etc) • Schedule method to run code at repeated interval • Creates the scene for which it is a child
CCLayer var scene = new CCScene (mainWindow); var layer =
new GameStartLayer (); scene.AddChild (layer); return scene;
• Sprites are nodes that create images in the game
• Image file must be in Content folder • Include high definition image using -hd convention CCSprite
• Efficient sprite loading • Renders all children CCSpriteBatch
CCAction • Actions perform tasks on nodes • For example,
animating sprites • Can run multiple actions sequentially using CCSequence
CCTouch • Encapsulates a touch on the screen • Set
TouchEnabled to true in layer • Override touch methods in layer ▪ TouchesBegan, TouchesMoved, TouchesEnded, etc
Accelerometer • Available via CCAccelerometer • Access with Window.Accelerometer
Window.Accelerometer.Enabled = true; var listener = new CCEventListenerAccelerometer(); listener.OnAccelerate =
DidAccelerate; AddEventListener (listener); public void DidAccelerate(CCEventAccelerate accelEvent) { accelEvent.Acceleration.X; accelEvent.Acceleration.Y; accelEvent.Acceleration.Z; } Accelerometer
Audio • SimpleAudioEngine.SharedEngine ▪ Sound Effects ▪ Background Sound •
Pause/Resume background sound in CCApplicationDelegate ▪ Pause when app enters background ▪ Resume when app enters foreground
Drawing Primitives • CCDrawNode • Draw lines, polygons, circles, etc
…
var draw = new CCDrawNode(); draw.DrawPolygon( star, star.Length,
new CCColor4F(1, 0, 0, 0.5f), 1, new CCColor4F(0, 0, 1, 1)); Drawing Primitives
Particle Systems • Graphical effects by rendering a set of
particles • Several built in - smoke, galaxy, rain, … • Can add custom particle systems
var sun = new CCParticleSun (pt); sun.StartColor = new CCColor4F
(CCColor3B.Red); sun.EndColor = new CCColor4F (CCColor3B.Yellow); Particle Systems
var sun = new CCParticleSun (pt); sun.StartColor = new CCColor4F
(CCColor3B.Red); sun.EndColor = new CCColor4F (CCColor3B.Yellow); Particle Systems
Parallax • CCParallaxNode • Children move at different relative speeds
Parallax • CCParallaxNode • Children move at different relative speeds
var parallaxClouds = new CCParallaxNode { Position = new CCPoint
(0, h) }; float yRatio1 = 1.0f; float yRatio2 = 0.5f; parallaxClouds.AddChild (cloud1, 0, new CCPoint (1.0f, yRatio1), new CCPoint (100, -100 + h - (h * yRatio1))); parallaxClouds.AddChild (cloud2, 0, new CCPoint (1.0f, yRatio2), new CCPoint (250, -200 + h - (h * yRatio2))); Parallax
Effects • Lots of visual effects • Waves, Twirl, Lens3D,
Shuffle Tiles, … • Implemented using actions
var flipx = new CCFlipX3D(t); CCFiniteTimeAction flipx_back = flipx.Reverse(); var
delay = new CCDelayTime (2); return new CCSequence(flipx, delay, flipx_back); Effects
Physics • 2D Rigid Body Physics • C# port of
Box2D • world, body, shape, fixture
var def = new b2BodyDef (); … b2Body body =
world.CreateBody (def); var circle = new b2CircleShape (); … var fd = new b2FixtureDef (); fd.shape = circle; … body.CreateFixture (fd); Physics
Demo
Gone Bananas Demonstrates Many CocosSharp Features ▪ Parallax ▪ Particles
▪ Touch handling ▪ Physics ▪ Sprite creation ▪ Actions ▪ Scene transitions ▪ Sprite sheet animation ▪ Sprite batching
CocosSharp Resources • Source - github.com/mono/CocosSharp • Samples - github.com/mono/cocos-sharp-samples
Thank You! Mike Bluestein @mikebluestein