├── de ├── .gitkeep └── plugins │ └── .gitkeep ├── ja ├── .gitkeep └── plugins │ └── .gitkeep ├── plugins └── .gitkeep ├── tests ├── qunit │ ├── avoidTimeout.js │ ├── enchant.js │ │ ├── start.png │ │ ├── tl.html │ │ ├── enchant.html │ │ ├── group.js │ │ └── label-textalign.js │ ├── ui.enchant.js │ │ ├── pad.png │ │ ├── apad.png │ │ ├── font0.png │ │ ├── icon0.png │ │ ├── effect0.gif │ │ ├── mutable_text.html │ │ └── mutable_text.js │ └── mixing.enchant.js │ │ └── mixing.html ├── mocha │ ├── .gitignore │ ├── enchant.js │ │ ├── icon0.png │ │ ├── start.png │ │ ├── test_enchant.js │ │ ├── test_binary-input-source.js │ │ ├── test_keyboard-input-source.js │ │ ├── test_input-source.js │ │ ├── test_dom-scene.js │ │ ├── test_canvas-scene.js │ │ ├── test_action-event-target.js │ │ ├── test_matrix.js │ │ ├── test_loading-scene.js │ │ └── test_tween.js │ ├── ui.enchant.js │ │ ├── font0.png │ │ └── test_mutable_text.html │ ├── font │ │ ├── LiberationMono-Regular.ttf │ │ └── font.css │ └── mixing.enchant.js │ │ └── test_mixing.html ├── raster │ ├── diff.png │ ├── hellobear.png │ ├── hellobear_.png │ ├── hellobear │ │ ├── chara1.png │ │ ├── index.html │ │ ├── ui.enchant.js │ │ └── main.js │ ├── README │ └── rasterize.js ├── feature │ ├── event_bubbling │ │ ├── chara1.png │ │ ├── index.html │ │ └── ui.enchant.js │ └── group_rotation │ │ ├── chara1.png │ │ ├── index.html │ │ ├── main.js │ │ └── ui.enchant.js └── gl-qunit │ ├── primitive.gl.enchant.js │ ├── primitive.gl.js │ └── primitive.gl.html │ └── gl.enchant.js │ ├── gl.html │ └── gl.js ├── dev ├── src │ ├── _outro.js │ ├── _intro.js │ ├── Sound.js │ ├── Game.js │ ├── BinaryInputSource.js │ ├── ActionEventTarget.js │ ├── DOMScene.js │ ├── CanvasScene.js │ ├── KeyboardInputSource.js │ ├── InputSource.js │ ├── DetectColorManager.js │ ├── Matrix.js │ └── LoadingScene.js └── plugins │ ├── tl.enchant.js │ └── util.enchant.js ├── sound.swf ├── enchant.png ├── images ├── apad.png ├── bar.png ├── end.png ├── map0.png ├── map1.png ├── map2.png ├── pad.png ├── chara0.png ├── chara1.png ├── chara2.png ├── chara3.png ├── chara4.png ├── chara5.png ├── chara6.png ├── chara7.png ├── clear.png ├── effect0.png ├── enchant.png ├── font0.png ├── font1.png ├── font2.png ├── icon0.png ├── icon1.png ├── space0.png ├── space1.png ├── space2.png ├── space3.png ├── start.png ├── avatarBg1.png ├── avatarBg2.png ├── avatarBg3.png ├── gameover.png ├── indicator.png ├── enchant-sphere.png └── monster │ ├── monster1.gif │ ├── monster2.gif │ ├── monster3.gif │ ├── monster4.gif │ ├── monster5.gif │ ├── monster6.gif │ ├── monster7.gif │ ├── bigmonster1.gif │ └── bigmonster2.gif ├── examples ├── expert │ ├── rpg │ │ ├── apad.png │ │ ├── map1.gif │ │ ├── pad.png │ │ ├── chara0.gif │ │ ├── font0.png │ │ ├── icon0.png │ │ └── index.html │ ├── action │ │ ├── end.png │ │ ├── pad.png │ │ ├── apad.png │ │ ├── chara1.gif │ │ ├── font0.png │ │ ├── icon0.png │ │ ├── jump.wav │ │ ├── map2.gif │ │ ├── start.png │ │ ├── gameover.wav │ │ └── index.html │ ├── getbanana │ │ ├── bg.png │ │ ├── end.png │ │ ├── icon0.gif │ │ ├── start.png │ │ ├── chara1.gif │ │ ├── index.html │ │ └── nineleap.enchant.js │ ├── shooting │ │ ├── apad.png │ │ ├── end.png │ │ ├── pad.png │ │ ├── font0.png │ │ ├── icon0.png │ │ ├── start.png │ │ ├── effect0.gif │ │ ├── graphic.png │ │ ├── shooting.ja.js │ │ └── index.html │ ├── collection │ │ ├── chara1.png │ │ ├── icon0.png │ │ └── index.html │ └── timeline │ │ ├── index.html │ │ └── main.js ├── plugins │ ├── ui │ │ ├── apad.png │ │ ├── bar.png │ │ ├── pad.png │ │ ├── font0.png │ │ ├── icon0.png │ │ └── index.html │ ├── box2d │ │ ├── end.png │ │ ├── chara1.gif │ │ ├── font.png │ │ ├── icon0.gif │ │ ├── icon1.png │ │ ├── map2.gif │ │ ├── start.png │ │ ├── effect0.gif │ │ ├── graphic.png │ │ ├── index.html │ │ └── main.js │ ├── wiiu │ │ ├── chara1.png │ │ ├── vspong │ │ │ ├── pong.png │ │ │ ├── pong.psd │ │ │ └── index.html │ │ ├── index.html │ │ └── main.js │ ├── canvas │ │ ├── chara1.gif │ │ ├── index.html │ │ └── main.js │ ├── avatar │ │ ├── avatarBg1.png │ │ ├── avatarBg2.png │ │ ├── avatarBg3.png │ │ ├── monster │ │ │ ├── monster1.gif │ │ │ ├── monster2.gif │ │ │ ├── monster3.gif │ │ │ ├── monster4.gif │ │ │ ├── monster5.gif │ │ │ ├── monster6.gif │ │ │ ├── monster7.gif │ │ │ ├── bigmonster1.gif │ │ │ └── bigmonster2.gif │ │ ├── index.html │ │ └── main.js │ ├── mixing │ │ ├── mapgroup │ │ │ ├── pad.png │ │ │ ├── apad.png │ │ │ ├── chara0.gif │ │ │ ├── font0.png │ │ │ ├── icon0.png │ │ │ ├── map1.gif │ │ │ └── index.html │ │ └── spritelabel │ │ │ ├── chara1.png │ │ │ ├── index.html │ │ │ └── main.js │ ├── widget │ │ ├── ListView │ │ │ ├── button.png │ │ │ ├── dialog.png │ │ │ ├── iconMenuBg.png │ │ │ ├── listItemBg.png │ │ │ ├── buttonPushed.png │ │ │ ├── navigationBar.png │ │ │ ├── index.html │ │ │ └── main.js │ │ ├── Check_Text │ │ │ ├── button.png │ │ │ ├── dialog.png │ │ │ ├── iconMenuBg.png │ │ │ ├── listItemBg.png │ │ │ ├── buttonPushed.png │ │ │ ├── navigationBar.png │ │ │ ├── index.html │ │ │ └── main.js │ │ ├── Alert_Confirm │ │ │ ├── button.png │ │ │ ├── dialog.png │ │ │ ├── iconMenuBg.png │ │ │ ├── listItemBg.png │ │ │ ├── buttonPushed.png │ │ │ ├── navigationBar.png │ │ │ ├── index.html │ │ │ └── main.js │ │ ├── LazyListView │ │ │ ├── button.png │ │ │ ├── dialog.png │ │ │ ├── buttonPushed.png │ │ │ ├── iconMenuBg.png │ │ │ ├── listItemBg.png │ │ │ ├── navigationBar.png │ │ │ └── index.html │ │ └── NavigationBar │ │ │ ├── button.png │ │ │ ├── dialog.png │ │ │ ├── iconMenuBg.png │ │ │ ├── listItemBg.png │ │ │ ├── buttonPushed.png │ │ │ ├── navigationBar.png │ │ │ ├── index.html │ │ │ └── main.js │ ├── gl │ │ ├── mmd │ │ │ ├── readme │ │ │ ├── index.html │ │ │ └── main.js │ │ ├── bounding │ │ │ ├── index.html │ │ │ └── main.js │ │ └── billiard │ │ │ └── index.html │ └── telepathy │ │ ├── index.html │ │ └── main.js ├── beginner │ ├── map │ │ ├── map0.png │ │ ├── map1.gif │ │ ├── map1.png │ │ ├── map2.png │ │ ├── chara1.png │ │ ├── index.html │ │ └── main.js │ ├── label │ │ ├── chara1.png │ │ ├── enchant.png │ │ ├── main.js │ │ └── index.html │ ├── hellobear │ │ ├── chara1.png │ │ ├── index.html │ │ └── main_nocomment.js │ └── new_class │ │ ├── chara1.png │ │ ├── map0.png │ │ ├── enchant.png │ │ ├── index.html │ │ └── main.js ├── developers │ ├── sprites │ │ ├── chara1.png │ │ ├── icon0.png │ │ ├── main.js │ │ └── index.html │ └── eventViewer │ │ ├── index.html │ │ └── main.js └── windows8 │ ├── enchant.js template.suo │ ├── sample-app │ ├── enchant │ │ ├── 4.png │ │ ├── c.png │ │ ├── e.png │ │ ├── i.png │ │ ├── end.png │ │ ├── start.png │ │ ├── index.html │ │ └── main.js │ ├── images │ │ ├── logo.png │ │ ├── smalllogo.png │ │ ├── storelogo.png │ │ └── splashscreen.png │ ├── App4_TemporaryKey.pfx │ ├── bin │ │ └── Debug │ │ │ ├── resources.pri │ │ │ ├── AppX │ │ │ ├── enchant │ │ │ │ ├── 4.png │ │ │ │ ├── c.png │ │ │ │ ├── e.png │ │ │ │ ├── i.png │ │ │ │ ├── end.png │ │ │ │ ├── start.png │ │ │ │ ├── index.html │ │ │ │ └── main.js │ │ │ ├── resources.pri │ │ │ ├── images │ │ │ │ ├── logo.png │ │ │ │ ├── smalllogo.png │ │ │ │ ├── storelogo.png │ │ │ │ └── splashscreen.png │ │ │ ├── microsoft.system.package.metadata │ │ │ │ └── S-1-5-21-683383825-1444420821-4289300244-1001.pckgdep │ │ │ ├── css │ │ │ │ └── default.css │ │ │ ├── default.html │ │ │ ├── js │ │ │ │ └── default.js │ │ │ └── AppxManifest.xml │ │ │ └── AppxManifest.xml │ ├── enchant.js template.jsproj.user │ ├── css │ │ └── default.css │ ├── default.html │ ├── bld │ │ └── Debug │ │ │ └── priconfig.xml │ ├── package.appxmanifest │ └── js │ │ └── default.js │ ├── enchant.js template.v11.suo │ ├── readme.md │ ├── App4 │ └── enchant │ │ └── main.js │ └── enchant.js template.sln ├── doc ├── template │ ├── css │ │ └── fonts │ │ │ ├── mplus-1m-bold-webfont.eot │ │ │ ├── mplus-1m-bold-webfont.ttf │ │ │ ├── mplus-1m-bold-webfont.woff │ │ │ ├── mplus-1m-regular-webfont.eot │ │ │ ├── mplus-1m-regular-webfont.ttf │ │ │ └── mplus-1m-regular-webfont.woff │ ├── subtemplates │ │ ├── foot.tmpl │ │ ├── head.tmpl │ │ └── menu.tmpl │ ├── allclasses.tmpl │ ├── license.txt │ ├── allfiles.tmpl │ └── javascript │ │ └── html5.js └── readme.md ├── component.json ├── tasks ├── build.coffee ├── copy.coffee ├── lang.coffee ├── doc.coffee └── install-jsdoc-toolkit.coffee ├── .gitignore ├── .travis.yml ├── package.json └── LICENSE.txt /de/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /ja/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /plugins/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /de/plugins/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /ja/plugins/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/qunit/avoidTimeout.js: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /dev/src/_outro.js: -------------------------------------------------------------------------------- 1 | }(window)); 2 | -------------------------------------------------------------------------------- /tests/mocha/.gitignore: -------------------------------------------------------------------------------- 1 | !enchant.js/ 2 | -------------------------------------------------------------------------------- /dev/src/_intro.js: -------------------------------------------------------------------------------- 1 | (function(window, undefined) { 2 | -------------------------------------------------------------------------------- /dev/plugins/tl.enchant.js: -------------------------------------------------------------------------------- 1 | // tl.enchant.js was merged into enchant.js -------------------------------------------------------------------------------- /sound.swf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wise9/enchant.js/HEAD/sound.swf -------------------------------------------------------------------------------- /dev/plugins/util.enchant.js: -------------------------------------------------------------------------------- 1 | // util.enchant.js was merged into ui.enchant.js -------------------------------------------------------------------------------- /enchant.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wise9/enchant.js/HEAD/enchant.png -------------------------------------------------------------------------------- /images/apad.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wise9/enchant.js/HEAD/images/apad.png -------------------------------------------------------------------------------- /images/bar.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wise9/enchant.js/HEAD/images/bar.png -------------------------------------------------------------------------------- /images/end.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wise9/enchant.js/HEAD/images/end.png -------------------------------------------------------------------------------- /images/map0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wise9/enchant.js/HEAD/images/map0.png -------------------------------------------------------------------------------- /images/map1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wise9/enchant.js/HEAD/images/map1.png -------------------------------------------------------------------------------- /images/map2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wise9/enchant.js/HEAD/images/map2.png -------------------------------------------------------------------------------- /images/pad.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wise9/enchant.js/HEAD/images/pad.png -------------------------------------------------------------------------------- /images/chara0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wise9/enchant.js/HEAD/images/chara0.png -------------------------------------------------------------------------------- /images/chara1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wise9/enchant.js/HEAD/images/chara1.png -------------------------------------------------------------------------------- /images/chara2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wise9/enchant.js/HEAD/images/chara2.png -------------------------------------------------------------------------------- /images/chara3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wise9/enchant.js/HEAD/images/chara3.png -------------------------------------------------------------------------------- /images/chara4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wise9/enchant.js/HEAD/images/chara4.png -------------------------------------------------------------------------------- /images/chara5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wise9/enchant.js/HEAD/images/chara5.png -------------------------------------------------------------------------------- /images/chara6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wise9/enchant.js/HEAD/images/chara6.png -------------------------------------------------------------------------------- /images/chara7.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wise9/enchant.js/HEAD/images/chara7.png -------------------------------------------------------------------------------- /images/clear.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wise9/enchant.js/HEAD/images/clear.png -------------------------------------------------------------------------------- /images/effect0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wise9/enchant.js/HEAD/images/effect0.png -------------------------------------------------------------------------------- /images/enchant.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wise9/enchant.js/HEAD/images/enchant.png -------------------------------------------------------------------------------- /images/font0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wise9/enchant.js/HEAD/images/font0.png -------------------------------------------------------------------------------- /images/font1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wise9/enchant.js/HEAD/images/font1.png -------------------------------------------------------------------------------- /images/font2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wise9/enchant.js/HEAD/images/font2.png -------------------------------------------------------------------------------- /images/icon0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wise9/enchant.js/HEAD/images/icon0.png -------------------------------------------------------------------------------- /images/icon1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wise9/enchant.js/HEAD/images/icon1.png -------------------------------------------------------------------------------- /images/space0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wise9/enchant.js/HEAD/images/space0.png -------------------------------------------------------------------------------- /images/space1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wise9/enchant.js/HEAD/images/space1.png -------------------------------------------------------------------------------- /images/space2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wise9/enchant.js/HEAD/images/space2.png -------------------------------------------------------------------------------- /images/space3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wise9/enchant.js/HEAD/images/space3.png -------------------------------------------------------------------------------- /images/start.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wise9/enchant.js/HEAD/images/start.png -------------------------------------------------------------------------------- /images/avatarBg1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wise9/enchant.js/HEAD/images/avatarBg1.png -------------------------------------------------------------------------------- /images/avatarBg2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wise9/enchant.js/HEAD/images/avatarBg2.png -------------------------------------------------------------------------------- /images/avatarBg3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wise9/enchant.js/HEAD/images/avatarBg3.png -------------------------------------------------------------------------------- /images/gameover.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wise9/enchant.js/HEAD/images/gameover.png -------------------------------------------------------------------------------- /images/indicator.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wise9/enchant.js/HEAD/images/indicator.png -------------------------------------------------------------------------------- /tests/raster/diff.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wise9/enchant.js/HEAD/tests/raster/diff.png -------------------------------------------------------------------------------- /images/enchant-sphere.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wise9/enchant.js/HEAD/images/enchant-sphere.png -------------------------------------------------------------------------------- /examples/expert/rpg/apad.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wise9/enchant.js/HEAD/examples/expert/rpg/apad.png -------------------------------------------------------------------------------- /examples/expert/rpg/map1.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wise9/enchant.js/HEAD/examples/expert/rpg/map1.gif -------------------------------------------------------------------------------- /examples/expert/rpg/pad.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wise9/enchant.js/HEAD/examples/expert/rpg/pad.png -------------------------------------------------------------------------------- /examples/plugins/ui/apad.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wise9/enchant.js/HEAD/examples/plugins/ui/apad.png -------------------------------------------------------------------------------- /examples/plugins/ui/bar.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wise9/enchant.js/HEAD/examples/plugins/ui/bar.png -------------------------------------------------------------------------------- /examples/plugins/ui/pad.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wise9/enchant.js/HEAD/examples/plugins/ui/pad.png -------------------------------------------------------------------------------- /images/monster/monster1.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wise9/enchant.js/HEAD/images/monster/monster1.gif -------------------------------------------------------------------------------- /images/monster/monster2.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wise9/enchant.js/HEAD/images/monster/monster2.gif -------------------------------------------------------------------------------- /images/monster/monster3.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wise9/enchant.js/HEAD/images/monster/monster3.gif -------------------------------------------------------------------------------- /images/monster/monster4.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wise9/enchant.js/HEAD/images/monster/monster4.gif -------------------------------------------------------------------------------- /images/monster/monster5.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wise9/enchant.js/HEAD/images/monster/monster5.gif -------------------------------------------------------------------------------- /images/monster/monster6.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wise9/enchant.js/HEAD/images/monster/monster6.gif -------------------------------------------------------------------------------- /images/monster/monster7.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wise9/enchant.js/HEAD/images/monster/monster7.gif -------------------------------------------------------------------------------- /tests/raster/hellobear.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wise9/enchant.js/HEAD/tests/raster/hellobear.png -------------------------------------------------------------------------------- /tests/raster/hellobear_.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wise9/enchant.js/HEAD/tests/raster/hellobear_.png -------------------------------------------------------------------------------- /examples/beginner/map/map0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wise9/enchant.js/HEAD/examples/beginner/map/map0.png -------------------------------------------------------------------------------- /examples/beginner/map/map1.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wise9/enchant.js/HEAD/examples/beginner/map/map1.gif -------------------------------------------------------------------------------- /examples/beginner/map/map1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wise9/enchant.js/HEAD/examples/beginner/map/map1.png -------------------------------------------------------------------------------- /examples/beginner/map/map2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wise9/enchant.js/HEAD/examples/beginner/map/map2.png -------------------------------------------------------------------------------- /examples/expert/action/end.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wise9/enchant.js/HEAD/examples/expert/action/end.png -------------------------------------------------------------------------------- /examples/expert/action/pad.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wise9/enchant.js/HEAD/examples/expert/action/pad.png -------------------------------------------------------------------------------- /examples/expert/rpg/chara0.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wise9/enchant.js/HEAD/examples/expert/rpg/chara0.gif -------------------------------------------------------------------------------- /examples/expert/rpg/font0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wise9/enchant.js/HEAD/examples/expert/rpg/font0.png -------------------------------------------------------------------------------- /examples/expert/rpg/icon0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wise9/enchant.js/HEAD/examples/expert/rpg/icon0.png -------------------------------------------------------------------------------- /examples/plugins/box2d/end.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wise9/enchant.js/HEAD/examples/plugins/box2d/end.png -------------------------------------------------------------------------------- /examples/plugins/ui/font0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wise9/enchant.js/HEAD/examples/plugins/ui/font0.png -------------------------------------------------------------------------------- /examples/plugins/ui/icon0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wise9/enchant.js/HEAD/examples/plugins/ui/icon0.png -------------------------------------------------------------------------------- /images/monster/bigmonster1.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wise9/enchant.js/HEAD/images/monster/bigmonster1.gif -------------------------------------------------------------------------------- /images/monster/bigmonster2.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wise9/enchant.js/HEAD/images/monster/bigmonster2.gif -------------------------------------------------------------------------------- /examples/beginner/map/chara1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wise9/enchant.js/HEAD/examples/beginner/map/chara1.png -------------------------------------------------------------------------------- /examples/expert/action/apad.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wise9/enchant.js/HEAD/examples/expert/action/apad.png -------------------------------------------------------------------------------- /examples/expert/action/chara1.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wise9/enchant.js/HEAD/examples/expert/action/chara1.gif -------------------------------------------------------------------------------- /examples/expert/action/font0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wise9/enchant.js/HEAD/examples/expert/action/font0.png -------------------------------------------------------------------------------- /examples/expert/action/icon0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wise9/enchant.js/HEAD/examples/expert/action/icon0.png -------------------------------------------------------------------------------- /examples/expert/action/jump.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wise9/enchant.js/HEAD/examples/expert/action/jump.wav -------------------------------------------------------------------------------- /examples/expert/action/map2.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wise9/enchant.js/HEAD/examples/expert/action/map2.gif -------------------------------------------------------------------------------- /examples/expert/action/start.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wise9/enchant.js/HEAD/examples/expert/action/start.png -------------------------------------------------------------------------------- /examples/expert/getbanana/bg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wise9/enchant.js/HEAD/examples/expert/getbanana/bg.png -------------------------------------------------------------------------------- /examples/expert/getbanana/end.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wise9/enchant.js/HEAD/examples/expert/getbanana/end.png -------------------------------------------------------------------------------- /examples/expert/shooting/apad.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wise9/enchant.js/HEAD/examples/expert/shooting/apad.png -------------------------------------------------------------------------------- /examples/expert/shooting/end.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wise9/enchant.js/HEAD/examples/expert/shooting/end.png -------------------------------------------------------------------------------- /examples/expert/shooting/pad.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wise9/enchant.js/HEAD/examples/expert/shooting/pad.png -------------------------------------------------------------------------------- /examples/plugins/box2d/chara1.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wise9/enchant.js/HEAD/examples/plugins/box2d/chara1.gif -------------------------------------------------------------------------------- /examples/plugins/box2d/font.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wise9/enchant.js/HEAD/examples/plugins/box2d/font.png -------------------------------------------------------------------------------- /examples/plugins/box2d/icon0.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wise9/enchant.js/HEAD/examples/plugins/box2d/icon0.gif -------------------------------------------------------------------------------- /examples/plugins/box2d/icon1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wise9/enchant.js/HEAD/examples/plugins/box2d/icon1.png -------------------------------------------------------------------------------- /examples/plugins/box2d/map2.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wise9/enchant.js/HEAD/examples/plugins/box2d/map2.gif -------------------------------------------------------------------------------- /examples/plugins/box2d/start.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wise9/enchant.js/HEAD/examples/plugins/box2d/start.png -------------------------------------------------------------------------------- /examples/plugins/wiiu/chara1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wise9/enchant.js/HEAD/examples/plugins/wiiu/chara1.png -------------------------------------------------------------------------------- /tests/mocha/enchant.js/icon0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wise9/enchant.js/HEAD/tests/mocha/enchant.js/icon0.png -------------------------------------------------------------------------------- /tests/mocha/enchant.js/start.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wise9/enchant.js/HEAD/tests/mocha/enchant.js/start.png -------------------------------------------------------------------------------- /tests/qunit/enchant.js/start.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wise9/enchant.js/HEAD/tests/qunit/enchant.js/start.png -------------------------------------------------------------------------------- /tests/qunit/ui.enchant.js/pad.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wise9/enchant.js/HEAD/tests/qunit/ui.enchant.js/pad.png -------------------------------------------------------------------------------- /tests/raster/hellobear/chara1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wise9/enchant.js/HEAD/tests/raster/hellobear/chara1.png -------------------------------------------------------------------------------- /examples/beginner/label/chara1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wise9/enchant.js/HEAD/examples/beginner/label/chara1.png -------------------------------------------------------------------------------- /examples/beginner/label/enchant.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wise9/enchant.js/HEAD/examples/beginner/label/enchant.png -------------------------------------------------------------------------------- /examples/expert/action/gameover.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wise9/enchant.js/HEAD/examples/expert/action/gameover.wav -------------------------------------------------------------------------------- /examples/expert/getbanana/icon0.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wise9/enchant.js/HEAD/examples/expert/getbanana/icon0.gif -------------------------------------------------------------------------------- /examples/expert/getbanana/start.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wise9/enchant.js/HEAD/examples/expert/getbanana/start.png -------------------------------------------------------------------------------- /examples/expert/shooting/font0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wise9/enchant.js/HEAD/examples/expert/shooting/font0.png -------------------------------------------------------------------------------- /examples/expert/shooting/icon0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wise9/enchant.js/HEAD/examples/expert/shooting/icon0.png -------------------------------------------------------------------------------- /examples/expert/shooting/start.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wise9/enchant.js/HEAD/examples/expert/shooting/start.png -------------------------------------------------------------------------------- /examples/plugins/box2d/effect0.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wise9/enchant.js/HEAD/examples/plugins/box2d/effect0.gif -------------------------------------------------------------------------------- /examples/plugins/box2d/graphic.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wise9/enchant.js/HEAD/examples/plugins/box2d/graphic.png -------------------------------------------------------------------------------- /examples/plugins/canvas/chara1.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wise9/enchant.js/HEAD/examples/plugins/canvas/chara1.gif -------------------------------------------------------------------------------- /tests/mocha/ui.enchant.js/font0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wise9/enchant.js/HEAD/tests/mocha/ui.enchant.js/font0.png -------------------------------------------------------------------------------- /tests/qunit/ui.enchant.js/apad.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wise9/enchant.js/HEAD/tests/qunit/ui.enchant.js/apad.png -------------------------------------------------------------------------------- /tests/qunit/ui.enchant.js/font0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wise9/enchant.js/HEAD/tests/qunit/ui.enchant.js/font0.png -------------------------------------------------------------------------------- /tests/qunit/ui.enchant.js/icon0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wise9/enchant.js/HEAD/tests/qunit/ui.enchant.js/icon0.png -------------------------------------------------------------------------------- /dev/src/Sound.js: -------------------------------------------------------------------------------- 1 | enchant.Sound = window.AudioContext && enchant.ENV.USE_WEBAUDIO ? enchant.WebAudioSound : enchant.DOMSound; 2 | -------------------------------------------------------------------------------- /examples/beginner/hellobear/chara1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wise9/enchant.js/HEAD/examples/beginner/hellobear/chara1.png -------------------------------------------------------------------------------- /examples/beginner/new_class/chara1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wise9/enchant.js/HEAD/examples/beginner/new_class/chara1.png -------------------------------------------------------------------------------- /examples/beginner/new_class/map0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wise9/enchant.js/HEAD/examples/beginner/new_class/map0.png -------------------------------------------------------------------------------- /examples/developers/sprites/chara1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wise9/enchant.js/HEAD/examples/developers/sprites/chara1.png -------------------------------------------------------------------------------- /examples/developers/sprites/icon0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wise9/enchant.js/HEAD/examples/developers/sprites/icon0.png -------------------------------------------------------------------------------- /examples/expert/collection/chara1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wise9/enchant.js/HEAD/examples/expert/collection/chara1.png -------------------------------------------------------------------------------- /examples/expert/collection/icon0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wise9/enchant.js/HEAD/examples/expert/collection/icon0.png -------------------------------------------------------------------------------- /examples/expert/getbanana/chara1.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wise9/enchant.js/HEAD/examples/expert/getbanana/chara1.gif -------------------------------------------------------------------------------- /examples/expert/shooting/effect0.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wise9/enchant.js/HEAD/examples/expert/shooting/effect0.gif -------------------------------------------------------------------------------- /examples/expert/shooting/graphic.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wise9/enchant.js/HEAD/examples/expert/shooting/graphic.png -------------------------------------------------------------------------------- /examples/plugins/avatar/avatarBg1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wise9/enchant.js/HEAD/examples/plugins/avatar/avatarBg1.png -------------------------------------------------------------------------------- /examples/plugins/avatar/avatarBg2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wise9/enchant.js/HEAD/examples/plugins/avatar/avatarBg2.png -------------------------------------------------------------------------------- /examples/plugins/avatar/avatarBg3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wise9/enchant.js/HEAD/examples/plugins/avatar/avatarBg3.png -------------------------------------------------------------------------------- /examples/plugins/wiiu/vspong/pong.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wise9/enchant.js/HEAD/examples/plugins/wiiu/vspong/pong.png -------------------------------------------------------------------------------- /examples/plugins/wiiu/vspong/pong.psd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wise9/enchant.js/HEAD/examples/plugins/wiiu/vspong/pong.psd -------------------------------------------------------------------------------- /tests/qunit/ui.enchant.js/effect0.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wise9/enchant.js/HEAD/tests/qunit/ui.enchant.js/effect0.gif -------------------------------------------------------------------------------- /examples/beginner/new_class/enchant.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wise9/enchant.js/HEAD/examples/beginner/new_class/enchant.png -------------------------------------------------------------------------------- /examples/plugins/mixing/mapgroup/pad.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wise9/enchant.js/HEAD/examples/plugins/mixing/mapgroup/pad.png -------------------------------------------------------------------------------- /tests/feature/event_bubbling/chara1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wise9/enchant.js/HEAD/tests/feature/event_bubbling/chara1.png -------------------------------------------------------------------------------- /tests/feature/group_rotation/chara1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wise9/enchant.js/HEAD/tests/feature/group_rotation/chara1.png -------------------------------------------------------------------------------- /examples/plugins/mixing/mapgroup/apad.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wise9/enchant.js/HEAD/examples/plugins/mixing/mapgroup/apad.png -------------------------------------------------------------------------------- /examples/plugins/mixing/mapgroup/chara0.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wise9/enchant.js/HEAD/examples/plugins/mixing/mapgroup/chara0.gif -------------------------------------------------------------------------------- /examples/plugins/mixing/mapgroup/font0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wise9/enchant.js/HEAD/examples/plugins/mixing/mapgroup/font0.png -------------------------------------------------------------------------------- /examples/plugins/mixing/mapgroup/icon0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wise9/enchant.js/HEAD/examples/plugins/mixing/mapgroup/icon0.png -------------------------------------------------------------------------------- /examples/plugins/mixing/mapgroup/map1.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wise9/enchant.js/HEAD/examples/plugins/mixing/mapgroup/map1.gif -------------------------------------------------------------------------------- /examples/plugins/widget/ListView/button.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wise9/enchant.js/HEAD/examples/plugins/widget/ListView/button.png -------------------------------------------------------------------------------- /examples/plugins/widget/ListView/dialog.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wise9/enchant.js/HEAD/examples/plugins/widget/ListView/dialog.png -------------------------------------------------------------------------------- /examples/windows8/enchant.js template.suo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wise9/enchant.js/HEAD/examples/windows8/enchant.js template.suo -------------------------------------------------------------------------------- /examples/windows8/sample-app/enchant/4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wise9/enchant.js/HEAD/examples/windows8/sample-app/enchant/4.png -------------------------------------------------------------------------------- /examples/windows8/sample-app/enchant/c.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wise9/enchant.js/HEAD/examples/windows8/sample-app/enchant/c.png -------------------------------------------------------------------------------- /examples/windows8/sample-app/enchant/e.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wise9/enchant.js/HEAD/examples/windows8/sample-app/enchant/e.png -------------------------------------------------------------------------------- /examples/windows8/sample-app/enchant/i.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wise9/enchant.js/HEAD/examples/windows8/sample-app/enchant/i.png -------------------------------------------------------------------------------- /tests/mocha/font/LiberationMono-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wise9/enchant.js/HEAD/tests/mocha/font/LiberationMono-Regular.ttf -------------------------------------------------------------------------------- /examples/plugins/avatar/monster/monster1.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wise9/enchant.js/HEAD/examples/plugins/avatar/monster/monster1.gif -------------------------------------------------------------------------------- /examples/plugins/avatar/monster/monster2.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wise9/enchant.js/HEAD/examples/plugins/avatar/monster/monster2.gif -------------------------------------------------------------------------------- /examples/plugins/avatar/monster/monster3.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wise9/enchant.js/HEAD/examples/plugins/avatar/monster/monster3.gif -------------------------------------------------------------------------------- /examples/plugins/avatar/monster/monster4.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wise9/enchant.js/HEAD/examples/plugins/avatar/monster/monster4.gif -------------------------------------------------------------------------------- /examples/plugins/avatar/monster/monster5.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wise9/enchant.js/HEAD/examples/plugins/avatar/monster/monster5.gif -------------------------------------------------------------------------------- /examples/plugins/avatar/monster/monster6.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wise9/enchant.js/HEAD/examples/plugins/avatar/monster/monster6.gif -------------------------------------------------------------------------------- /examples/plugins/avatar/monster/monster7.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wise9/enchant.js/HEAD/examples/plugins/avatar/monster/monster7.gif -------------------------------------------------------------------------------- /examples/plugins/widget/Check_Text/button.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wise9/enchant.js/HEAD/examples/plugins/widget/Check_Text/button.png -------------------------------------------------------------------------------- /examples/plugins/widget/Check_Text/dialog.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wise9/enchant.js/HEAD/examples/plugins/widget/Check_Text/dialog.png -------------------------------------------------------------------------------- /examples/windows8/enchant.js template.v11.suo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wise9/enchant.js/HEAD/examples/windows8/enchant.js template.v11.suo -------------------------------------------------------------------------------- /examples/windows8/sample-app/enchant/end.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wise9/enchant.js/HEAD/examples/windows8/sample-app/enchant/end.png -------------------------------------------------------------------------------- /examples/windows8/sample-app/images/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wise9/enchant.js/HEAD/examples/windows8/sample-app/images/logo.png -------------------------------------------------------------------------------- /doc/template/css/fonts/mplus-1m-bold-webfont.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wise9/enchant.js/HEAD/doc/template/css/fonts/mplus-1m-bold-webfont.eot -------------------------------------------------------------------------------- /doc/template/css/fonts/mplus-1m-bold-webfont.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wise9/enchant.js/HEAD/doc/template/css/fonts/mplus-1m-bold-webfont.ttf -------------------------------------------------------------------------------- /examples/plugins/avatar/monster/bigmonster1.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wise9/enchant.js/HEAD/examples/plugins/avatar/monster/bigmonster1.gif -------------------------------------------------------------------------------- /examples/plugins/avatar/monster/bigmonster2.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wise9/enchant.js/HEAD/examples/plugins/avatar/monster/bigmonster2.gif -------------------------------------------------------------------------------- /examples/plugins/mixing/spritelabel/chara1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wise9/enchant.js/HEAD/examples/plugins/mixing/spritelabel/chara1.png -------------------------------------------------------------------------------- /examples/plugins/widget/Alert_Confirm/button.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wise9/enchant.js/HEAD/examples/plugins/widget/Alert_Confirm/button.png -------------------------------------------------------------------------------- /examples/plugins/widget/Alert_Confirm/dialog.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wise9/enchant.js/HEAD/examples/plugins/widget/Alert_Confirm/dialog.png -------------------------------------------------------------------------------- /examples/plugins/widget/LazyListView/button.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wise9/enchant.js/HEAD/examples/plugins/widget/LazyListView/button.png -------------------------------------------------------------------------------- /examples/plugins/widget/LazyListView/dialog.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wise9/enchant.js/HEAD/examples/plugins/widget/LazyListView/dialog.png -------------------------------------------------------------------------------- /examples/plugins/widget/ListView/iconMenuBg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wise9/enchant.js/HEAD/examples/plugins/widget/ListView/iconMenuBg.png -------------------------------------------------------------------------------- /examples/plugins/widget/ListView/listItemBg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wise9/enchant.js/HEAD/examples/plugins/widget/ListView/listItemBg.png -------------------------------------------------------------------------------- /examples/plugins/widget/NavigationBar/button.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wise9/enchant.js/HEAD/examples/plugins/widget/NavigationBar/button.png -------------------------------------------------------------------------------- /examples/plugins/widget/NavigationBar/dialog.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wise9/enchant.js/HEAD/examples/plugins/widget/NavigationBar/dialog.png -------------------------------------------------------------------------------- /examples/windows8/sample-app/enchant/start.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wise9/enchant.js/HEAD/examples/windows8/sample-app/enchant/start.png -------------------------------------------------------------------------------- /doc/template/css/fonts/mplus-1m-bold-webfont.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wise9/enchant.js/HEAD/doc/template/css/fonts/mplus-1m-bold-webfont.woff -------------------------------------------------------------------------------- /examples/plugins/widget/Check_Text/iconMenuBg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wise9/enchant.js/HEAD/examples/plugins/widget/Check_Text/iconMenuBg.png -------------------------------------------------------------------------------- /examples/plugins/widget/Check_Text/listItemBg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wise9/enchant.js/HEAD/examples/plugins/widget/Check_Text/listItemBg.png -------------------------------------------------------------------------------- /examples/plugins/widget/ListView/buttonPushed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wise9/enchant.js/HEAD/examples/plugins/widget/ListView/buttonPushed.png -------------------------------------------------------------------------------- /examples/plugins/widget/ListView/navigationBar.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wise9/enchant.js/HEAD/examples/plugins/widget/ListView/navigationBar.png -------------------------------------------------------------------------------- /examples/windows8/sample-app/App4_TemporaryKey.pfx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wise9/enchant.js/HEAD/examples/windows8/sample-app/App4_TemporaryKey.pfx -------------------------------------------------------------------------------- /examples/windows8/sample-app/images/smalllogo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wise9/enchant.js/HEAD/examples/windows8/sample-app/images/smalllogo.png -------------------------------------------------------------------------------- /examples/windows8/sample-app/images/storelogo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wise9/enchant.js/HEAD/examples/windows8/sample-app/images/storelogo.png -------------------------------------------------------------------------------- /doc/template/css/fonts/mplus-1m-regular-webfont.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wise9/enchant.js/HEAD/doc/template/css/fonts/mplus-1m-regular-webfont.eot -------------------------------------------------------------------------------- /doc/template/css/fonts/mplus-1m-regular-webfont.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wise9/enchant.js/HEAD/doc/template/css/fonts/mplus-1m-regular-webfont.ttf -------------------------------------------------------------------------------- /doc/template/css/fonts/mplus-1m-regular-webfont.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wise9/enchant.js/HEAD/doc/template/css/fonts/mplus-1m-regular-webfont.woff -------------------------------------------------------------------------------- /examples/plugins/widget/Alert_Confirm/iconMenuBg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wise9/enchant.js/HEAD/examples/plugins/widget/Alert_Confirm/iconMenuBg.png -------------------------------------------------------------------------------- /examples/plugins/widget/Alert_Confirm/listItemBg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wise9/enchant.js/HEAD/examples/plugins/widget/Alert_Confirm/listItemBg.png -------------------------------------------------------------------------------- /examples/plugins/widget/Check_Text/buttonPushed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wise9/enchant.js/HEAD/examples/plugins/widget/Check_Text/buttonPushed.png -------------------------------------------------------------------------------- /examples/plugins/widget/Check_Text/navigationBar.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wise9/enchant.js/HEAD/examples/plugins/widget/Check_Text/navigationBar.png -------------------------------------------------------------------------------- /examples/plugins/widget/LazyListView/buttonPushed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wise9/enchant.js/HEAD/examples/plugins/widget/LazyListView/buttonPushed.png -------------------------------------------------------------------------------- /examples/plugins/widget/LazyListView/iconMenuBg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wise9/enchant.js/HEAD/examples/plugins/widget/LazyListView/iconMenuBg.png -------------------------------------------------------------------------------- /examples/plugins/widget/LazyListView/listItemBg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wise9/enchant.js/HEAD/examples/plugins/widget/LazyListView/listItemBg.png -------------------------------------------------------------------------------- /examples/plugins/widget/NavigationBar/iconMenuBg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wise9/enchant.js/HEAD/examples/plugins/widget/NavigationBar/iconMenuBg.png -------------------------------------------------------------------------------- /examples/plugins/widget/NavigationBar/listItemBg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wise9/enchant.js/HEAD/examples/plugins/widget/NavigationBar/listItemBg.png -------------------------------------------------------------------------------- /examples/windows8/sample-app/bin/Debug/resources.pri: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wise9/enchant.js/HEAD/examples/windows8/sample-app/bin/Debug/resources.pri -------------------------------------------------------------------------------- /examples/windows8/sample-app/images/splashscreen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wise9/enchant.js/HEAD/examples/windows8/sample-app/images/splashscreen.png -------------------------------------------------------------------------------- /examples/plugins/widget/Alert_Confirm/buttonPushed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wise9/enchant.js/HEAD/examples/plugins/widget/Alert_Confirm/buttonPushed.png -------------------------------------------------------------------------------- /examples/plugins/widget/Alert_Confirm/navigationBar.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wise9/enchant.js/HEAD/examples/plugins/widget/Alert_Confirm/navigationBar.png -------------------------------------------------------------------------------- /examples/plugins/widget/LazyListView/navigationBar.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wise9/enchant.js/HEAD/examples/plugins/widget/LazyListView/navigationBar.png -------------------------------------------------------------------------------- /examples/plugins/widget/NavigationBar/buttonPushed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wise9/enchant.js/HEAD/examples/plugins/widget/NavigationBar/buttonPushed.png -------------------------------------------------------------------------------- /examples/plugins/widget/NavigationBar/navigationBar.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wise9/enchant.js/HEAD/examples/plugins/widget/NavigationBar/navigationBar.png -------------------------------------------------------------------------------- /examples/windows8/sample-app/bin/Debug/AppX/enchant/4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wise9/enchant.js/HEAD/examples/windows8/sample-app/bin/Debug/AppX/enchant/4.png -------------------------------------------------------------------------------- /examples/windows8/sample-app/bin/Debug/AppX/enchant/c.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wise9/enchant.js/HEAD/examples/windows8/sample-app/bin/Debug/AppX/enchant/c.png -------------------------------------------------------------------------------- /examples/windows8/sample-app/bin/Debug/AppX/enchant/e.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wise9/enchant.js/HEAD/examples/windows8/sample-app/bin/Debug/AppX/enchant/e.png -------------------------------------------------------------------------------- /examples/windows8/sample-app/bin/Debug/AppX/enchant/i.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wise9/enchant.js/HEAD/examples/windows8/sample-app/bin/Debug/AppX/enchant/i.png -------------------------------------------------------------------------------- /examples/windows8/sample-app/bin/Debug/AppX/resources.pri: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wise9/enchant.js/HEAD/examples/windows8/sample-app/bin/Debug/AppX/resources.pri -------------------------------------------------------------------------------- /examples/windows8/sample-app/bin/Debug/AppX/enchant/end.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wise9/enchant.js/HEAD/examples/windows8/sample-app/bin/Debug/AppX/enchant/end.png -------------------------------------------------------------------------------- /examples/windows8/sample-app/bin/Debug/AppX/images/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wise9/enchant.js/HEAD/examples/windows8/sample-app/bin/Debug/AppX/images/logo.png -------------------------------------------------------------------------------- /examples/windows8/sample-app/bin/Debug/AppX/enchant/start.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wise9/enchant.js/HEAD/examples/windows8/sample-app/bin/Debug/AppX/enchant/start.png -------------------------------------------------------------------------------- /examples/windows8/sample-app/bin/Debug/AppX/images/smalllogo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wise9/enchant.js/HEAD/examples/windows8/sample-app/bin/Debug/AppX/images/smalllogo.png -------------------------------------------------------------------------------- /examples/windows8/sample-app/bin/Debug/AppX/images/storelogo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wise9/enchant.js/HEAD/examples/windows8/sample-app/bin/Debug/AppX/images/storelogo.png -------------------------------------------------------------------------------- /dev/src/Game.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @name enchant.Game 3 | * @class 4 | * enchant.Game is moved to {@link enchant.Core} from v0.6 5 | * @deprecated 6 | */ 7 | enchant.Game = enchant.Core; 8 | -------------------------------------------------------------------------------- /examples/windows8/sample-app/bin/Debug/AppX/images/splashscreen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wise9/enchant.js/HEAD/examples/windows8/sample-app/bin/Debug/AppX/images/splashscreen.png -------------------------------------------------------------------------------- /component.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "enchant.js", 3 | "version": "0.6.3", 4 | "main": "enchant.js", 5 | "ignore": [ 6 | "node_modules", 7 | "components" 8 | ] 9 | } 10 | -------------------------------------------------------------------------------- /tasks/build.coffee: -------------------------------------------------------------------------------- 1 | module.exports = (grunt) -> 2 | 3 | grunt.registerTask 'build', 'Create build directory.', -> 4 | grunt.task.run 'copy:lang/en/:build/', 'exec:whatever:git checkout build/readme.md' 5 | -------------------------------------------------------------------------------- /tests/mocha/font/font.css: -------------------------------------------------------------------------------- 1 | @font-face { 2 | font-family: "LiberationMono"; 3 | font-weight: normal; 4 | font-style: normal; 5 | src: url("LiberationMono-Regular.ttf") format('truetype'); 6 | } -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | jsdoc-toolkit 2 | .svn 3 | .DS_Store 4 | node_modules 5 | .project 6 | doc/* 7 | !doc/template 8 | build/* 9 | lang/* 10 | !build/readme.md 11 | enchant.js 12 | enchant.min.js 13 | npm-debug.log 14 | -------------------------------------------------------------------------------- /examples/expert/shooting/shooting.ja.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Created by JetBrains PhpStorm. 3 | * User: ryohei 4 | * Date: 12/04/02 5 | * Time: 20:54 6 | * To change this template use File | Settings | File Templates. 7 | */ 8 | -------------------------------------------------------------------------------- /tests/raster/README: -------------------------------------------------------------------------------- 1 | How to run hellobear test 2 | ========================= 3 | 4 | 1. install phantomjs command (http://code.google.com/p/phantomjs/) 5 | 2. run "phantomjs rasterize.js hellobear/index.html hellobear.png" -------------------------------------------------------------------------------- /tests/mocha/enchant.js/test_enchant.js: -------------------------------------------------------------------------------- 1 | describe("enchant.js", function(){ 2 | afterEach(function(){ 3 | }); 4 | 5 | describe("export", function(){ 6 | it("should export globally", function(){ 7 | }); 8 | }); 9 | }); -------------------------------------------------------------------------------- /doc/template/subtemplates/foot.tmpl: -------------------------------------------------------------------------------- 1 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /examples/windows8/readme.md: -------------------------------------------------------------------------------- 1 | ## Windows 8 Appliation Template 2 | 3 | This is an template project for windows 8 application with enchant.js. Put your enchant.js application in the `App4/enchant` directory, and set size of ` 18 | 19 | 20 | -------------------------------------------------------------------------------- /examples/expert/getbanana/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "enchant.js", 3 | "version": "0.8.3", 4 | "repository": { 5 | "type": "git", 6 | "url": "https://github.com/wise9/enchant.js.git" 7 | }, 8 | "homepage": "http://enchantjs.com", 9 | "engines": { 10 | "node": ">=0.10" 11 | }, 12 | "scripts": { 13 | "test": "grunt default --verbose" 14 | }, 15 | "devDependencies": { 16 | "grunt": "~0.4.5", 17 | "grunt-contrib-jshint": "0.10.0", 18 | "grunt-contrib-concat": "0.5.1", 19 | "grunt-contrib-uglify": "0.9.2", 20 | "grunt-contrib-qunit": "0.7.0", 21 | "grunt-contrib-watch": "0.6.1", 22 | "grunt-exec": "0.4.6", 23 | "grunt-mocha": "~0.4.13", 24 | "unzip": "~0.1.11" 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /examples/windows8/sample-app/bin/Debug/AppX/default.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | enchant.js template 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /examples/expert/timeline/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | enchant 9 | 10 | 11 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /examples/beginner/label/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /examples/beginner/new_class/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /examples/plugins/gl/bounding/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | noname 5 | 6 | 7 | 8 | 9 | 10 | 11 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /examples/plugins/box2d/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /dev/src/BinaryInputSource.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @scope enchant.BinaryInputSource.prototype 3 | */ 4 | enchant.BinaryInputSource = enchant.Class.create(enchant.InputSource, { 5 | /** 6 | * @name enchant.BinaryInputSource 7 | * @class 8 | [lang:ja] 9 | * 任意の2値入力をラップするクラス. 10 | * @param {String} identifier 入力のid. 11 | [/lang] 12 | [lang:en] 13 | * Class that wrap binary input. 14 | * @param {String} identifier identifier of BinaryInputSource. 15 | [/lang] 16 | [lang:de] 17 | * @param {String} identifier 18 | [/lang] 19 | * @constructs 20 | * @extends enchant.InputSource 21 | */ 22 | initialize: function(identifier) { 23 | enchant.InputSource.call(this, identifier); 24 | } 25 | }); 26 | -------------------------------------------------------------------------------- /examples/beginner/hellobear/main_nocomment.js: -------------------------------------------------------------------------------- 1 | enchant(); 2 | 3 | window.onload = function(){ 4 | var game = new Core(320, 320); 5 | game.fps = 15; 6 | game.preload("chara1.png"); 7 | game.onload = function(){ 8 | var bear = new Sprite(32, 32); 9 | bear.image = game.assets["chara1.png"]; 10 | bear.x = 0; 11 | bear.y = 0; 12 | bear.frame = 5; 13 | game.rootScene.addChild(bear); 14 | 15 | bear.addEventListener("enterframe", function(){ 16 | this.x += 1; 17 | this.frame = this.age % 2 + 6; 18 | }); 19 | 20 | bear.addEventListener("touchstart", function(){ 21 | game.rootScene.removeChild(bear); 22 | }); 23 | }; 24 | game.start(); 25 | }; -------------------------------------------------------------------------------- /examples/beginner/map/main.js: -------------------------------------------------------------------------------- 1 | enchant(); 2 | 3 | window.onload = function() { 4 | var game = new Game(320, 320); 5 | game.fps = 20; 6 | game.preload('chara1.png', 'map0.png'); 7 | game.onload = function() { 8 | var map = new Map(16, 16); 9 | map.image = game.assets['map0.png']; 10 | map.loadData( 11 | [ 12 | [4, 4, 4, 4, 4, 4, 4], 13 | [4, 5, 5, 5, 5, 5, 4], 14 | [4, 5, 4, 5, 4, 5, 4], 15 | [4, 5, 5, 5, 5, 5, 4], 16 | [4, 5, 4, 5, 4, 5, 4], 17 | [4, 5, 5, 5, 5, 5, 4], 18 | [4, 4, 4, 4, 4, 4, 4] 19 | ] 20 | ); 21 | game.rootScene.addChild(map); 22 | }; 23 | game.start(); 24 | }; 25 | -------------------------------------------------------------------------------- /examples/expert/collection/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | noname 5 | 6 | 7 | 8 | 9 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /examples/plugins/widget/ListView/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /examples/plugins/widget/Alert_Confirm/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /examples/plugins/widget/Check_Text/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /examples/plugins/widget/LazyListView/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /examples/plugins/widget/NavigationBar/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /examples/developers/sprites/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | enchant 10 | 11 | 12 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /examples/developers/eventViewer/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | enchant 10 | 11 | 12 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /examples/expert/shooting/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /examples/plugins/ui/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | ui.enchant.js example 9 | 10 | 11 | 12 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /examples/plugins/wiiu/vspong/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | enchant 9 | 10 | 11 | 12 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /tests/gl-qunit/primitive.gl.enchant.js/primitive.gl.js: -------------------------------------------------------------------------------- 1 | module('primitive.gl.enchant.js', { 2 | setup: function() { 3 | enchant(); 4 | }, 5 | teardown: function() { 6 | 7 | } 8 | }); 9 | 10 | if (document.createElement('canvas').getContext('experimental-webgl')) { 11 | /* 12 | * issue#54. 13 | * 14 | * BillboardAnimation#frame 15 | */ 16 | test('BillboardAnimation#frame', function() { 17 | var game = new Core(); 18 | var scene = new Scene3D(); 19 | var ba = new BillboardAnimation(); 20 | scene.addChild(ba); 21 | game.dispatchEvent(new Event("enterframe")); 22 | var error = game.GL._gl.getError(); 23 | notEqual(error, gl.INVALID_OPERATION); 24 | }); 25 | }else{ 26 | console.log('\nskipping tests using webgl..'); 27 | } 28 | 29 | -------------------------------------------------------------------------------- /examples/plugins/wiiu/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | enchant 9 | 10 | 11 | 12 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /examples/plugins/avatar/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | enchant 9 | 10 | 11 | 12 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /examples/plugins/widget/NavigationBar/main.js: -------------------------------------------------------------------------------- 1 | enchant(); 2 | window.onload = function() { 3 | var game = new Game(320, 320); 4 | game.onload = function() { 5 | var button1 = new Button('Back'); // 左の項目に配置するボタンを作成 6 | button1.ontouchend = function() { 7 | alert('「Back」がタップされました。'); 8 | }; 9 | var button2 = new Button('Edit'); // 右の項目に配置するボタンを作成 10 | button2.ontouchend = function() { 11 | alert('「Edit」がタップされました。'); 12 | }; 13 | 14 | /* 15 | * new NavigationBar(center, left, right) 16 | * ナビゲーションバー(ボタンなどを設定できるメニューバー)を作成する。 17 | * 中央、左、右の項目を設定できる。 18 | */ 19 | var navigationBar = new NavigationBar('Navigationbar', button1, button2); // ナビゲーションバーを作成 20 | 21 | game.rootScene.addChild(navigationBar); 22 | }; 23 | game.start(); 24 | }; 25 | -------------------------------------------------------------------------------- /tests/qunit/mixing.enchant.js/mixing.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | enchant.js unit test 7 | 10 | 11 | 12 |

enchant.js unit test

13 |

14 |
15 |

16 |
    17 |
    test markup, will be hidden
    18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /examples/expert/rpg/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | enchant 10 | 11 | 12 | 13 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /examples/plugins/widget/ListView/main.js: -------------------------------------------------------------------------------- 1 | enchant(); 2 | window.onload = function() { 3 | var game = new Game(320, 320); 4 | game.onload = function() { 5 | var navigationBar = new NavigationBar('NavigationBar'); // ナビゲーションバーを作成 6 | game.rootScene.addChild(navigationBar); 7 | 8 | /* 9 | * new ListView(width, height, draggable) 10 | * ListView オブジェクトを作成する。 11 | * 横幅、縦幅、項目をドラッグ可能かを設定する。 12 | */ 13 | var listView = new ListView(320, 320 - navigationBar.height, true); // リストビューを作成 14 | listView.y = navigationBar.height; 15 | 16 | // 項目を10個作成する 17 | for (var i = 0; i < 10; i++) { 18 | var item = new ListItem(320, 48); // リストアイテムを作成 19 | item.content = 'ListItem' + i; 20 | listView.addChild(item); // リストビューに項目を追加 21 | } 22 | game.rootScene.addChild(listView); 23 | }; 24 | game.start(); 25 | }; 26 | -------------------------------------------------------------------------------- /tests/qunit/enchant.js/tl.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | enchant.js unit test 7 | 10 | 11 | 12 |

    enchant.js unit test

    13 |

    14 |
    15 |

    16 |
      17 |
      test markup, will be hidden
      18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /examples/plugins/mixing/mapgroup/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | enchant 9 | 10 | 11 | 12 | 13 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /tasks/lang.coffee: -------------------------------------------------------------------------------- 1 | module.exports = (grunt) -> 2 | 3 | make_repl = (lang) -> 4 | new RegExp('^[\\*\\s]*\\[lang:' + lang + '\\]\\n([\\s\\S]*?)^[\\*\\s]*\\[\\/lang\\]\\n', 'mg') 5 | 6 | grunt.registerTask 'lang', 'Generate localized files.', (lang, path) -> 7 | lang = lang || 'en' 8 | path = path || 'lang/' + lang 9 | 10 | grunt.file.mkdir 'lang/' + lang + '/plugins' 11 | 12 | repl_en = make_repl 'en' 13 | repl_ja = make_repl 'ja' 14 | repl_de = make_repl 'de' 15 | 16 | (grunt.file.expand 'dev/{plugins\/,}*.js').forEach (source) -> 17 | dist = source.toString().replace /dev\//, './lang/' + lang + '/' 18 | 19 | grunt.file.write dist, (grunt.file.read source).toString() 20 | .replace(repl_en, (if lang == 'en' then '$1' else '')) 21 | .replace(repl_ja, (if lang == 'ja' then '$1' else '')) 22 | .replace(repl_de, (if lang == 'de' then '$1' else '')) 23 | 24 | grunt.log.writeln source, '->', dist 25 | -------------------------------------------------------------------------------- /examples/expert/action/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | enchant 10 | 11 | 12 | 13 | 14 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /examples/windows8/sample-app/bld/Debug/priconfig.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /tasks/doc.coffee: -------------------------------------------------------------------------------- 1 | module.exports = (grunt) -> 2 | 3 | jsdoc_command = (scripts, template, destination) -> 4 | [ 5 | 'java -jar jsdoc-toolkit/jsrun.jar jsdoc-toolkit/app/run.js' 6 | scripts.join ' ' 7 | '-t=' + template 8 | '-d=' + destination 9 | ].join ' ' 10 | 11 | grunt.registerTask 'jsdoc-core', '(internal) Generate jsdoc reference.', (lang) -> 12 | grunt.task.run 'exec:whatever:' + jsdoc_command [ 13 | 'lang/' + lang + '/enchant.js' 14 | ], 'doc/template', 'doc/core/' + lang + '/' 15 | 16 | grunt.registerTask 'jsdoc-plugins', '(internal) Generate jsdoc reference.', (lang) -> 17 | grunt.task.run 'exec:whatever:' + jsdoc_command [ 18 | 'lang/' + lang + '/enchant.js' 19 | 'lang/' + lang + '/plugins/*.js' 20 | ], 'doc/template', 'doc/plugins/' + lang + '/' 21 | 22 | grunt.registerTask 'doc', 'Generate jsdoc reference.', -> 23 | [ 'en', 'ja', 'de' ].forEach (lang) -> 24 | grunt.task.run 'jsdoc-core:' + lang, 'jsdoc-plugins:' + lang 25 | -------------------------------------------------------------------------------- /tests/gl-qunit/gl.enchant.js/gl.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | enchant.js unit test 7 | 10 | 11 | 12 |

      enchant.js unit test

      13 |

      14 |
      15 |

      16 |
        17 |
        test markup, will be hidden
        18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /examples/plugins/widget/Alert_Confirm/main.js: -------------------------------------------------------------------------------- 1 | enchant(); 2 | window.onload = function() { 3 | var game = new Game(320, 320); 4 | game.onload = function() { 5 | /* 6 | * new AlertScene() 7 | * アラートシーンを作成する。 8 | * ボタンを1つ設定する。 9 | */ 10 | var alertScene = new AlertScene('その操作は実行できません。', '戻る'); // アラートシーンを作成 11 | alertScene.onaccept = function() { 12 | alert('「戻る」が選択されました。'); 13 | }; 14 | game.pushScene(alertScene); 15 | 16 | /* 17 | * new ConfirmScene() 18 | * コンファームシーンを作成する。 19 | * ボタンを2つ設定する。 20 | */ 21 | var confirmScene = new ConfirmScene('本当に実行してもよろしいですか?', 'はい', 'いいえ'); // コンファームシーンを作成 22 | confirmScene.oncancel = function() { 23 | alert('「いいえ」が選択されました。'); 24 | }; 25 | confirmScene.onaccept = function() { 26 | alert('「はい」が選択されました。'); 27 | }; 28 | game.pushScene(confirmScene); 29 | }; 30 | game.start(); 31 | }; 32 | -------------------------------------------------------------------------------- /tests/feature/group_rotation/main.js: -------------------------------------------------------------------------------- 1 | /** 2 | * グループの回転。 3 | */ 4 | 5 | enchant(); 6 | window.onload = function() { 7 | var game = new Game(320, 320); 8 | game.preload('chara1.png'); 9 | game.onload = function() { 10 | var bear = new Sprite(32, 32); 11 | bear.image = game.assets['chara1.png']; 12 | bear.frame = 1; 13 | bear.x = 0; 14 | 15 | var white = new Sprite(32, 32); 16 | white.image = game.assets['chara1.png']; 17 | white.x = 32; 18 | white.y = 32; 19 | white.frame = 5; 20 | 21 | var group = new enchant.Group(); 22 | group.addChild(bear); 23 | group.addChild(white); 24 | group.originX = 32; 25 | group.originY = 32; 26 | 27 | game.rootScene.addChild(group); 28 | group.on('enterframe', function() { 29 | this.rotation += 2; 30 | this.x += 1; 31 | this.y += 1; 32 | }); 33 | }; 34 | game._debug = true; 35 | game.start(); 36 | }; -------------------------------------------------------------------------------- /tests/qunit/ui.enchant.js/mutable_text.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | util.enchant.js unit test 7 | 10 | 11 | 12 |

        util.enchant.js unit test

        13 |

        14 |
        15 |

        16 |
          17 |
          test markup, will be hidden
          18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /tests/qunit/enchant.js/enchant.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | enchant.js unit test 7 | 10 | 11 | 12 |

          enchant.js unit test

          13 |

          14 |
          15 |

          16 |
            17 |
            test markup, will be hidden
            18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /tests/gl-qunit/primitive.gl.enchant.js/primitive.gl.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | enchant.js unit test 7 | 10 | 11 | 12 |

            enchant.js unit test

            13 |

            14 |
            15 |

            16 |
              17 |
              test markup, will be hidden
              18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /doc/template/subtemplates/head.tmpl: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | {+data.subtitle+} | <if test="JSDOC.opt.D.title">{+JSDOC.opt.D.title+}<else />JsDoc Reference</if> 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /tests/mocha/mixing.enchant.js/test_mixing.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | enchant.js unit test 7 | 10 | 11 | 12 |
              13 | 14 | 17 | 18 | 19 | 22 | 23 | 24 | 25 | 26 | 27 | 30 | 31 | -------------------------------------------------------------------------------- /LICENSE.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 2011-2012 UEI Corporation 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is 8 | furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in 11 | all copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19 | THE SOFTWARE. 20 | -------------------------------------------------------------------------------- /examples/plugins/avatar/main.js: -------------------------------------------------------------------------------- 1 | enchant(); 2 | 3 | window.onload=function(){ 4 | game = new Game(320,320); 5 | game.preload('avatarBg1.png','avatarBg2.png','avatarBg3.png','monster/bigmonster1.gif'); 6 | game.onload=function(){ 7 | game.rootScene.backgroundColor="#000000"; 8 | bg =new AvatarBG(1); 9 | bg.y=50; 10 | game.rootScene.addChild(bg); 11 | 12 | monster = new AvatarMonster(game.assets['monster/bigmonster1.gif']); 13 | monster.x=200; 14 | monster.y=100; 15 | game.rootScene.addChild(monster); 16 | 17 | 18 | chara = new Avatar("2:2:1:2004:21230:22480"); 19 | game.rootScene.addChild(chara); 20 | chara.scaleX=-1; 21 | chara.scaleY=1; 22 | chara.x=50; 23 | chara.y=100; 24 | chara.addEventListener('enterframe',function(){ 25 | if(this.action=="run"){ 26 | bg.scroll(game.frame*2); 27 | } 28 | if(game.frame%40==0){ 29 | switch(Math.floor(Math.random()*3)){ 30 | case 0 :this.action="run"; 31 | break; 32 | case 1 :this.action="attack";break; 33 | case 2 :this.action="special";break; 34 | } 35 | } 36 | }); 37 | } 38 | 39 | game.start(); 40 | } -------------------------------------------------------------------------------- /examples/plugins/gl/billiard/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | noname 5 | 6 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /tests/mocha/ui.enchant.js/test_mutable_text.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | ui.enchant.js mutableText unit test 7 | 10 | 11 | 12 |
              13 | 14 | 17 | 18 | 19 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 32 | 33 | -------------------------------------------------------------------------------- /doc/template/license.txt: -------------------------------------------------------------------------------- 1 | The Codeview template is, like JsDoc Toolkit itself, published under the X11/MIT License. 2 | 3 | Codeview is Copyright (c) 2010 Wouter Bos (www.thebrightlines.com) 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. -------------------------------------------------------------------------------- /dev/src/ActionEventTarget.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @scope enchant.ActionEventTarget.prototype 3 | */ 4 | enchant.ActionEventTarget = enchant.Class.create(enchant.EventTarget, { 5 | /** 6 | * @name enchant.ActionEventTarget 7 | * @class 8 | [lang:ja] 9 | * timelineの {@link enchant.Action} クラス向けに拡張された {@link enchant.EventTarget} クラス. 10 | [/lang] 11 | [lang:en] 12 | * EventTarget which can change the context of event listeners. 13 | [/lang] 14 | [lang:de] 15 | [/lang] 16 | * @constructs 17 | * @extends enchant.EventTarget 18 | */ 19 | initialize: function() { 20 | enchant.EventTarget.apply(this, arguments); 21 | }, 22 | dispatchEvent: function(e) { 23 | var target = this.node ? this.node : this; 24 | 25 | e.target = target; 26 | e.localX = e.x - target._offsetX; 27 | e.localY = e.y - target._offsetY; 28 | 29 | if (this['on' + e.type] != null) { 30 | this['on' + e.type].call(target, e); 31 | } 32 | var listeners = this._listeners[e.type]; 33 | if (listeners != null) { 34 | listeners = listeners.slice(); 35 | for (var i = 0, len = listeners.length; i < len; i++) { 36 | listeners[i].call(target, e); 37 | } 38 | } 39 | } 40 | }); 41 | -------------------------------------------------------------------------------- /dev/src/DOMScene.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @scope enchant.DOMScene.prototype 3 | */ 4 | enchant.DOMScene = enchant.Class.create(enchant.Scene, { 5 | /** 6 | * @name enchant.DOMScene 7 | * @class 8 | [lang:ja] 9 | * すべての子をDOMで描画するScene. 10 | [/lang] 11 | [lang:en] 12 | * Scene to draw by the DOM all of the children. 13 | [/lang] 14 | [lang:de] 15 | [/lang] 16 | * @constructs 17 | * @extends enchant.Scene 18 | */ 19 | initialize: function() { 20 | enchant.Scene.call(this); 21 | this.addLayer('Dom'); 22 | }, 23 | _determineEventTarget: function(e) { 24 | var target = this._layers.Dom._determineEventTarget(e); 25 | if (!target) { 26 | target = this; 27 | } 28 | return target; 29 | }, 30 | _onchildadded: function(e) { 31 | var child = e.node; 32 | var next = e.next; 33 | child._layer = this._layers.Dom; 34 | this._layers.Dom.insertBefore(child, next); 35 | }, 36 | _onenter: function() { 37 | this._layers.Dom._startRendering(); 38 | enchant.Core.instance.addEventListener('exitframe', this._dispatchExitframe); 39 | }, 40 | _onexit: function() { 41 | this._layers.Dom._stopRendering(); 42 | enchant.Core.instance.removeEventListener('exitframe', this._dispatchExitframe); 43 | } 44 | }); 45 | -------------------------------------------------------------------------------- /examples/plugins/gl/mmd/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | MMD sample 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 32 | 33 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /tests/gl-qunit/gl.enchant.js/gl.js: -------------------------------------------------------------------------------- 1 | module('gl.enchant.js', { 2 | setup: function() { 3 | enchant(); 4 | // var game = new Core(); 5 | }, 6 | teardown: function() { 7 | 8 | } 9 | }); 10 | 11 | /* 12 | * issue#54. 13 | * 14 | * Quat#slerp 15 | */ 16 | 17 | if (document.createElement('canvas').getContext('experimental-webgl')) { 18 | test('Quat#slerp', function() { 19 | function nearlyEqual(numA, numB, message) { 20 | console.log(numA, numB); 21 | var a = Math.floor(numA * 1000); 22 | var b = Math.floor(numB * 1000); 23 | return equal(a, b, message) 24 | } 25 | 26 | var q1 = new Quat(1, 0, 0, 0.0); 27 | var q2 = new Quat(1, 0, 0, 2.0); 28 | 29 | var result = q1.slerp(q2, 0.5); 30 | var expected = new Quat(1, 0, 0, 1.0); 31 | 32 | nearlyEqual(result._quat[0], expected._quat[0], 33 | "result._quat[0] == expected._quat[0]"); 34 | nearlyEqual(result._quat[1], expected._quat[1], 35 | "result._quat[1] == expected._quat[1]"); 36 | nearlyEqual(result._quat[2], expected._quat[2], 37 | "result._quat[2] == expected._quat[2]"); 38 | nearlyEqual(result._quat[3], expected._quat[3], 39 | "result._quat[3] == expected._quat[3]"); 40 | }); 41 | } else { 42 | console.log('\nskipping tests using webgl..'); 43 | } -------------------------------------------------------------------------------- /dev/src/CanvasScene.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @scope enchant.CanvasScene.prototype 3 | */ 4 | enchant.CanvasScene = enchant.Class.create(enchant.Scene, { 5 | /** 6 | * @name enchant.CanvasScene 7 | * @class 8 | [lang:ja] 9 | * すべての子をCanvasに描画するScene. 10 | [/lang] 11 | [lang:en] 12 | * Scene to draw by the Canvas all of the children. 13 | [/lang] 14 | [lang:de] 15 | [/lang] 16 | * @constructs 17 | * @extends enchant.Scene 18 | */ 19 | initialize: function() { 20 | enchant.Scene.call(this); 21 | this.addLayer('Canvas'); 22 | }, 23 | _determineEventTarget: function(e) { 24 | var target = this._layers.Canvas._determineEventTarget(e); 25 | if (!target) { 26 | target = this; 27 | } 28 | return target; 29 | }, 30 | _onchildadded: function(e) { 31 | var child = e.node; 32 | var next = e.next; 33 | child._layer = this._layers.Canvas; 34 | this._layers.Canvas.insertBefore(child, next); 35 | }, 36 | _onenter: function() { 37 | this._layers.Canvas._startRendering(); 38 | enchant.Core.instance.addEventListener('exitframe', this._dispatchExitframe); 39 | }, 40 | _onexit: function() { 41 | this._layers.Canvas._stopRendering(); 42 | enchant.Core.instance.removeEventListener('exitframe', this._dispatchExitframe); 43 | } 44 | }); 45 | -------------------------------------------------------------------------------- /examples/windows8/sample-app/package.appxmanifest: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 8 | 9 | 10 | App4 11 | chephes 12 | images\storelogo.png 13 | 14 | 15 | 16 | 6.2.1 17 | 6.2.1 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 28 | 29 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | -------------------------------------------------------------------------------- /doc/template/allfiles.tmpl: -------------------------------------------------------------------------------- 1 | {! Link.base = ""; /* all generated links will be relative to this */ !} 2 | {+subtemplate("subtemplates/head.tmpl", {subtitle: "File Index"})+} 3 | {+subtemplate("subtemplates/menu.tmpl")+} 4 |
              5 |
              6 |

              File Index

              7 | 8 | 37 |
              38 |
              39 | {+subtemplate("subtemplates/foot.tmpl")+} -------------------------------------------------------------------------------- /dev/src/KeyboardInputSource.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @scope enchant.KeyboardInputSource.prototype 3 | */ 4 | enchant.KeyboardInputSource = enchant.Class.create(enchant.BinaryInputSource, { 5 | /** 6 | * @name enchant.KeyboardInputSource 7 | * @class 8 | [lang:ja] 9 | * キーボード入力をラップするBinaryInputSource. 10 | * キーコードをidとして持つ. 11 | * @param {String} keyCode キーコード. 12 | [/lang] 13 | [lang:en] 14 | * @param {String} keyCode key code of BinaryInputSource. 15 | [/lang] 16 | [lang:de] 17 | * @param {String} keyCode 18 | [/lang] 19 | * @constructs 20 | * @extends enchant.BinaryInputSource 21 | */ 22 | initialize: function(keyCode) { 23 | enchant.BinaryInputSource.call(this, keyCode); 24 | } 25 | }); 26 | /** 27 | * @private 28 | */ 29 | enchant.KeyboardInputSource._instances = {}; 30 | /** 31 | * @static 32 | [lang:ja] 33 | * キーコードに対応したインスタンスを取得する. 34 | * @param {Number} keyCode キーコード. 35 | [/lang] 36 | [lang:en] 37 | * Get the instance by key code. 38 | * @param {Number} keyCode key code. 39 | [/lang] 40 | [lang:de] 41 | * @param {Number} keyCode 42 | [/lang] 43 | * @return {enchant.KeyboardInputSource} instance. 44 | */ 45 | enchant.KeyboardInputSource.getByKeyCode = function(keyCode) { 46 | if (!this._instances[keyCode]) { 47 | this._instances[keyCode] = new enchant.KeyboardInputSource(keyCode); 48 | } 49 | return this._instances[keyCode]; 50 | }; 51 | -------------------------------------------------------------------------------- /examples/windows8/sample-app/bin/Debug/AppX/enchant/main.js: -------------------------------------------------------------------------------- 1 | enchant(); 2 | window.onload = function () { 3 | console.log('hello enchant.js'); 4 | var game = new Game(320, 320); 5 | game.preload('i.png', 'c.png', 'e.png', '4.png'); 6 | game.onload = function(){ 7 | var back = new Sprite(320, 320); 8 | back.image = game.assets['e.png']; 9 | back.addEventListener('enterframe', function(){ 10 | this.y += 3 + (game.frame / 100); 11 | if(this.y > 320){ 12 | this.y = -320; 13 | } 14 | }); 15 | game.rootScene.addChild(back); 16 | 17 | var car = new Sprite(32, 32); 18 | car.image = game.assets['4.png']; 19 | car.y = 280; 20 | game.rootScene.addChild(car); 21 | 22 | game.rootScene.addEventListener('touchmove', function(e){ 23 | car.x = (2 * car.x + e.x) / 3; 24 | }); 25 | game.rootScene.addEventListener('enterframe', function(){ 26 | if(Math.random() < 0.05){ 27 | var bear = new Sprite(32, 32); 28 | bear.image = game.assets['c.png']; 29 | bear.x = Math.random() * 320; 30 | bear.frame = 15; 31 | bear.y = -32; 32 | bear.addEventListener('enterframe', function(){ 33 | this.y += 3 + (game.frame / 100); 34 | if(this.within(car, 20)){ 35 | this.frame = 18; 36 | game.end(); 37 | } 38 | }); 39 | game.rootScene.addChild(bear); 40 | } 41 | }); 42 | } 43 | game.start(); 44 | } 45 | 46 | window.addEventListener('message', function (e) { 47 | console.log(e); 48 | }); -------------------------------------------------------------------------------- /tests/mocha/enchant.js/test_keyboard-input-source.js: -------------------------------------------------------------------------------- 1 | describe('KeyboardInputSource', function(){ 2 | 3 | before(function(){ 4 | enchant(); 5 | }); 6 | 7 | it('is an instance of enchant.BinaryInputSource', function(){ 8 | var keyboardInputSource = new KeyboardInputSource('keycode'); 9 | expect(keyboardInputSource).to.be.an.instanceof(enchant.BinaryInputSource); 10 | }); 11 | 12 | describe('enchant.KeyboardInputSource.getByKeyCode', function(){ 13 | it('creates a new KeyboardInputSource instance with given keycode if it has not created', function(){ 14 | expect(enchant.KeyboardInputSource._instances).to.be.empty; 15 | var keyboardInputSource = enchant.KeyboardInputSource.getByKeyCode('keycode'); 16 | expect(keyboardInputSource).to.be.an.instanceof(enchant.KeyboardInputSource); 17 | expect(enchant.KeyboardInputSource._instances).to.not.be.empty; 18 | }); 19 | 20 | it('returns KeyboardInputSource instance if KeyboardInputSource instance already created with given keycode', function(){ 21 | enchant.KeyboardInputSource.getByKeyCode('keycode'); 22 | expect(enchant.KeyboardInputSource._instances['keycode']).to.exist; 23 | var keyboardInputSource = enchant.KeyboardInputSource.getByKeyCode('keycode'); 24 | expect(keyboardInputSource).to.deep.equal(enchant.KeyboardInputSource._instances['keycode']); 25 | }); 26 | }); 27 | }); -------------------------------------------------------------------------------- /doc/template/javascript/html5.js: -------------------------------------------------------------------------------- 1 | // html5shiv MIT @rem remysharp.com/html5-enabling-script 2 | // iepp v1.6.2 MIT @jon_neal iecss.com/print-protector 3 | /*@cc_on(function(m,c){var z="abbr|article|aside|audio|canvas|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video";function n(d){for(var a=-1;++ai";if(g.childNodes.length!==1){var i=z.split("|"),o=i.length,s=RegExp("(^|\\s)("+z+")", 4 | "gi"),t=RegExp("<(/*)("+z+")","gi"),u=RegExp("(^|[^\\n]*?\\s)("+z+")([^\\n]*)({[\\n\\w\\W]*?})","gi"),r=c.createDocumentFragment(),k=c.documentElement;g=k.firstChild;var h=c.createElement("body"),l=c.createElement("style"),f;n(c);n(r);g.insertBefore(l, 5 | g.firstChild);l.media="print";m.attachEvent("onbeforeprint",function(){var d=-1,a=p(c.styleSheets,"all"),e=[],b;for(f=f||c.body;(b=u.exec(a))!=null;)e.push((b[1]+b[2]+b[3]).replace(s,"$1.iepp_$2")+b[4]);for(l.styleSheet.cssText=e.join("\n");++d'); 12 | }; 13 | 14 | var round = function(num) { 15 | return Math.round(num * 1e3) / 1e3; 16 | }; 17 | 18 | core.rootScene.on('touchstart', function(evt) { 19 | status.add('touchstart (' + round(evt.x) + ', ' + round(evt.y) + ')'); 20 | }); 21 | core.rootScene.on('touchmove', function(evt){ 22 | status.add('touchmove (' + round(evt.x) + ', ' + round(evt.y) + ')'); 23 | }); 24 | core.rootScene.on('touchend', function(evt){ 25 | status.add('touchend (' + round(evt.x) + ', ' + round(evt.y) + ')'); 26 | }); 27 | 28 | ['up', 'down', 'right', 'left'].forEach(function (direction){ 29 | var d = direction; 30 | core.rootScene.on(direction + 'buttondown', function(){ 31 | status.add(d + 'buttondown'); 32 | }) 33 | core.rootScene.on(direction + 'buttonup', function(){ 34 | status.add(d + 'buttonup'); 35 | }) 36 | }); 37 | core.rootScene.addChild(status); 38 | }; 39 | core.start(); 40 | }; -------------------------------------------------------------------------------- /tests/mocha/enchant.js/test_input-source.js: -------------------------------------------------------------------------------- 1 | describe('InputSource', function(){ 2 | var inputSource; 3 | 4 | before(function(){ 5 | enchant(); 6 | }); 7 | 8 | beforeEach(function(){ 9 | inputSource = new InputSource('keycode'); 10 | }); 11 | 12 | it('is an instanceof enchant.EventTarget', function(){ 13 | expect(inputSource).to.be.an.instanceof(enchant.EventTarget); 14 | }); 15 | 16 | describe('#initialize', function(){ 17 | it('keeps keycode as indetifier', function(){ 18 | expect(inputSource.identifier).to.equal('keycode'); 19 | }); 20 | }); 21 | 22 | describe('#notifyStateChange', function(){ 23 | it('dispatches enchant.Event.INPUT_STATE_CHANGED event', function(){ 24 | var spy = sinon.spy(); 25 | inputSource.addEventListener(enchant.Event.INPUT_STATE_CHANGED, spy); 26 | expect(spy.called).to.be.false; 27 | inputSource.notifyStateChange('new state'); 28 | expect(spy.called).to.be.true; 29 | }); 30 | 31 | it('dispatches event with data and source', function(done){ 32 | var data = 'new state'; 33 | inputSource.addEventListener(enchant.Event.INPUT_STATE_CHANGED, function(e){ 34 | expect(e.data).to.equal(data); 35 | expect(e.source).to.deep.equal(inputSource); 36 | done(); 37 | }); 38 | inputSource.notifyStateChange(data); 39 | }); 40 | }); 41 | }); -------------------------------------------------------------------------------- /tests/qunit/ui.enchant.js/mutable_text.js: -------------------------------------------------------------------------------- 1 | QUnit.config.autostart = false; 2 | 3 | enchant(); 4 | 5 | window.onload = function() { 6 | var core = new Core(); 7 | core.onload = function() { 8 | QUnit.start(); 9 | }; 10 | core.start(); 11 | }; 12 | 13 | module('MutableText'); 14 | 15 | test('MutableText with 1 character', function () { 16 | var m = new MutableText(0, 0); 17 | m.text = '1'; 18 | equal(m.width, 16); 19 | equal(m.height, 16); 20 | equal(m.text, '1'); 21 | }); 22 | 23 | test('MutableText with 5 characters', function () { 24 | var m = new MutableText(0, 0); 25 | m.text = '12345'; 26 | equal(m.width, 16 * 5, 'its width should equal to "fontSize * length"'); 27 | equal(m.height, 16, 'its height should equal to fontSize'); 28 | equal(m.text, '12345'); 29 | 30 | for (var i = 1; i <= 5; ++i) { 31 | m.row = i; 32 | equal(m.width, 16 * i, 'its width should equal to "fontSize * row"'); 33 | equal(m.height, 16 * Math.ceil(5 / i), 'its height should equal to "fontSize * Math.ceil(length / row)"'); 34 | } 35 | 36 | for (var i = 5; i <= 20; ++i) { 37 | m.row = i; 38 | equal(m.width, 16 * i, 'its width should equal to "fontSize * row"'); 39 | equal(m.height, 16, 'its height should equal to fontSize'); 40 | } 41 | 42 | m.row = 21; 43 | equal(m.width, 16 * 20, 'its width should equal to core.width'); 44 | equal(m.height, 16, 'its height should equal to fontSize'); 45 | }); 46 | -------------------------------------------------------------------------------- /dev/src/InputSource.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @scope enchant.InputSource.prototype 3 | */ 4 | enchant.InputSource = enchant.Class.create(enchant.EventTarget, { 5 | /** 6 | * @name enchant.InputSource 7 | * @class 8 | [lang:ja] 9 | * 任意の入力をラップするクラス. 10 | * @param {String} identifier 入力のid. 11 | [/lang] 12 | [lang:en] 13 | * Class that wrap input. 14 | * @param {String} identifier identifier of InputSource. 15 | [/lang] 16 | [lang:de] 17 | * @param {String} identifier 18 | [/lang] 19 | * @constructs 20 | * @extends enchant.EventTarget 21 | */ 22 | initialize: function(identifier) { 23 | enchant.EventTarget.call(this); 24 | /** 25 | [lang:ja] 26 | * 入力のid. 27 | [/lang] 28 | [lang:en] 29 | * identifier of InputSource. 30 | [/lang] 31 | [lang:de] 32 | [/lang] 33 | * @type String 34 | */ 35 | this.identifier = identifier; 36 | }, 37 | /** 38 | [lang:ja] 39 | * 入力の状態変更をイベントで通知する. 40 | * @param {*} data 新しい状態. 41 | [/lang] 42 | [lang:en] 43 | * Notify state change by event. 44 | * @param {*} data state. 45 | [/lang] 46 | [lang:de] 47 | * @param {*} data 48 | [/lang] 49 | */ 50 | notifyStateChange: function(data) { 51 | var e = new enchant.Event(enchant.Event.INPUT_STATE_CHANGED); 52 | e.data = data; 53 | e.source = this; 54 | this.dispatchEvent(e); 55 | } 56 | }); 57 | -------------------------------------------------------------------------------- /tests/qunit/enchant.js/group.js: -------------------------------------------------------------------------------- 1 | var game; 2 | module('Group', { 3 | setup: function () { 4 | enchant(); 5 | game = new Core(320, 320); 6 | }, 7 | teardown: function () { 8 | } 9 | }); 10 | 11 | test('Group#addChild, Group#removeChild', function () { 12 | var entity = new enchant.Entity(); 13 | var sprite = new enchant.Sprite(); 14 | 15 | var group = new enchant.Group(); 16 | 17 | equal(group.childNodes.length, 0); 18 | group.addChild(entity); 19 | equal(group.childNodes.length, 1); 20 | group.addChild(sprite); 21 | equal(group.childNodes.length, 2); 22 | 23 | equal(group.childNodes[0], entity); 24 | equal(group.childNodes[1], sprite); 25 | 26 | group.removeChild(entity); 27 | equal(group.childNodes.length, 1); 28 | group.removeChild(sprite); 29 | equal(group.childNodes.length, 0); 30 | }); 31 | 32 | test('enterframe Event Propagation (group in group)', function () { 33 | var entity = new enchant.Entity(); 34 | var sprite = new enchant.Sprite(); 35 | 36 | var group = new enchant.Group(); 37 | var child_group = new enchant.Group(); 38 | 39 | var child_sprite = new enchant.Sprite(); 40 | 41 | group.addChild(entity); 42 | group.addChild(sprite); 43 | group.addChild(child_group); 44 | child_group.addChild(child_sprite); 45 | 46 | game.rootScene.addChild(group); 47 | game._tick(); 48 | 49 | equal(entity.age, 1); 50 | equal(sprite.age, 1); 51 | equal(group.age, 1); 52 | equal(child_group.age, 1); 53 | equal(child_sprite.age, 1); 54 | }); 55 | -------------------------------------------------------------------------------- /doc/template/subtemplates/menu.tmpl: -------------------------------------------------------------------------------- 1 |
              2 | 23 |
              24 | ©{+JSDOC.opt.D.copyright+}
              25 | Documentation generator: JsDoc Toolkit {+JSDOC.VERSION+}
              26 | Template: {+publish.conf.templateName+} {+publish.conf.templateVersion+}
              27 | Generated on: {! 28 | var date = new Date(); 29 | var minutes = date.getMinutes() +""; 30 | if (minutes.length == 1) { 31 | minutes = '0'+ minutes; 32 | } 33 | output += date.getFullYear() +"-"+ date.getMonth() +"-"+ date.getDate() +" "+ date.getHours() +":"+ minutes; 34 | !} 35 |
              36 |
              37 | 38 |
              39 | -------------------------------------------------------------------------------- /examples/beginner/new_class/main.js: -------------------------------------------------------------------------------- 1 | enchant(); 2 | window.onload = function() { 3 | var game = new Game(320, 320); 4 | game.enemy_speed = 1; 5 | game.preload('chara1.png', 'map0.png'); 6 | 7 | var Bear = enchant.Class.create(enchant.Sprite, { 8 | initialize: function(x, y) { 9 | enchant.Sprite.call(this, 32, 32); 10 | this.x = x; 11 | this.y = y; 12 | this.image = game.assets['chara1.png']; 13 | this.frame = 5; 14 | game.rootScene.addChild(this); 15 | } 16 | }); 17 | 18 | var Enemy = enchant.Class.create(Bear, { 19 | initialize: function(x, y) { 20 | Bear.call(this, x, y); 21 | this.addEventListener('enterframe', function() { 22 | this.x += game.enemy_speed; 23 | this.frame = [0, 1, 0, 2][Math.floor(this.age/5) % 4] + 5; 24 | }); 25 | } 26 | }); 27 | 28 | var Treasure = enchant.Class.create(enchant.Sprite, { 29 | initialize: function(x, y) { 30 | enchant.Sprite.call(this, 16, 16); 31 | this.x = x; 32 | this.y = y; 33 | this.image = game.assets['map0.png']; 34 | this.frame = 0; 35 | game.rootScene.addChild(this); 36 | } 37 | }); 38 | 39 | game.onload = function() { 40 | game.rootScene.addEventListener('enterframe', function() { 41 | if(this.age % 20 == 0){ 42 | var enemy = new Enemy(0, rand(320)); 43 | } 44 | }); 45 | }; 46 | 47 | game.start(); 48 | }; 49 | 50 | function rand(num){ return Math.floor(Math.random() * num) }; -------------------------------------------------------------------------------- /examples/plugins/canvas/main.js: -------------------------------------------------------------------------------- 1 | enchant(); 2 | 3 | var game; 4 | 5 | window.onload = function () { 6 | game = new Game(320, 320); 7 | game.fps = 30; 8 | game.preload('chara1.gif'); 9 | game.onload = function () { 10 | 11 | // CanvasGroup に addChild されたノードは canvas上で描画されます。 12 | // 回転や拡大縮小などを含む場合、DOMよりも高速な描画が可能です。 13 | // enchant.js v0.7では、特に宣言のないGroupはCanvasによって描画されます。 14 | var canvasGroup = new Group(); 15 | game.rootScene.addChild(canvasGroup); 16 | 17 | function addBear () { 18 | var bear = new Sprite(32, 32); 19 | bear.image = game.assets['chara1.gif']; 20 | canvasGroup.addChild(bear); 21 | bear.frame = 5; 22 | bear.vx = 3; 23 | bear.vy = 2; 24 | bear.vs = 0.01; 25 | bear.onenterframe = function(){ 26 | this.x += this.vx; 27 | this.y += this.vy; 28 | if(this.x > 288 || this.x < 0){ 29 | this.vx *= -1; 30 | this.vs *= -1; 31 | } 32 | if(this.y > 288 || this.y < 0){ 33 | this.vy *= -1; 34 | this.vs *= -1; 35 | } 36 | this.rotation += 5; 37 | this.scaleX += this.vs; 38 | this.scaleY += this.vs; 39 | }; 40 | return bear; 41 | } 42 | addBear(); 43 | 44 | // クリックするとクマが登場 45 | game.rootScene.addEventListener('touchend', function(evt){ 46 | var bear = addBear(); 47 | bear.moveTo(evt.localX, evt.localY); 48 | }) 49 | }; 50 | game.start(); 51 | }; 52 | -------------------------------------------------------------------------------- /examples/plugins/widget/Check_Text/main.js: -------------------------------------------------------------------------------- 1 | enchant(); 2 | window.onload = function() { 3 | var game = new Game(320, 320); 4 | game.onload = function() { 5 | //選択肢を作成する 6 | var select = { 7 | male: '男', 8 | female: '女' 9 | }; 10 | /* 11 | * new InputSelectBox(option) 12 | * セレクトボックスを作成する。 13 | * 選択できる項目を設定する。 14 | */ 15 | var inputSelectBox = new InputSelectBox(select); // セレクトボックスを作成 16 | game.rootScene.addChild(inputSelectBox); 17 | 18 | /* 19 | * new InputCheckBox(value, text, checked) 20 | * チェックボックスを作成する。 21 | * 値、ラベルテキスト、チェックされているかどうかを設定する。 22 | */ 23 | var inputCheckBox1 = new InputCheckBox('tv', 'テレビで知った。'); // チェックボックスを作成 24 | inputCheckBox1.y = 48; 25 | game.rootScene.addChild(inputCheckBox1); 26 | var inputCheckBox2 = new InputCheckBox('web', 'WEBで知った。'); 27 | inputCheckBox2.y = 48 * 2; 28 | game.rootScene.addChild(inputCheckBox2); 29 | 30 | /* 31 | * new InputTextBox() 32 | * テキストボックスを作成する。 33 | * 一行でテキスト入力を行う。 34 | */ 35 | var inputTextBox = new InputTextBox(); // テキストボックスを作成 36 | inputTextBox.x = 8; 37 | inputTextBox.y = 48 * 3; 38 | game.rootScene.addChild(inputTextBox); 39 | 40 | /* 41 | * new InputTextArea() 42 | * テキストエリアを作成する。 43 | * 複数行でテキスト入力を行う。 44 | */ 45 | var inputTextArea = new InputTextArea(); // テキストエリアを作成 46 | inputTextArea.width = 300; 47 | inputTextArea.height = 100; 48 | inputTextArea.x = 8; 49 | inputTextArea.y = 48 * 4; 50 | game.rootScene.addChild(inputTextArea); 51 | }; 52 | game.start(); 53 | }; 54 | -------------------------------------------------------------------------------- /examples/plugins/mixing/spritelabel/main.js: -------------------------------------------------------------------------------- 1 | enchant(); 2 | var Description = enchant.Class.create(enchant.Label, { 3 | initialize: function(text,x,y) { 4 | enchant.Label.call(this,text); 5 | this.x = x; 6 | this.y = y; 7 | enchant.Game.instance.rootScene.addChild(this); 8 | } 9 | }); 10 | window.onload = function(){ 11 | var game = new Game(320, 320); 12 | game.fps = 15; 13 | game.preload("chara1.png"); 14 | game.onload = function(){ 15 | new Description("I'm a Sprite:",0,0); 16 | new Description("I'm a Label:",0,70); 17 | new Description("I'm a Sprite mixed with a Label:",0,150); 18 | var kuma = new Sprite(32, 32); 19 | kuma.image = game.assets["chara1.png"]; 20 | kuma.x = 0; 21 | kuma.y = 20; 22 | kuma.frame = [5,5,6,6,5,5,7,7]; 23 | kuma.tl.moveTo(game.width-50,kuma.y,100).scaleTo(-1,1,1).moveTo(0,kuma.y,100).scaleTo(1,1,1).loop(); 24 | game.rootScene.addChild(kuma); 25 | var label = new Label('Kuma'); 26 | label.x = 0; 27 | label.y = 90; 28 | label.color = 'red'; 29 | label.font = '12px Arial'; 30 | game.rootScene.addChild(label); 31 | 32 | 33 | 34 | var SpriteLabel = enchant.Class.mixClasses(Sprite, Label,true); 35 | var kumaLabel = new SpriteLabel(32,32,'Kuma'); 36 | kumaLabel.color = 'red'; 37 | kumaLabel.font = '12px Arial'; 38 | kumaLabel.image = game.assets["chara1.png"]; 39 | kumaLabel.x = 0; 40 | kumaLabel.y = 170; 41 | kumaLabel.frame = [5,5,6,6,5,5,7,7]; 42 | kumaLabel.tl.moveTo(game.width-50,kumaLabel.y,100).scaleTo(-1,1,1).moveTo(0,kumaLabel.y,100).scaleTo(1,1,1).loop(); 43 | game.rootScene.addChild(kumaLabel); 44 | }; 45 | game.start(); 46 | }; -------------------------------------------------------------------------------- /examples/plugins/gl/mmd/main.js: -------------------------------------------------------------------------------- 1 | enchant(); 2 | 3 | var game; 4 | 5 | // PMDファイルのパス 6 | var MODEL_PATH = 'model/Miku_Hatsune_Metal.pmd'; 7 | 8 | // VMDファイルのパス 9 | var MOTION_PATH = 'motion/kishimen.vmd'; 10 | 11 | window.onload = function(){ 12 | game = new Game(800, 800); 13 | // v0.2.1よりgame.preloadから読み込めるようになった. 14 | game.preload(MODEL_PATH, MOTION_PATH); 15 | game.onload = function() { 16 | 17 | var scene = new Scene3D(); 18 | scene.backgroundColor = '#ffffff'; 19 | 20 | var camera = scene.getCamera(); 21 | camera.y = 20; 22 | camera.z = 80; 23 | camera.centerY = 10; 24 | 25 | // PMDファイル読み込み. 26 | // colladaの読み込みと同様にcloneかsetして使用する. 27 | var miku = game.assets[MODEL_PATH].clone(); 28 | scene.addChild(miku); 29 | 30 | // VMDファイル読み込み 31 | miku.pushAnimation(game.assets[MOTION_PATH]); 32 | 33 | var oldX = 0; 34 | r = Math.PI / 2; 35 | game.rootScene.addEventListener('touchstart', function(e) { 36 | oldX = e.x; 37 | }); 38 | game.rootScene.addEventListener('touchmove', function(e) { 39 | r += (e.x - oldX) / 100; 40 | camera.x = Math.cos(r) * 80; 41 | camera.z = Math.sin(r) * 80; 42 | oldX = e.x; 43 | }); 44 | 45 | var label = new Label('0'); 46 | label.font = '24px helvetica'; 47 | game.rootScene.addChild(label); 48 | var c = 0; 49 | setInterval(function() { 50 | label.text = c; 51 | c = 0; 52 | }, 1000); 53 | game.rootScene.addEventListener('enterframe', function(e) { 54 | c++; 55 | }); 56 | 57 | }; 58 | game.start(); 59 | }; 60 | -------------------------------------------------------------------------------- /examples/windows8/App4/enchant/main.js: -------------------------------------------------------------------------------- 1 | enchant(); 2 | window.onload = function () { 3 | console.log('hello enchant.js'); 4 | var game = new Game(320, 320); 5 | game.preload('i.png', 'c.png', 'e.png', '4.png'); 6 | game.onload = function(){ 7 | var back = new Sprite(320, 320); 8 | back.image = game.assets['e.png']; 9 | back.addEventListener('enterframe', function(){ 10 | this.y += 3 + (game.frame / 100); 11 | if(this.y > 320){ 12 | this.y = -320; 13 | } 14 | }); 15 | game.rootScene.addChild(back); 16 | 17 | var car = new Sprite(32, 32); 18 | car.image = game.assets['4.png']; 19 | car.y = 280; 20 | game.rootScene.addChild(car); 21 | 22 | game.rootScene.addEventListener('touchmove', function(e){ 23 | car.x = (2 * car.x + e.x) / 3; 24 | }); 25 | game.rootScene.addEventListener('enterframe', function(){ 26 | if(Math.random() < 0.05){ 27 | var bear = new Sprite(32, 32); 28 | bear.image = game.assets['c.png']; 29 | bear.x = Math.random() * 320; 30 | bear.frame = 15; 31 | bear.y = -32; 32 | bear.addEventListener('enterframe', function(){ 33 | this.y += 3 + (game.frame / 100); 34 | if(this.within(car, 20)){ 35 | this.frame = 18; 36 | game.end(); 37 | } 38 | }); 39 | game.rootScene.addChild(bear); 40 | } 41 | }); 42 | } 43 | game.start(); 44 | } 45 | 46 | window.addEventListener('message', function (e) { 47 | console.log(e); 48 | }); -------------------------------------------------------------------------------- /examples/windows8/sample-app/enchant/main.js: -------------------------------------------------------------------------------- 1 | enchant(); 2 | window.onload = function () { 3 | console.log('hello enchant.js'); 4 | var game = new Game(320, 320); 5 | game.preload('i.png', 'c.png', 'e.png', '4.png'); 6 | game.onload = function(){ 7 | var back = new Sprite(320, 320); 8 | back.image = game.assets['e.png']; 9 | back.addEventListener('enterframe', function(){ 10 | this.y += 3 + (game.frame / 100); 11 | if(this.y > 320){ 12 | this.y = -320; 13 | } 14 | }); 15 | game.rootScene.addChild(back); 16 | 17 | var car = new Sprite(32, 32); 18 | car.image = game.assets['4.png']; 19 | car.y = 280; 20 | game.rootScene.addChild(car); 21 | 22 | game.rootScene.addEventListener('touchmove', function(e){ 23 | car.x = (2 * car.x + e.x) / 3; 24 | }); 25 | game.rootScene.addEventListener('enterframe', function(){ 26 | if(Math.random() < 0.05){ 27 | var bear = new Sprite(32, 32); 28 | bear.image = game.assets['c.png']; 29 | bear.x = Math.random() * 320; 30 | bear.frame = 15; 31 | bear.y = -32; 32 | bear.addEventListener('enterframe', function(){ 33 | this.y += 3 + (game.frame / 100); 34 | if(this.within(car, 20)){ 35 | this.frame = 18; 36 | game.end(); 37 | } 38 | }); 39 | game.rootScene.addChild(bear); 40 | } 41 | }); 42 | } 43 | game.start(); 44 | } 45 | 46 | window.addEventListener('message', function (e) { 47 | console.log(e); 48 | }); -------------------------------------------------------------------------------- /examples/plugins/telepathy/main.js: -------------------------------------------------------------------------------- 1 | enchant(); 2 | 3 | window.onload = function() { 4 | var CHANNEL = 'enchant_chat_example_0'; 5 | var lines = []; 6 | var core = new enchant.Core(320, 320); 7 | core.onload = function() { 8 | var sense = new enchant.telepathy.TelepathySense(); 9 | sense.onerror = function(evt) { 10 | console.log(evt.message); 11 | }; 12 | 13 | var name = new enchant.Label('User' + ('0' + Math.floor(Math.random() * 100)).slice(-2)); 14 | name.backgroundColor = '#a0a0a0'; 15 | name.height = 16; 16 | name.ontouchend = function() { 17 | name.text = prompt('name', this.text); 18 | }; 19 | 20 | var output = new enchant.Label(''); 21 | output.height = 16; 22 | output.y = 16; 23 | output.ontelepathy = function(evt) { 24 | lines.push( 25 | '(' + (new Date(evt.data.time)).toLocaleTimeString() + ')' + 26 | evt.data.name + ':' + evt.data.text); 27 | lines = lines.slice(-18); 28 | this.text = lines.join('
              '); 29 | }; 30 | 31 | var send = new enchant.Label('New message'); 32 | send.backgroundColor = '#a0a0a0'; 33 | send.height = 16; 34 | send.y = 320 - 16; 35 | send.ontouchend = function() { 36 | var text = prompt('message', ''); 37 | sense.send(CHANNEL, { 38 | time: Date.now(), 39 | name: name.text, 40 | text: text 41 | }); 42 | }; 43 | 44 | core.rootScene.addChild(name); 45 | core.rootScene.addChild(send); 46 | core.rootScene.addChild(output); 47 | 48 | sense.open(CHANNEL); 49 | sense.addChanneler(CHANNEL, output); 50 | }; 51 | core.start(); 52 | }; 53 | -------------------------------------------------------------------------------- /examples/windows8/sample-app/js/default.js: -------------------------------------------------------------------------------- 1 | // 空白のテンプレートの概要については、次のドキュメントを参照してください: 2 | // http://go.microsoft.com/fwlink/?LinkId=232509 3 | (function () { 4 | "use strict"; 5 | 6 | function updateView() { 7 | var frame = document.getElementById('frame'); 8 | var width = parseInt(frame.getAttribute('width')); 9 | var height = parseInt(frame.getAttribute('height')); 10 | var size = Math.min(window.innerWidth / width, window.innerHeight / height); 11 | frame.style.left = (window.innerWidth - width * size) / 2 + 'px'; 12 | frame.style.top = (window.innerHeight - height * size) / 2 + 'px'; 13 | frame.style.msTransformOrigin = '0px 0px'; 14 | frame.style.msTransform = 'scale(' + size + ',' + size + ')'; 15 | } 16 | 17 | WinJS.Binding.optimizeBindingReferences = true; 18 | 19 | var app = WinJS.Application; 20 | var activation = Windows.ApplicationModel.Activation; 21 | 22 | app.onactivated = function (args) { 23 | if (args.detail.kind === activation.ActivationKind.launch) { 24 | if (args.detail.previousExecutionState !== activation.ApplicationExecutionState.terminated) { 25 | var frame = document.getElementById('frame'); 26 | frame.onload = function () { 27 | frame.contentWindow.postMessage('hello', '*'); 28 | }; 29 | frame.src = 'enchant/index.html'; 30 | updateView(); 31 | } else { 32 | updateView(); 33 | } 34 | args.setPromise(WinJS.UI.processAll()); 35 | } 36 | }; 37 | 38 | window.onresize = function () { 39 | updateView(); 40 | } 41 | 42 | app.oncheckpoint = function (args) { 43 | }; 44 | 45 | app.start(); 46 | })(); 47 | -------------------------------------------------------------------------------- /examples/windows8/sample-app/bin/Debug/AppX/js/default.js: -------------------------------------------------------------------------------- 1 | // 空白のテンプレートの概要については、次のドキュメントを参照してください: 2 | // http://go.microsoft.com/fwlink/?LinkId=232509 3 | (function () { 4 | "use strict"; 5 | 6 | function updateView() { 7 | var frame = document.getElementById('frame'); 8 | var width = parseInt(frame.getAttribute('width')); 9 | var height = parseInt(frame.getAttribute('height')); 10 | var size = Math.min(window.innerWidth / width, window.innerHeight / height); 11 | frame.style.left = (window.innerWidth - width * size) / 2 + 'px'; 12 | frame.style.top = (window.innerHeight - height * size) / 2 + 'px'; 13 | frame.style.msTransformOrigin = '0px 0px'; 14 | frame.style.msTransform = 'scale(' + size + ',' + size + ')'; 15 | } 16 | 17 | WinJS.Binding.optimizeBindingReferences = true; 18 | 19 | var app = WinJS.Application; 20 | var activation = Windows.ApplicationModel.Activation; 21 | 22 | app.onactivated = function (args) { 23 | if (args.detail.kind === activation.ActivationKind.launch) { 24 | if (args.detail.previousExecutionState !== activation.ApplicationExecutionState.terminated) { 25 | var frame = document.getElementById('frame'); 26 | frame.onload = function () { 27 | frame.contentWindow.postMessage('hello', '*'); 28 | }; 29 | frame.src = 'enchant/index.html'; 30 | updateView(); 31 | } else { 32 | updateView(); 33 | } 34 | args.setPromise(WinJS.UI.processAll()); 35 | } 36 | }; 37 | 38 | window.onresize = function () { 39 | updateView(); 40 | } 41 | 42 | app.oncheckpoint = function (args) { 43 | }; 44 | 45 | app.start(); 46 | })(); 47 | -------------------------------------------------------------------------------- /examples/plugins/wiiu/main.js: -------------------------------------------------------------------------------- 1 | enchant(); 2 | 3 | 4 | /** 5 | * emulation wii u 6 | */ 7 | 8 | if(!window.wiiu){ 9 | window.wiiu = {gamepad: {}}; 10 | window.wiiu.gamepad.update = function() { 11 | var keyEventTable = { 12 | 'a': 0x8000, 13 | 'b': 0x4000, 14 | 'x': 0x2000, 15 | 'y': 0x1000, 16 | 'l': 0x0020, 17 | 'r': 0x0010, 18 | 'zl': 0x0080, 19 | 'zr': 0x0040, 20 | 'up': 0x0200, 21 | 'down': 0x0100, 22 | 'right': 0x0800, 23 | 'left': 0x0400 24 | }; 25 | return { 26 | 'isEnabled': 1, 27 | 'isDataValid': 1, 28 | 'tpTouch': 1, 29 | 'tpValidity': 0, 30 | 'lStickX': 0.7, 31 | 'lStickY': 0.3, 32 | 'rStickX': -0.3, 33 | 'rStickY': 0.7, 34 | 'hold': 0x00 35 | }; 36 | }; 37 | 38 | } 39 | 40 | window.onload = function() { 41 | var game = new Game(854/2, 448/2); 42 | game.preload('chara1.png'); 43 | 44 | game.onload = function() { 45 | var bear = new Sprite(32, 32); 46 | 47 | bear.image = game.assets['chara1.png']; 48 | bear.frame = 0; 49 | bear.moveTo(100, 160); 50 | bear.on('enterframe', function() { 51 | this.x += game.input.rstick.x * 10; 52 | this.y += game.input.rstick.y * 10; 53 | }); 54 | game.rootScene.addChild(bear); 55 | 56 | var white = new Sprite(32, 32); 57 | white.image = game.assets['chara1.png']; 58 | white.frame = 5; 59 | white.moveTo(140, 160); 60 | white.on('enterframe', function() { 61 | this.x += game.input.lstick.x * 10; 62 | this.y += game.input.lstick.y * 10; 63 | }); 64 | game.rootScene.addChild(white); 65 | }; 66 | game.start(); 67 | }; -------------------------------------------------------------------------------- /examples/expert/timeline/main.js: -------------------------------------------------------------------------------- 1 | enchant(); 2 | 3 | window.onload = function(){ 4 | game = new Game(320, 320); 5 | game.preload(); 6 | game.fps = 30; 7 | game.onload = function(){ 8 | sprites = []; 9 | for(var i = 0; i < 9; i++){ 10 | var sp = new Sprite(16, 16); 11 | sp.backgroundColor = "red"; 12 | sp.x = 32; 13 | sp.y = 30 * i + 32; 14 | sprites.push(sp); 15 | game.rootScene.addChild(sp); 16 | } 17 | 18 | sprites[0].addEventListener("touchstart", function(){ 19 | this.tl.moveBy(200, 0, 60, enchant.Easing.LINEAR); 20 | }); 21 | sprites[1].addEventListener("touchstart", function(){ 22 | this.tl.moveBy(200, 0, 60, enchant.Easing.QUINT_EASEOUT); 23 | }); 24 | sprites[2].addEventListener("touchstart", function(){ 25 | this.tl.moveBy(200, 0, 60, enchant.Easing.QUINT_EASEIN); 26 | }); 27 | sprites[3].addEventListener("touchstart", function(){ 28 | this.tl.moveBy(200, 0, 60, enchant.Easing.QUINT_EASEINOUT); 29 | }); 30 | sprites[4].addEventListener("touchstart", function(){ 31 | this.tl.moveBy(20, 0, 10, enchant.Easing.QUINT_EASEINOUT).delay(30); 32 | this.tl.looped = true; 33 | }); 34 | sprites[5].addEventListener("touchstart", function(){ 35 | this.tl.moveBy(200, 0, 60, enchant.Easing.BOUNCE_EASEOUT).moveBy(-200, 0, 60, enchant.Easing.BACK_EASEOUT); 36 | }); 37 | sprites[6].addEventListener("touchstart", function(){ 38 | this.tl.fadeOut(30).delay(30).fadeIn(30); 39 | }); 40 | sprites[7].addEventListener("touchstart", function(){ 41 | this.tl.scaleTo(3, 30, enchant.Easing.BOUNCE_EASEOUT).scaleTo(1, 60); 42 | }); 43 | sprites[8].addEventListener("touchstart", function(){ 44 | this.tl.rotateBy(720, 300, enchant.Easing.QUINT_EASEOUT); 45 | }); 46 | } 47 | game.start(); 48 | } 49 | 50 | -------------------------------------------------------------------------------- /tests/mocha/enchant.js/test_dom-scene.js: -------------------------------------------------------------------------------- 1 | describe("DomScene", function(){ 2 | var core, domScene; 3 | 4 | beforeEach(function(){ 5 | enchant(); 6 | core = new Core(); 7 | domScene = new DOMScene(); 8 | }); 9 | 10 | afterEach(function(){ 11 | core = null; 12 | domScene = null; 13 | }); 14 | 15 | it("makes DomScene", function(){ 16 | expect(domScene._layers['Dom']).to.exist; 17 | }); 18 | 19 | it("#_determineEventTarget returns target which is affected by event", function(){ 20 | var target = domScene._determineEventTarget(new enchant.Event("touchstart")); 21 | expect(target).to.equal(domScene); 22 | var sprite = new Sprite(); 23 | var stub = sinon.stub(domScene._layers.Dom, "_determineEventTarget"); 24 | stub.returns(sprite); 25 | target = domScene._determineEventTarget(new enchant.Event("touchstart")); 26 | expect(target).to.equal(sprite); 27 | }); 28 | 29 | it("adds layer to child when childadded event occurred", function(){ 30 | core.pushScene(domScene); 31 | var sprite = new Sprite(); 32 | var callback = sinon.spy(); 33 | domScene.addEventListener(enchant.Event.CHILD_ADDED, callback); 34 | domScene.addChild(sprite); 35 | expect(callback.called).to.be.true; 36 | expect(domScene._layers.Dom.lastChild).to.deep.equal(sprite); 37 | }); 38 | 39 | it("starts rendering when the scene started", function(){ 40 | var stub = sinon.stub(domScene._layers.Dom, "_startRendering"); 41 | expect(stub.called).to.be.false; 42 | domScene.dispatchEvent(new enchant.Event("enter")); 43 | expect(stub.called).to.be.true; 44 | }); 45 | 46 | it("stops rendering when the scene stops", function(){ 47 | var stub = sinon.stub(domScene._layers.Dom, "_stopRendering"); 48 | expect(stub.called).to.be.false; 49 | domScene.dispatchEvent(new enchant.Event("exit")); 50 | expect(stub.called).to.be.true; 51 | }); 52 | }); -------------------------------------------------------------------------------- /examples/windows8/sample-app/bin/Debug/AppxManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 10 | 11 | 12 | App4 13 | chephes 14 | images\storelogo.png 15 | 16 | 17 | 6.2.1 18 | 6.2.1 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | -------------------------------------------------------------------------------- /examples/windows8/sample-app/bin/Debug/AppX/AppxManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 10 | 11 | 12 | App4 13 | chephes 14 | images\storelogo.png 15 | 16 | 17 | 6.2.1 18 | 6.2.1 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | -------------------------------------------------------------------------------- /tests/mocha/enchant.js/test_canvas-scene.js: -------------------------------------------------------------------------------- 1 | describe("CanvasScene", function(){ 2 | var core, canvasScene; 3 | 4 | beforeEach(function(){ 5 | enchant(); 6 | core = new Core(); 7 | canvasScene = new CanvasScene(); 8 | }); 9 | 10 | afterEach(function(){ 11 | core = null; 12 | canvasScene = null; 13 | }); 14 | 15 | it("makes CanvasScene", function(){ 16 | expect(canvasScene._layers["Canvas"]).to.exist; 17 | }); 18 | 19 | it("#_determineEventTarget returns target which is affected by event", function(){ 20 | var target = canvasScene._determineEventTarget(new enchant.Event("touchstart")); 21 | expect(target).to.equal(canvasScene); 22 | var sprite = new Sprite(); 23 | var stub = sinon.stub(canvasScene._layers.Canvas, "_determineEventTarget"); 24 | stub.returns(sprite); 25 | target = canvasScene._determineEventTarget(new enchant.Event("touchstart")); 26 | expect(target).to.equal(sprite); 27 | }); 28 | 29 | it("adds layer to child when childadded event occurred", function(){ 30 | core.pushScene(canvasScene); 31 | var sprite = new Sprite(); 32 | var callback = sinon.spy(); 33 | canvasScene.addEventListener(enchant.Event.CHILD_ADDED, callback); 34 | canvasScene.addChild(sprite); 35 | expect(callback.called).to.be.true; 36 | expect(canvasScene._layers.Canvas.lastChild).to.deep.equal(sprite); 37 | }); 38 | 39 | it("starts rendering when the scene started", function(){ 40 | var stub = sinon.stub(canvasScene._layers.Canvas, "_startRendering"); 41 | expect(stub.called).to.be.false; 42 | canvasScene.dispatchEvent(new enchant.Event("enter")); 43 | expect(stub.called).to.be.true; 44 | }); 45 | 46 | it("stops rendering when the scene stops", function(){ 47 | var stub = sinon.stub(canvasScene._layers.Canvas, "_stopRendering"); 48 | expect(stub.called).to.be.false; 49 | canvasScene.dispatchEvent(new enchant.Event("exit")); 50 | expect(stub.called).to.be.true; 51 | }); 52 | }); -------------------------------------------------------------------------------- /dev/src/DetectColorManager.js: -------------------------------------------------------------------------------- 1 | enchant.DetectColorManager = enchant.Class.create({ 2 | initialize: function(reso, max) { 3 | this.reference = []; 4 | this.colorResolution = reso || 16; 5 | this.max = max || 1; 6 | this.capacity = Math.pow(this.colorResolution, 3); 7 | for (var i = 1, l = this.capacity; i < l; i++) { 8 | this.reference[i] = null; 9 | } 10 | }, 11 | attachDetectColor: function(sprite) { 12 | var i = this.reference.indexOf(null); 13 | if (i === -1) { 14 | i = 1; 15 | } 16 | this.reference[i] = sprite; 17 | return this._getColor(i); 18 | }, 19 | detachDetectColor: function(sprite) { 20 | var i = this.reference.indexOf(sprite); 21 | if (i !== -1) { 22 | this.reference[i] = null; 23 | } 24 | }, 25 | _getColor: function(n) { 26 | var C = this.colorResolution; 27 | var d = C / this.max; 28 | return [ 29 | parseInt((n / C / C) % C, 10) / d, 30 | parseInt((n / C) % C, 10) / d, 31 | parseInt(n % C, 10) / d, 32 | 1.0 33 | ]; 34 | }, 35 | _decodeDetectColor: function(color, i) { 36 | i = i || 0; 37 | var C = this.colorResolution; 38 | return ~~(color[i] * C * C * C / 256) + 39 | ~~(color[i + 1] * C * C / 256) + 40 | ~~(color[i + 2] * C / 256); 41 | }, 42 | getSpriteByColor: function(color) { 43 | return this.reference[this._decodeDetectColor(color)]; 44 | }, 45 | getSpriteByColors: function(rgba) { 46 | var i, l, id, result, 47 | score = 0, 48 | found = {}; 49 | 50 | for (i = 0, l = rgba.length; i < l; i+= 4) { 51 | id = this._decodeDetectColor(rgba, i); 52 | found[id] = (found[id] || 0) + 1; 53 | } 54 | for (id in found) { 55 | if (found[id] > score) { 56 | score = found[id]; 57 | result = id; 58 | } 59 | } 60 | 61 | return this.reference[result]; 62 | } 63 | }); 64 | -------------------------------------------------------------------------------- /examples/plugins/box2d/main.js: -------------------------------------------------------------------------------- 1 | enchant(); 2 | 3 | var game, physicsWorld; 4 | 5 | window.onload = function () { 6 | game = new Game(320, 320); 7 | game.fps = 30; 8 | game.preload("chara1.gif", "icon1.png", "map2.gif"); 9 | game.onload = function () { 10 | physicsWorld = new PhysicsWorld(0, 9.8); 11 | 12 | for(var i = 0; i < 20; i++){ 13 | //床を生成 14 | var floor = new PhyBoxSprite(16, 16, enchant.box2d.STATIC_SPRITE, 1.0, 0.5, 0.3, true); 15 | floor.image = game.assets["map2.gif"]; 16 | floor.frame = 2; 17 | floor.position = { x: i*16, y: 300 }; 18 | game.rootScene.addChild(floor); 19 | } 20 | 21 | game.rootScene.addEventListener("enterframe", function () { 22 | physicsWorld.step(game.fps); 23 | if(game.frame % game.fps == 0){ 24 | //ボールを生成 25 | var ball = new PhyCircleSprite(8, enchant.box2d.DYNAMIC_SPRITE, 1.0, 0.5, 0.2, true); 26 | ball.image = game.assets["icon1.png"]; 27 | ball.frame = 4; 28 | ball.position = { x: 0, y: 120 }; 29 | ball.applyImpulse(new b2Vec2(Math.random(), 0)); 30 | game.rootScene.addChild(ball); 31 | ball.addEventListener("enterframe", function(){ 32 | if(ball > 320)ball.destroy(); 33 | }) 34 | } 35 | }); 36 | game.rootScene.addEventListener("touchstart", function (evt) { 37 | //ボールを生成 38 | var ball = new PhyCircleSprite(8, enchant.box2d.DYNAMIC_SPRITE, 1.0, 0.5, 0.2, true); 39 | ball.image = game.assets["icon1.png"]; 40 | ball.frame = 3; 41 | ball.position = { x: evt.x, y: evt.y }; 42 | ball.applyImpulse(new b2Vec2(Math.random() * 0.1, 0)); 43 | game.rootScene.addChild(ball); 44 | ball.addEventListener("enterframe", function(){ 45 | if(ball > 320)ball.destroy(); 46 | }) 47 | 48 | 49 | }); 50 | 51 | 52 | }; 53 | game.start(); 54 | }; 55 | -------------------------------------------------------------------------------- /examples/plugins/gl/bounding/main.js: -------------------------------------------------------------------------------- 1 | enchant(); 2 | var game; 3 | window.onload = function() { 4 | game = new Game(320, 320); 5 | game.preload('../../../../images/enchant-sphere.png'); 6 | game.onload = function() { 7 | /** 8 | * 3D用のシーンを定義する. 9 | * Sprite3DはScene3Dに追加することで画面に表示される. 10 | */ 11 | var scene = new Scene3D(); 12 | /** 13 | * 球体型のオブジェクトをつくる. 14 | * primitive.gl.enchant.js内のクラスを使用している. 15 | * primitive.gl.enchant.js内定義されている基本図形はSprite3Dを継承している. 16 | */ 17 | var ball = new Sphere(); 18 | /** 19 | * テクスチャを設定する. 20 | * Sprite3Dのmeshプロパティが表示上の実体となる. 21 | * テクスチャのソースはpreloadでロードしたデータの他に, canvasオブジェクト, imageオブジェクト, 画像のURLを表す文字列が使用できる. 22 | */ 23 | ball.mesh.texture.src = game.assets['../../../../images/enchant-sphere.png']; 24 | ball.z = -20; 25 | 26 | ball.addEventListener('enterframe', function(e) { 27 | /** 28 | * オブジェクトを回転させる. 29 | * rotateYawはオブジェクトのY軸回転. 30 | */ 31 | this.rotateYaw(0.01); 32 | }); 33 | scene.addChild(ball); 34 | 35 | var cube = new Cube(); 36 | cube.z = 0; 37 | cube.vz = -0.1; 38 | 39 | cube.addEventListener('enterframe', function(e) { 40 | /** 41 | * オブジェクトを回転させる. 42 | * rotateRollはオブジェクトのZ軸回転. 43 | */ 44 | this.rotateYaw(0.01); 45 | this.rotateRoll(0.01); 46 | this.z += cube.vz; 47 | /** 48 | * オブジェクト同士の当たり判定を計算する. 49 | * 当たり判定は Sprite3D が持つ Bounding オブジェクト同士で行われる. 50 | * Bounding オブジェクトを変えることで当たり判定の方法を変更することができる. 51 | */ 52 | if (this.intersect(ball)) { 53 | cube.vz = -cube.vz; 54 | console.log('hit!'); 55 | } 56 | if (this.z > 0) { 57 | cube.vz = -cube.vz; 58 | } 59 | }); 60 | scene.addChild(cube); 61 | }; 62 | game.start(); 63 | }; 64 | -------------------------------------------------------------------------------- /tests/raster/hellobear/ui.enchant.js: -------------------------------------------------------------------------------- 1 | enchant.ui = { assets: ['pad.png'] }; 2 | enchant.ui.Pad = enchant.Class.create(enchant.Sprite, { 3 | initialize: function() { 4 | var game = enchant.Game.instance; 5 | var image = game.assets['pad.png']; 6 | enchant.Sprite.call(this, image.width / 2, image.height); 7 | this.image = image; 8 | this.input = { left: false, right: false, up: false, down:false }; 9 | this.addEventListener('touchstart', function(e) { 10 | this._updateInput(this._detectInput(e.localX, e.localY)); 11 | }); 12 | this.addEventListener('touchmove', function(e) { 13 | this._updateInput(this._detectInput(e.localX, e.localY)); 14 | }); 15 | this.addEventListener('touchend', function(e) { 16 | this._updateInput({ left: false, right: false, up: false, down:false }); 17 | }); 18 | }, 19 | _detectInput: function(x, y) { 20 | x -= this.width / 2; 21 | y -= this.height / 2; 22 | var input = { left: false, right: false, up: false, down:false }; 23 | if (x * x + y * y > 200) { 24 | if (x < 0 && y < x * x * 0.1 && y > x * x * -0.1) { 25 | input.left = true; 26 | } 27 | if (x > 0 && y < x * x * 0.1 && y > x * x * -0.1) { 28 | input.right = true; 29 | } 30 | if (y < 0 && x < y * y * 0.1 && x > y * y * -0.1) { 31 | input.up = true; 32 | } 33 | if (y > 0 && x < y * y * 0.1 && x > y * y * -0.1) { 34 | input.down = true; 35 | } 36 | } 37 | return input; 38 | }, 39 | _updateInput: function(input) { 40 | var game = enchant.Game.instance; 41 | ['left', 'right', 'up', 'down'].forEach(function(type) { 42 | if (this.input[type] && !input[type]) { 43 | game.dispatchEvent(new Event(type + 'buttonup')); 44 | } 45 | if (!this.input[type] && input[type]) { 46 | game.dispatchEvent(new Event(type + 'buttondown')); 47 | } 48 | }, this); 49 | this.input = input; 50 | } 51 | }); 52 | -------------------------------------------------------------------------------- /tests/feature/event_bubbling/ui.enchant.js: -------------------------------------------------------------------------------- 1 | enchant.ui = { assets: ['pad.png'] }; 2 | enchant.ui.Pad = enchant.Class.create(enchant.Sprite, { 3 | initialize: function() { 4 | var game = enchant.Game.instance; 5 | var image = game.assets['pad.png']; 6 | enchant.Sprite.call(this, image.width / 2, image.height); 7 | this.image = image; 8 | this.input = { left: false, right: false, up: false, down:false }; 9 | this.addEventListener('touchstart', function(e) { 10 | this._updateInput(this._detectInput(e.localX, e.localY)); 11 | }); 12 | this.addEventListener('touchmove', function(e) { 13 | this._updateInput(this._detectInput(e.localX, e.localY)); 14 | }); 15 | this.addEventListener('touchend', function(e) { 16 | this._updateInput({ left: false, right: false, up: false, down:false }); 17 | }); 18 | }, 19 | _detectInput: function(x, y) { 20 | x -= this.width / 2; 21 | y -= this.height / 2; 22 | var input = { left: false, right: false, up: false, down:false }; 23 | if (x * x + y * y > 200) { 24 | if (x < 0 && y < x * x * 0.1 && y > x * x * -0.1) { 25 | input.left = true; 26 | } 27 | if (x > 0 && y < x * x * 0.1 && y > x * x * -0.1) { 28 | input.right = true; 29 | } 30 | if (y < 0 && x < y * y * 0.1 && x > y * y * -0.1) { 31 | input.up = true; 32 | } 33 | if (y > 0 && x < y * y * 0.1 && x > y * y * -0.1) { 34 | input.down = true; 35 | } 36 | } 37 | return input; 38 | }, 39 | _updateInput: function(input) { 40 | var game = enchant.Game.instance; 41 | ['left', 'right', 'up', 'down'].forEach(function(type) { 42 | if (this.input[type] && !input[type]) { 43 | game.dispatchEvent(new Event(type + 'buttonup')); 44 | } 45 | if (!this.input[type] && input[type]) { 46 | game.dispatchEvent(new Event(type + 'buttondown')); 47 | } 48 | }, this); 49 | this.input = input; 50 | } 51 | }); 52 | -------------------------------------------------------------------------------- /tests/feature/group_rotation/ui.enchant.js: -------------------------------------------------------------------------------- 1 | enchant.ui = { assets: ['pad.png'] }; 2 | enchant.ui.Pad = enchant.Class.create(enchant.Sprite, { 3 | initialize: function() { 4 | var game = enchant.Game.instance; 5 | var image = game.assets['pad.png']; 6 | enchant.Sprite.call(this, image.width / 2, image.height); 7 | this.image = image; 8 | this.input = { left: false, right: false, up: false, down:false }; 9 | this.addEventListener('touchstart', function(e) { 10 | this._updateInput(this._detectInput(e.localX, e.localY)); 11 | }); 12 | this.addEventListener('touchmove', function(e) { 13 | this._updateInput(this._detectInput(e.localX, e.localY)); 14 | }); 15 | this.addEventListener('touchend', function(e) { 16 | this._updateInput({ left: false, right: false, up: false, down:false }); 17 | }); 18 | }, 19 | _detectInput: function(x, y) { 20 | x -= this.width / 2; 21 | y -= this.height / 2; 22 | var input = { left: false, right: false, up: false, down:false }; 23 | if (x * x + y * y > 200) { 24 | if (x < 0 && y < x * x * 0.1 && y > x * x * -0.1) { 25 | input.left = true; 26 | } 27 | if (x > 0 && y < x * x * 0.1 && y > x * x * -0.1) { 28 | input.right = true; 29 | } 30 | if (y < 0 && x < y * y * 0.1 && x > y * y * -0.1) { 31 | input.up = true; 32 | } 33 | if (y > 0 && x < y * y * 0.1 && x > y * y * -0.1) { 34 | input.down = true; 35 | } 36 | } 37 | return input; 38 | }, 39 | _updateInput: function(input) { 40 | var game = enchant.Game.instance; 41 | ['left', 'right', 'up', 'down'].forEach(function(type) { 42 | if (this.input[type] && !input[type]) { 43 | game.dispatchEvent(new Event(type + 'buttonup')); 44 | } 45 | if (!this.input[type] && input[type]) { 46 | game.dispatchEvent(new Event(type + 'buttondown')); 47 | } 48 | }, this); 49 | this.input = input; 50 | } 51 | }); 52 | -------------------------------------------------------------------------------- /dev/src/Matrix.js: -------------------------------------------------------------------------------- 1 | enchant.Matrix = enchant.Class.create({ 2 | initialize: function() { 3 | this.reset(); 4 | }, 5 | reset: function() { 6 | this.stack = []; 7 | this.stack.push([ 1, 0, 0, 1, 0, 0 ]); 8 | }, 9 | makeTransformMatrix: function(node, dest) { 10 | var x = node._x; 11 | var y = node._y; 12 | var width = node.width || 0; 13 | var height = node.height || 0; 14 | var rotation = node._rotation || 0; 15 | var scaleX = (typeof node._scaleX === 'number') ? node._scaleX : 1; 16 | var scaleY = (typeof node._scaleY === 'number') ? node._scaleY : 1; 17 | var theta = rotation * Math.PI / 180; 18 | var tmpcos = Math.cos(theta); 19 | var tmpsin = Math.sin(theta); 20 | var w = (typeof node._originX === 'number') ? node._originX : width / 2; 21 | var h = (typeof node._originY === 'number') ? node._originY : height / 2; 22 | var a = scaleX * tmpcos; 23 | var b = scaleX * tmpsin; 24 | var c = scaleY * tmpsin; 25 | var d = scaleY * tmpcos; 26 | dest[0] = a; 27 | dest[1] = b; 28 | dest[2] = -c; 29 | dest[3] = d; 30 | dest[4] = (-a * w + c * h + x + w); 31 | dest[5] = (-b * w - d * h + y + h); 32 | }, 33 | multiply: function(m1, m2, dest) { 34 | var a11 = m1[0], a21 = m1[2], adx = m1[4], 35 | a12 = m1[1], a22 = m1[3], ady = m1[5]; 36 | var b11 = m2[0], b21 = m2[2], bdx = m2[4], 37 | b12 = m2[1], b22 = m2[3], bdy = m2[5]; 38 | 39 | dest[0] = a11 * b11 + a21 * b12; 40 | dest[1] = a12 * b11 + a22 * b12; 41 | dest[2] = a11 * b21 + a21 * b22; 42 | dest[3] = a12 * b21 + a22 * b22; 43 | dest[4] = a11 * bdx + a21 * bdy + adx; 44 | dest[5] = a12 * bdx + a22 * bdy + ady; 45 | }, 46 | multiplyVec: function(mat, vec, dest) { 47 | var x = vec[0], y = vec[1]; 48 | var m11 = mat[0], m21 = mat[2], mdx = mat[4], 49 | m12 = mat[1], m22 = mat[3], mdy = mat[5]; 50 | dest[0] = m11 * x + m21 * y + mdx; 51 | dest[1] = m12 * x + m22 * y + mdy; 52 | } 53 | }); 54 | enchant.Matrix.instance = new enchant.Matrix(); 55 | -------------------------------------------------------------------------------- /tasks/install-jsdoc-toolkit.coffee: -------------------------------------------------------------------------------- 1 | module.exports = (grunt) -> 2 | 3 | fs = require 'fs' 4 | http = require 'http' 5 | unzip = require 'unzip' 6 | 7 | download = (src, dest, callback) -> 8 | writeStream = fs.createWriteStream dest 9 | get = http.get src, (response) -> 10 | response.pipe writeStream 11 | 12 | writeStream.on 'close', -> 13 | callback null 14 | 15 | writeStream.on 'error', (err) -> 16 | callback err 17 | 18 | get.on 'error', (err) -> 19 | callback err 20 | 21 | extract = (path, dest, callback) -> 22 | readStream = fs.createReadStream path 23 | ext = unzip.Extract path: dest 24 | 25 | ext.on 'close', -> 26 | callback null 27 | 28 | ext.on 'error', (err) -> 29 | callback err 30 | 31 | readStream.pipe ext 32 | 33 | download_link = 'http://jsdoc-toolkit.googlecode.com/files/jsdoc_toolkit-2.4.0.zip' 34 | archive_name = 'jsdoc-toolkit.zip' 35 | extracted_directory_name = 'jsdoc_toolkit-2.4.0/' 36 | install_path = 'jsdoc-toolkit/' 37 | 38 | grunt.registerTask 'download-jsdoc-toolkit', '(internal) Download archive of jsdoc-toolkit.', -> 39 | done = @async() 40 | 41 | download download_link, archive_name, (err) -> 42 | if err 43 | grunt.log.warn 'download failed' 44 | else 45 | grunt.log.writeln 'zip downloaded' 46 | done !err 47 | 48 | grunt.registerTask 'extract-jsdoc-toolkit', '(internal) Extract archive of jsdoc-toolkit.', -> 49 | done = @async() 50 | 51 | extract archive_name, './', (err) -> 52 | if err 53 | grunt.log.warn 'extract failed' 54 | else 55 | grunt.log.writeln 'zip extracted' 56 | done !err 57 | 58 | grunt.registerTask 'finalize-jsdoc-toolkit', '(internal) Place jsdoc-toolkit into correct position.', -> 59 | grunt.file.delete './' + archive_name, force: true 60 | grunt.file.delete './' + extracted_directory_name, force: true 61 | 62 | grunt.registerTask 'install-jsdoc-toolkit', 'Install jsdoc-toolkit 2.4.0 into repository.', -> 63 | grunt.task.run [ 64 | 'download-jsdoc-toolkit', 65 | 'extract-jsdoc-toolkit', 66 | 'copy:' + extracted_directory_name + install_path + ':' + install_path, 67 | 'finalize-jsdoc-toolkit' 68 | ] 69 | -------------------------------------------------------------------------------- /tests/qunit/enchant.js/label-textalign.js: -------------------------------------------------------------------------------- 1 | var context, core, label; 2 | module('Label.textAlign', { 3 | setup: function () { 4 | enchant(); 5 | core = new enchant.Core(320, 320); 6 | 7 | // dummy label for activate canvas layer 8 | dummylabel = new Label('.'); 9 | dummylabel.moveTo(320, 320); 10 | core.rootScene.addChild(dummylabel); 11 | 12 | context = document.getElementsByTagName('canvas')[0].getContext('2d'); 13 | 14 | // using multibyte char in tests causes problem when running on phantomjs 15 | label = new Label('='); 16 | label.color = '#f00'; 17 | label.font = '10px mono monospace'; 18 | 19 | ok(!verifyTextAt('left')); 20 | ok(!verifyTextAt('center')); 21 | ok(!verifyTextAt('right')); 22 | } 23 | }); 24 | 25 | function verifyTextAt(textAlign) { 26 | var x = 4, image; 27 | if (textAlign === 'center') { 28 | x = label.width / 2; 29 | } else if (textAlign === 'right') { 30 | x = label.width - 5; 31 | } 32 | 33 | // this code trying to avoid problem about difference of font 34 | var max = 0; 35 | for(var y = 0; y < 10; y++){ 36 | image = context.getImageData(x,y,1,1).data; 37 | max = Math.max(image[0], max); 38 | } 39 | 40 | return max > 128; 41 | } 42 | 43 | test('textAlign supports "left"', function (){ 44 | label.textAlign = 'left'; 45 | core.rootScene.addChild(label); 46 | 47 | ok( verifyTextAt('left')); 48 | ok(!verifyTextAt('center')); 49 | ok(!verifyTextAt('right')); 50 | }); 51 | 52 | test('textAlign supports "center"', function (){ 53 | label.textAlign = 'center'; 54 | core.rootScene.addChild(label); 55 | 56 | ok(!verifyTextAt('left')); 57 | ok( verifyTextAt('center')); 58 | ok(!verifyTextAt('right')); 59 | }); 60 | 61 | test('textAlign supports "right"', function (){ 62 | label.textAlign = 'right'; 63 | core.rootScene.addChild(label); 64 | 65 | ok(!verifyTextAt('left')); 66 | ok(!verifyTextAt('center')); 67 | ok( verifyTextAt('right')); 68 | }); 69 | 70 | test('default textAlign is "left"', function (){ 71 | core.rootScene.addChild(label); 72 | 73 | ok( verifyTextAt('left')); 74 | ok(!verifyTextAt('center')); 75 | ok(!verifyTextAt('right')); 76 | }); -------------------------------------------------------------------------------- /examples/expert/getbanana/nineleap.enchant.js: -------------------------------------------------------------------------------- 1 | enchant.nineleap = { assets: ['start.png', 'end.png'] }; 2 | enchant.nineleap.Game = enchant.Class.create(enchant.Game, { 3 | initialize: function(width, height) { 4 | enchant.Game.call(this, width, height); 5 | this.addEventListener('load', function() { 6 | var game = this; 7 | this.startScene = new SplashScene(); 8 | this.startScene.image = this.assets['start.png']; 9 | this.startScene.addEventListener('touchend', function() { 10 | if (game.currentScene == this) game.popScene(); 11 | }); 12 | this.addEventListener('keydown', function() { 13 | if (this.currentScene == this.startScene) this.popScene(); 14 | this.removeEventListener('keydown', arguments.callee); 15 | }); 16 | this.pushScene(this.startScene); 17 | 18 | this.endScene = new SplashScene(); 19 | this.endScene.image = this.assets['end.png']; 20 | }); 21 | }, 22 | end: function(score, result) { 23 | this.pushScene(this.endScene); 24 | if (location.hostname == 'r.jsgames.jp') { 25 | var submit = function() { 26 | var id = location.pathname.match(/^\/games\/(\d+)/)[1]; 27 | location.replace([ 28 | 'http://9leap.net/games/', id, '/result', 29 | '?score=', encodeURIComponent(score), 30 | '&result=', encodeURIComponent(result) 31 | ].join('')); 32 | } 33 | this.endScene.addEventListener('touchend', submit); 34 | window.setTimeout(submit, 3000); 35 | } 36 | this.end = function() {}; 37 | } 38 | }); 39 | 40 | enchant.nineleap.SplashScene = enchant.Class.create(enchant.Scene, { 41 | image: { 42 | get: function() { 43 | return this._image; 44 | }, 45 | set: function(image) { 46 | this._image = image; 47 | 48 | while (this.firstChild) { 49 | this.removeChild(this.firstChild); 50 | } 51 | var sprite = new Sprite(image.width, image.height); 52 | sprite.image = image; 53 | sprite.x = (this.width - image.width) / 2; 54 | sprite.y = (this.height - image.height) / 2; 55 | this.addChild(sprite); 56 | } 57 | } 58 | }); 59 | -------------------------------------------------------------------------------- /tests/mocha/enchant.js/test_action-event-target.js: -------------------------------------------------------------------------------- 1 | describe("ActionEventTarget", function() { 2 | before(function() { 3 | enchant(); 4 | }); 5 | 6 | describe("#dispatchEvent", function() { 7 | it("handle callback as same as EventTarget", function() { 8 | var actionEventTarget = new ActionEventTarget(), 9 | testEvent = new enchant.Event('test'), 10 | handlerSpy1 = sinon.spy(), 11 | handlerSpy2 = sinon.spy(), 12 | handlerSpy3 = sinon.spy(); 13 | 14 | actionEventTarget.addEventListener('test', handlerSpy1); 15 | actionEventTarget.addEventListener('test', handlerSpy2); 16 | actionEventTarget.ontest = handlerSpy3; 17 | actionEventTarget.dispatchEvent(testEvent); 18 | expect(handlerSpy1.calledOnce).to.be.true; 19 | expect(handlerSpy2.calledOnce).to.be.true; 20 | expect(handlerSpy3.calledOnce).to.be.true; 21 | expect(handlerSpy1.calledWith(testEvent)).to.be.true; 22 | expect(handlerSpy2.calledWith(testEvent)).to.be.true; 23 | expect(handlerSpy3.calledWith(testEvent)).to.be.true; 24 | expect(handlerSpy1.calledOn(actionEventTarget)).to.be.true; 25 | expect(handlerSpy2.calledOn(actionEventTarget)).to.be.true; 26 | expect(handlerSpy3.calledOn(actionEventTarget)).to.be.true; 27 | expect(handlerSpy1.calledAfter(handlerSpy2)).to.be.true; 28 | expect(handlerSpy2.calledAfter(handlerSpy3)).to.be.true; 29 | }); 30 | 31 | it("call event handlers on #node", function() { 32 | var sp = new Sprite(32, 32), 33 | actionEventTarget = new ActionEventTarget(), 34 | testEvent = new enchant.Event('test'), 35 | handlerSpy1 = sinon.spy(), 36 | handlerSpy2 = sinon.spy(), 37 | handlerSpy3 = sinon.spy(); 38 | 39 | actionEventTarget.node = sp; 40 | actionEventTarget.addEventListener('test', handlerSpy1); 41 | actionEventTarget.addEventListener('test', handlerSpy2); 42 | actionEventTarget.ontest = handlerSpy3; 43 | actionEventTarget.dispatchEvent(testEvent); 44 | expect(handlerSpy1.calledOn(sp)).to.be.true; 45 | expect(handlerSpy2.calledOn(sp)).to.be.true; 46 | expect(handlerSpy3.calledOn(sp)).to.be.true; 47 | }); 48 | }); 49 | }); 50 | -------------------------------------------------------------------------------- /tests/raster/hellobear/main.js: -------------------------------------------------------------------------------- 1 | enchant(); 2 | window.onload = function() { 3 | var game = new Game(640, 640); 4 | game.preload('chara1.png'); 5 | 6 | /** 7 | * テストスプライトのクラス 8 | */ 9 | var Bear = enchant.Class.create(enchant.Sprite,{ 10 | /** 11 | * 初期化 12 | * @constructor 13 | */ 14 | initialize: function() { 15 | enchant.Sprite.call(this, 32, 32); 16 | this.image = game.assets['chara1.png']; 17 | } 18 | }); 19 | 20 | game.onload = function() { 21 | // 普通に表示 22 | var bear = new Bear(); 23 | bear.moveTo(64, 64); 24 | game.rootScene.addChild(bear); 25 | 26 | // ズームして表示 27 | var zoom = new Bear(); 28 | zoom.moveTo(64 * 2, 64); 29 | zoom.scaleX = 2; 30 | zoom.frame = 2; 31 | game.rootScene.addChild(zoom); 32 | 33 | // 45度回転して表示 34 | var rotate = new Bear(); 35 | rotate.moveTo(64 * 3, 64); 36 | rotate.rotation = 45; 37 | rotate.frame = 3; 38 | game.rootScene.addChild(rotate); 39 | 40 | // 90度回転して2倍ズームして表示 41 | var rotatezoom = new Bear(); 42 | rotatezoom.moveTo(64 * 4, 64); 43 | rotatezoom.rotation = 90; 44 | rotatezoom.scaleX = 2; 45 | rotatezoom.scaleY = 2; 46 | rotatezoom.frame = 4; 47 | game.rootScene.addChild(rotatezoom); 48 | 49 | // シロクマを表示 50 | var frame = new Bear(); 51 | frame.moveTo(64 * 5, 64); 52 | frame.frame = 5; 53 | frame.rotation = 180; 54 | frame.scaleY = 2; 55 | game.rootScene.addChild(frame); 56 | 57 | // グループの中にクマ 58 | var child_bear = new Bear(); 59 | var group = new enchant.Group(); 60 | group.addChild(child_bear); 61 | game.rootScene.addChild(group); 62 | group.moveTo(64*6, 64); 63 | 64 | // グループの中にクマ 65 | var grandchild_bear = new Bear(); 66 | var parent_group = new enchant.Group(); 67 | var child_group = new enchant.Group(); 68 | grandchild_bear.x = 64; 69 | parent_group.moveTo(64*3, 64); 70 | child_group.moveTo(64*3, 0); 71 | child_group.addChild(grandchild_bear); 72 | parent_group.addChild(child_group); 73 | game.rootScene.addChild(parent_group); 74 | 75 | // グループの中にクマ 76 | var child_bear = new Bear(); 77 | var group = new enchant.Group(32, 32); 78 | group.moveTo(64*8, 64); 79 | group.addChild(child_bear); 80 | game.rootScene.addChild(group); 81 | 82 | 83 | }; 84 | 85 | 86 | game.start(); 87 | 88 | }; -------------------------------------------------------------------------------- /tests/mocha/enchant.js/test_matrix.js: -------------------------------------------------------------------------------- 1 | describe("matrix", function(){ 2 | var matrix; 3 | 4 | before(function(){ 5 | enchant(); 6 | matrix = enchant.Matrix.instance; 7 | }); 8 | 9 | it("#makeTransformMatrix makes transform matrix", function(){ 10 | var node = new Node(); 11 | node.x = 1; 12 | node.y = 1; 13 | var ans = []; 14 | matrix.makeTransformMatrix(node, ans); 15 | expect(ans[0]).to.equal(1); 16 | expect(ans[1]).to.equal(0); 17 | expect(ans[2]).to.equal(0); 18 | expect(ans[3]).to.equal(1); 19 | expect(ans[4]).to.equal(1); 20 | expect(ans[5]).to.equal(1); 21 | node.width = 2; 22 | node.height = 2; 23 | matrix.makeTransformMatrix(node, ans); 24 | expect(ans[0]).to.equal(1); 25 | expect(ans[1]).to.equal(0); 26 | expect(ans[2]).to.equal(0); 27 | expect(ans[3]).to.equal(1); 28 | expect(ans[4]).to.equal(1); 29 | expect(ans[5]).to.equal(1); 30 | node._rotation = 45; 31 | matrix.makeTransformMatrix(node, ans); 32 | expect(ans[0]).to.be.within(0.70, 0.71); 33 | expect(ans[1]).to.be.within(0.70, 0.71); 34 | expect(ans[2]).to.be.within(-0.71, -0.70); 35 | expect(ans[3]).to.be.within(0.70, 0.71); 36 | expect(ans[4]).to.be.within(1.9, 2.0); 37 | expect(ans[5]).to.be.within(0.58, 0.59); 38 | node._scaleX = 2; 39 | node._scaleY = 2; 40 | matrix.makeTransformMatrix(node, ans); 41 | expect(ans[0]).to.be.within(1.41, 1.42); 42 | expect(ans[1]).to.be.within(1.41, 1.42); 43 | expect(ans[2]).to.be.within(-1.42, -1.41); 44 | expect(ans[3]).to.be.within(1.41, 1.42); 45 | expect(ans[4]).to.be.within(1.9, 2.0); 46 | expect(ans[5]).to.be.within(-0.83, -0.82); 47 | }); 48 | 49 | it("#multiply multiplies two matrixes", function(){ 50 | var m1 = [1, 2, 3, 4, 5, 6]; 51 | var m2 = [2, 3, 4, 5, 6, 7]; 52 | var ans = []; 53 | matrix.multiply(m1, m2, ans); 54 | expect(ans.length).to.equal(6); 55 | expect(ans[0]).to.equal(11); 56 | expect(ans[1]).to.equal(16); 57 | expect(ans[2]).to.equal(19); 58 | expect(ans[3]).to.equal(28); 59 | expect(ans[4]).to.equal(32); 60 | expect(ans[5]).to.equal(46); 61 | 62 | }); 63 | 64 | it("#multiplyVec multiplies matrix by vector", function(){ 65 | var m = [1, 2, 3, 4, 5, 6]; 66 | var v = [2, 3]; 67 | var ans = []; 68 | matrix.multiplyVec(m, v, ans); 69 | expect(ans[0]).to.equal(16); 70 | expect(ans[1]).to.equal(22); 71 | }); 72 | }); -------------------------------------------------------------------------------- /tests/mocha/enchant.js/test_loading-scene.js: -------------------------------------------------------------------------------- 1 | describe("LoadingScene", function(){ 2 | var core, loadingScene, expectedBar; 3 | 4 | before(function(){ 5 | enchant(); 6 | }); 7 | 8 | beforeEach(function(){ 9 | core = new Core(); 10 | loadingScene = new LoadingScene(); 11 | expectedBar = document.createElement("canvas"); 12 | expectedBar.width = 128; 13 | expectedBar.height = 16; 14 | var border = 3; 15 | var ctx = expectedBar.getContext("2d"); 16 | ctx.fillStyle = "#fff"; 17 | ctx.fillRect(0, 0, 128, 16); 18 | ctx.fillStyle = "#000"; 19 | ctx.fillRect(border, border, 122, 10); 20 | }); 21 | 22 | afterEach(function(){ 23 | loadingScene = null; 24 | }); 25 | 26 | var extendsExpectedBar = (function(progress) { 27 | var _progress = 0; 28 | return function(){ 29 | _progress *= 0.9; 30 | _progress += progress*0.1; 31 | var ctx = expectedBar.getContext("2d"); 32 | ctx.fillStyle = "#fff"; 33 | ctx.fillRect(3, 0, 122 * _progress, 10); 34 | }; 35 | }()); 36 | 37 | it("has indication bar", function(){ 38 | var bar = loadingScene.childNodes[0]; 39 | expect(bar.width).to.equal(128); 40 | expect(bar.height).to.equal(16); 41 | expect(bar.x).to.equal(96); 42 | expect(bar.y).to.equal(152); 43 | expect(bar.image.context.getImageData(0, 0, 128, 16).data) 44 | .to.deep.equal(expectedBar.getContext("2d").getImageData(0, 0, 128, 16).data); 45 | }); 46 | 47 | it("indictor extends by the rat of progresson of loading", function(){ 48 | for(var i = 1; i <= 10; i++) { 49 | var e = new enchant.Event("progress"); 50 | e.loaded = i; 51 | e.total = 10; 52 | progress = e.loaded / e.total * 1.0; 53 | loadingScene.dispatchEvent(e); 54 | loadingScene.dispatchEvent(new enchant.Event("enterframe")); 55 | extendsExpectedBar(progress); 56 | expect(loadingScene.childNodes[0].image.context.getImageData(0, 0, 128, 16).data) 57 | .to.deep.equal(expectedBar.getContext("2d").getImageData(0, 0, 128, 16).data); 58 | } 59 | }); 60 | 61 | it("removes itself from core when load event occurred", function(){ 62 | core = enchant.Core.instance; 63 | loadingScene = core.loadingScene; 64 | core.pushScene(loadingScene); 65 | expect(core._scenes.indexOf(loadingScene)).to.not.equal(-1); 66 | core.loadingScene.dispatchEvent(new enchant.Event("load")); 67 | expect(core._scenes.indexOf(loadingScene)).to.equal(-1); 68 | }); 69 | }); -------------------------------------------------------------------------------- /examples/windows8/enchant.js template.sln: -------------------------------------------------------------------------------- 1 | 2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio Express 2012 for Windows 8 4 | Project("{262852C6-CD72-467D-83FE-5EEB1973A190}") = "enchant.js template", "sample-app\enchant.js template.jsproj", "{7740DDD6-765E-4387-BA64-199D1B738AA0}" 5 | EndProject 6 | Global 7 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 8 | Debug|Any CPU = Debug|Any CPU 9 | Debug|ARM = Debug|ARM 10 | Debug|x64 = Debug|x64 11 | Debug|x86 = Debug|x86 12 | Release|Any CPU = Release|Any CPU 13 | Release|ARM = Release|ARM 14 | Release|x64 = Release|x64 15 | Release|x86 = Release|x86 16 | EndGlobalSection 17 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 18 | {7740DDD6-765E-4387-BA64-199D1B738AA0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 19 | {7740DDD6-765E-4387-BA64-199D1B738AA0}.Debug|Any CPU.Build.0 = Debug|Any CPU 20 | {7740DDD6-765E-4387-BA64-199D1B738AA0}.Debug|Any CPU.Deploy.0 = Debug|Any CPU 21 | {7740DDD6-765E-4387-BA64-199D1B738AA0}.Debug|ARM.ActiveCfg = Debug|ARM 22 | {7740DDD6-765E-4387-BA64-199D1B738AA0}.Debug|ARM.Build.0 = Debug|ARM 23 | {7740DDD6-765E-4387-BA64-199D1B738AA0}.Debug|ARM.Deploy.0 = Debug|ARM 24 | {7740DDD6-765E-4387-BA64-199D1B738AA0}.Debug|x64.ActiveCfg = Debug|x64 25 | {7740DDD6-765E-4387-BA64-199D1B738AA0}.Debug|x64.Build.0 = Debug|x64 26 | {7740DDD6-765E-4387-BA64-199D1B738AA0}.Debug|x64.Deploy.0 = Debug|x64 27 | {7740DDD6-765E-4387-BA64-199D1B738AA0}.Debug|x86.ActiveCfg = Debug|x86 28 | {7740DDD6-765E-4387-BA64-199D1B738AA0}.Debug|x86.Build.0 = Debug|x86 29 | {7740DDD6-765E-4387-BA64-199D1B738AA0}.Debug|x86.Deploy.0 = Debug|x86 30 | {7740DDD6-765E-4387-BA64-199D1B738AA0}.Release|Any CPU.ActiveCfg = Release|Any CPU 31 | {7740DDD6-765E-4387-BA64-199D1B738AA0}.Release|Any CPU.Build.0 = Release|Any CPU 32 | {7740DDD6-765E-4387-BA64-199D1B738AA0}.Release|Any CPU.Deploy.0 = Release|Any CPU 33 | {7740DDD6-765E-4387-BA64-199D1B738AA0}.Release|ARM.ActiveCfg = Release|ARM 34 | {7740DDD6-765E-4387-BA64-199D1B738AA0}.Release|ARM.Build.0 = Release|ARM 35 | {7740DDD6-765E-4387-BA64-199D1B738AA0}.Release|ARM.Deploy.0 = Release|ARM 36 | {7740DDD6-765E-4387-BA64-199D1B738AA0}.Release|x64.ActiveCfg = Release|x64 37 | {7740DDD6-765E-4387-BA64-199D1B738AA0}.Release|x64.Build.0 = Release|x64 38 | {7740DDD6-765E-4387-BA64-199D1B738AA0}.Release|x64.Deploy.0 = Release|x64 39 | {7740DDD6-765E-4387-BA64-199D1B738AA0}.Release|x86.ActiveCfg = Release|x86 40 | {7740DDD6-765E-4387-BA64-199D1B738AA0}.Release|x86.Build.0 = Release|x86 41 | {7740DDD6-765E-4387-BA64-199D1B738AA0}.Release|x86.Deploy.0 = Release|x86 42 | EndGlobalSection 43 | GlobalSection(SolutionProperties) = preSolution 44 | HideSolutionNode = FALSE 45 | EndGlobalSection 46 | EndGlobal 47 | -------------------------------------------------------------------------------- /tests/mocha/enchant.js/test_tween.js: -------------------------------------------------------------------------------- 1 | describe("Tween", function() { 2 | var TimelineMock; 3 | 4 | before(function() { 5 | enchant(); 6 | 7 | TimelineMock = function(node) { 8 | this.node = node; 9 | this.next = sinon.spy(); 10 | }; 11 | }); 12 | 13 | describe("#initialize", function() { 14 | it("default easing function is LINEAR", function() { 15 | var tween = new Tween(); 16 | 17 | expect(tween.easing).to.equal(enchant.Easing.LINEAR); 18 | }); 19 | }); 20 | 21 | describe("ACTION_TICK event", function() { 22 | it("ease node's property with specified function", function() { 23 | var sp = new Sprite(32, 32), 24 | tl = new TimelineMock(sp), 25 | tween1 = new Tween({ x: 32, time: 2, easing: enchant.Easing.LINEAR }), 26 | tween2 = new Tween({ y: 32, time: 2, easing: enchant.Easing.BACK_EASEIN }), 27 | actionStartEvent = new Event(Event.ACTION_START), 28 | actionTickEvent = new Event(Event.ACTION_TICK); 29 | 30 | actionStartEvent.timeline = tl; 31 | actionTickEvent.timeline = tl; 32 | actionTickEvent.elapsed = 1; 33 | tween1.node = sp; 34 | tween2.node = sp; 35 | tween1.dispatchEvent(actionStartEvent); 36 | tween2.dispatchEvent(actionStartEvent); 37 | expect(sp.x).to.equal(0); 38 | expect(sp.y).to.equal(0); 39 | tween1.dispatchEvent(actionTickEvent); 40 | tween2.dispatchEvent(actionTickEvent); 41 | expect(sp.x).to.equal(16); 42 | expect(sp.y).to.lessThan(0); 43 | tween1.dispatchEvent(actionTickEvent); 44 | tween2.dispatchEvent(actionTickEvent); 45 | expect(sp.x).to.equal(32); 46 | expect(sp.y).to.closeTo(32, 0.1); 47 | }); 48 | 49 | it("use function result to target value", function() { 50 | var sp = new Sprite(32, 32), 51 | tl = new TimelineMock(sp), 52 | tween = new Tween({ x: function() { return 32; }, time: 2, easing: enchant.Easing.LINEAR }), 53 | actionStartEvent = new Event(Event.ACTION_START), 54 | actionTickEvent = new Event(Event.ACTION_TICK); 55 | 56 | actionStartEvent.timeline = tl; 57 | actionTickEvent.timeline = tl; 58 | actionTickEvent.elapsed = 1; 59 | tween.node = sp; 60 | tween.dispatchEvent(actionStartEvent); 61 | expect(sp.x).to.equal(0); 62 | tween.dispatchEvent(actionTickEvent); 63 | expect(sp.x).to.equal(16); 64 | tween.dispatchEvent(actionTickEvent); 65 | expect(sp.x).to.equal(32); 66 | }); 67 | }); 68 | 69 | }); 70 | -------------------------------------------------------------------------------- /dev/src/LoadingScene.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @scope enchant.LoadingScene.prototype 3 | */ 4 | enchant.LoadingScene = enchant.Class.create(enchant.Scene, { 5 | /** 6 | * @name enchant.LoadingScene 7 | * @class 8 | [lang:ja] 9 | * デフォルトのローディングシーン. ローディングアニメーションを書き換えたい場合は, 10 | * enchant.LoadingSceneを上書きする. 11 | [/lang] 12 | [lang:en] 13 | * Default loading scene. If you want to use your own loading animation, overwrite (don't inherit) this class. 14 | * Referred from enchant.Core in default, as `new enchant.LoadingScene` etc. 15 | [/lang] 16 | [lang:de] 17 | [/lang] 18 | * 19 | * @example 20 | * enchant.LoadingScene = enchant.Class.create(enchant.Scene, { 21 | * initialize: function() { 22 | * enchant.Scene.call(this); 23 | * this.backgroundColor = 'red'; 24 | * // ... 25 | * this.addEventListener('progress', function(e) { 26 | * progress = e.loaded / e.total; 27 | * }); 28 | * this.addEventListener('enterframe', function() { 29 | * // animation 30 | * }); 31 | * } 32 | * }); 33 | * @constructs 34 | * @extends enchant.Scene 35 | */ 36 | initialize: function() { 37 | enchant.Scene.call(this); 38 | this.backgroundColor = '#000'; 39 | var barWidth = this.width * 0.4 | 0; 40 | var barHeight = this.width * 0.05 | 0; 41 | var border = barWidth * 0.03 | 0; 42 | var bar = new enchant.Sprite(barWidth, barHeight); 43 | bar.disableCollection(); 44 | bar.x = (this.width - barWidth) / 2; 45 | bar.y = (this.height - barHeight) / 2; 46 | var image = new enchant.Surface(barWidth, barHeight); 47 | image.context.fillStyle = '#fff'; 48 | image.context.fillRect(0, 0, barWidth, barHeight); 49 | image.context.fillStyle = '#000'; 50 | image.context.fillRect(border, border, barWidth - border * 2, barHeight - border * 2); 51 | bar.image = image; 52 | var progress = 0, _progress = 0; 53 | this.addEventListener('progress', function(e) { 54 | // avoid #167 https://github.com/wise9/enchant.js/issues/177 55 | progress = e.loaded / e.total * 1.0; 56 | }); 57 | bar.addEventListener('enterframe', function() { 58 | _progress *= 0.9; 59 | _progress += progress * 0.1; 60 | image.context.fillStyle = '#fff'; 61 | image.context.fillRect(border, 0, (barWidth - border * 2) * _progress, barHeight); 62 | }); 63 | this.addChild(bar); 64 | this.addEventListener('load', function(e) { 65 | var core = enchant.Core.instance; 66 | core.removeScene(core.loadingScene); 67 | core.dispatchEvent(e); 68 | }); 69 | } 70 | }); 71 | --------------------------------------------------------------------------------