Download presentation
1
events reactive programming
Disclaimer: This document is provided “as-is”. Information and views expressed in this document, including URL and other Internet Web site references, may change without notice. You bear the risk of using it. This document does not provide you with any legal rights to any intellectual property in any Microsoft product. You may copy and use this document for your internal, reference purposes. © 2012 Microsoft Corporation. All rights reserved. Microsoft, Windows, and Windows Live are trademarks of the Microsoft group of companies. All other trademarks are property of their respective owners.
2
events around you tap on the shoulder traffic light goes red
turn head, say “hello”, shake hand traffic light goes red hit the brakes hear cool song dance, sing ►find 3 more events and reactions around you
3
events in phone special action triggered by sensors or media player state shaking, orientation change active song changed, player paused, resumed reacts by running the event code, i.e. executes the actions associated to the event
4
execution model events run to completion before another event starts running events (and actions) never interleave scripts with events automatically enter an event loop (“gameloop”) when an action started by the user ends to stop the event loop, use time→stop user can stop script as well ✿
5
gameloop event that triggers every 50ms update the state of a game
board : Board // a global board variable event gameloop … board →evolve board →update on wall
6
orientation respond to orientation changes
phone face up/down, landscape left/right event phone face up player→resume event phone face down player→pause
7
shake uses accelerometer to detect shake event shake
media→songs→random→play
8
player events active song changed notifies that a new song is playing
player state changed notifies that the player has started to play, or paused, or resumed, etc… event active song changed player→active song→post to wall
9
camera buttons pressed, half-pressed, released events triggered by phone camera button
10
tap on … tap event on wall elements one event per element kind
11
empty space on wall event that triggers when new space appears on the wall typically happens when the user reaches the end of the wall content and allows to fill the wall with more data
12
title item 1 Item 2 ☀ anecdote song→post to wall
☁ (link to sample) ► an exercise ✿ a reference
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.