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
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
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
120
Other Decks in Technology
See All in Technology
新規事業を牽引する技術選定 〜フルスタックTypeScript開発の実践事例〜
nullnull
3
380
"何を作るか"を任される エンジニアは、どう育つのか
yutaokafuji
1
390
スキルと MCP ツール、責務をどう分けるか? AI が迷わないインターフェース設計の戦略
cdataj
1
770
Ruby::Boxでできること、Refinementsでできること
joker1007
3
410
LLMと共に進化するプロセスを目指して
ymatsuwitter
12
3.8k
なぜ Platform Engineering の土台に Kubernetes を選ぶのか
r4ynode
1
440
実装は速くなった、レビューはどうする? ― 自身のレビューをAIで再現させるサーヴァントエンジニアリングのすゝめ / Implementation got faster. So what about reviews? — An invitation to Servant Engineering: Recreating your own code reviews with AI
nrslib
8
4.4k
価格.comをAI駆動で全面刷新する ー 30年分の技術的負債を返し、次の30年の土台をつくる ー / AI Engineering Summit Tokyo 2026
tkyowa
53
58k
noUncheckedIndexedAccess、3時間、1万円。 / noUncheckedIndexedAccess, 3 Hours, 10,000 JPY.
kaonavi
1
340
Amazon Bedrock AgentCore ワークショップ JAWS UG TOHOKU / amazon-bedrock-agentcore-workshop-jawsug-tohoku-2026
gawa
9
540
日本 Fintech 未来予測レポート 2027〜2028年(オリジナル版)
8maki
0
110
トークン数だけでは測れない — Claude Code 組織展開の効果検証から学んだこと
makikub
0
140
Featured
See All Featured
The Pragmatic Product Professional
lauravandoore
37
7.3k
brightonSEO & MeasureFest 2025 - Christian Goodrich - Winning strategies for Black Friday CRO & PPC
cargoodrich
3
720
Designing Dashboards & Data Visualisations in Web Apps
destraynor
231
55k
Ecommerce SEO: The Keys for Success Now & Beyond - #SERPConf2024
aleyda
1
2k
XXLCSS - How to scale CSS and keep your sanity
sugarenia
250
1.3M
The #1 spot is gone: here's how to win anyway
tamaranovitovic
2
1.1k
Fantastic passwords and where to find them - at NoRuKo
philnash
52
3.7k
The Illustrated Children's Guide to Kubernetes
chrisshort
51
52k
VelocityConf: Rendering Performance Case Studies
addyosmani
333
25k
"I'm Feeling Lucky" - Building Great Search Experiences for Today's Users (#IAC19)
danielanewman
231
23k
A Modern Web Designer's Workflow
chriscoyier
698
190k
The Director’s Chair: Orchestrating AI for Truly Effective Learning
tmiket
1
190
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