This project aims to port the game library enchant.js to TypeScript.
Local server for ES6 module
npx http-server
Build enchant.js
to see how enchant.js
works.
- Build
enchant.js
withnpm run test
in theenchant.js
repo. - Run a static files web server at
enchant.js
root (e.g.python3 -m http.server 8080
). - Use Chrome and start a Guest session to disable all the extensions.
Setup development environment.
- VSCode (optional)
- Install Node.JS, Yarn, and Python (optional).
- Run
yarn
ornpm install
to install dependencies. - Run
yarn build
ornpm build
to build TypeScript source code. - Fix the errors from the output.
-
header.js
-
Object.defineProperty
-
Object.defineProperties
-
Object.create
-
Object.getPrototypeOf
-
Function.prototype.bind
-
getTime
-
window.requestAnimationFrame
-
enchant
-
window.addEventListener('message')
-
-
Class.js
-
Class
-
create
-
getInheritanceTree
-
-
Env.js
-
ENV
-
VERSION
-
BROWSER
-
VENDOR_PREFIX
-
TOUCH_ENABLED
-
RETINA_DISPLAY
-
USE_FLASH_SOUND
-
USE_DEFAULT_EVENT_TAGS
-
CANVAS_DRAWING_METHODS
-
KEY_BIND_TABLE
-
PREVENT_DEFAULT_KEY_CODES
-
SOUND_ENABLED_ON_MOBILE_SAFARI
-
USE_TOUCH_TO_START_SCENE
-
USE_WEB_AUDIO
-
USE_ANIMATION
-
COLOR_DETECTION_LEVEL
-
-
-
Event.js
- Some
ACTION_START
,ACTION_TICK
, etc. events addtimeline
andelapsed
properties. -
InputSource
addssource
anddata
toINPUT_STATE_CHANGED
event -
WebAudioSound
addsmessage
forERROR
event -
Core
addselapsed
forENTER_FRAME
event -
initialize
-
_initPosition
-
LOAD
-
ERROR
-
CORE_RESIZE
-
PROGRESS
-
ENTER_FRAME
-
EXIT_FRAME
-
ENTER
-
EXIT
-
CHILD_ADDED
-
ADDED
-
ADDED_TO_SCENE
-
CHILD_REMOVE
-
REMOVED
-
REMOVED_FROM_SCENE
-
TOUCH_START
-
TOUCH_MOVE
-
TOUCH_END
-
RENDER
-
INPUT_START
-
INPUT_CHANGE
-
INPUT_END
-
INPUT_STATE_CHANGED
-
LEFT_BUTTON_DOWN
-
LEFT_BUTTON_UP
-
RIGHT_BUTTON_DOWN
-
RIGHT_BUTTON_UP
-
UP_BUTTON_DOWN
-
UP_BUTTON_UP
-
DOWN_BUTTON_DOWN
-
DOWN_BUTTON_UP
-
A_BUTTON_DOWN
-
A_BUTTON_UP
-
B_BUTTON_DOWN
-
B_BUTTON_UP
-
ADDED_TO_TIMELINE
-
REMOVED_FROM_TIMELINE
-
ACTION_START
-
ACTION_END
-
ACTION_TICK
-
ACTION_ADDED
-
ACTION_REMOVED
-
ANIMATION_END
- Some
-
EventTarget.js
-
Core.js
-
initialize
-
detectAssets
from plugins
-
-
_dispatchCoreResizeEvent
-
_oncoreresize
-
preload
-
load
-
start
-
_requestPreload
-
_createTouchToStartScene
-
debug
-
actualFps
-
_requestNextFrame
-
_callTick
-
_tick
-
getTime
-
stop
-
pause
-
resume
-
pushScene
-
popScene
-
replaceScene
-
removeScene
-
_buttonListener
-
keybind
-
keyunbind
-
changeButtonState
-
getElapsedTime
-
findExt
-
-
Game.js
-
InputManager.js
-
initialize
-
bind
-
unbind
-
addBroadcastTarget
-
removeBroadcastTarget
-
broadcastEvent
-
changeState
-
-
InputSource.js
-
initialize
-
notifyStateChange
-
-
BinaryInputManager.js
-
bind
-
unbind
-
changeState
-
_down
-
_up
-
-
BinaryInputSource.js
-
initialize
-
-
KeyboardInputManager.js
-
initialize
-
keybind
-
keyunbind
-
_attachDOMEvent
-
-
KeyboardInputSource.js
-
initialize
-
_instances
-
getByKeyCode
-
-
Node.js
-
childNodes
property only exists on some sub-classes (Group
,enchant.widget.EntityGroup
, and four more classes fromgl.enchant.js
- somes are not sub-class ofNode
) butNode
tries to access it -
initialize
-
moveTo
-
moveBy
-
x
-
y
-
_updateCoordinate
-
remove
-
-
Entity.js
- Remove collection (breaking change)
-
_intersectBetweenClassAndInstance
-
_intersectBetweenClassAndClass
-
_intersectStrictBetweenClassAndInstance
-
_intersectStrictBetweenClassAndClass
-
_staticIntersect
-
_staticIntersectStrict
-
_nodePrototypeClearEventListener
-
initialize
-
width
-
height
-
backgroundColor
-
debugColor
-
opacity
-
visible
-
touchEnabled
-
intersect
-
_intersectOne
-
_intersectStrict
-
_intersectStrictOne
-
within
-
scale
-
rotate
-
scaleX
-
scaleY
-
rotation
-
originX
-
originY
-
enableCollection
-
disableCollection
-
clearEventListener
-
_addSelfToCollection
-
_removeSelfFromCollection
-
getBoundingRect
-
getOrientedBoundingRect
-
getConstructor
-
_collectizeConstructor
-
_inherited
-
Sprite.js
-
initialize
-
image
-
frame
-
_frameSequence
-
_deepCompareToPreviousFrame
-
_computeFramePosition
-
_rotateFrameSequence
-
width
-
height
-
cvsRender
-
domRender
-
-
Label.js
-
initialize
-
width
-
text
-
textAlign
-
font
-
color
-
cvsRender
-
domRender
-
detectRender
-
updateBoundArea
-
getMetrics
-
-
Map.js
-
initialize
-
loadData
-
checkTile
-
hitTest
-
image
-
tileWidth
-
tileHeight
-
width
-
height
-
redraw
-
updateBuffer
-
cvsRender
-
domRender
-
-
Group.js
-
initialize
-
addChild
-
insertBefore
-
removeChild
-
firstChild
-
lastChild
-
rotation
-
scaleX
-
scaleY
-
originX
-
originY
-
_dirty
-
-
Matrix.js
-
DetectColorManager.js
-
initialize
-
-
DomManager.js
-
DomManager
-
initialize
-
getDomElement
-
getDomElementAsNext
-
getNextManager
-
addManager
-
removeManager
-
setLayer
-
render
-
domRender
-
_attachEvent
-
_detachEvent
-
remove
-
-
DomlessManager
-
initialize
-
_register
-
getNextManager
-
getDomElement
-
getDomElementAsNext
-
addManager
-
removeManager
-
setLayer
-
render
-
remove
-
-
-
DomLayer.js
-
CanvasLayer.js
-
initialize
-
addChild
-
insertBefore
-
_startRendering
-
_stopRendering
-
_onexitframe
-
_determineEventTarget
-
_getEnityByPosition
-
_setImageSmoothingEnable
-
_attachCache
-
_detachCache
-
-
CanvasRenderer.js
-
render
-
detectRender
-
transform
-
-
LoadingScene.js
-
initialize
-
-
CanvasScene.js
-
DOMScene.js
-
Deferred.js
-
initalize
-
next
-
error
-
_add
-
call
-
fail
-
_insert
-
next
-
parallel
-
sound support
-
DOMSound.js
-
WebAudioSound.js
-
Sound.js
animation feature
-
Easing.js
-
ActionEventTarget.js
-
initalize
-
dispatchEvent
-
-
Timeline.js
-
initialize
-
_deactivateTimeline
-
_activateTimeline
-
_onenterframe
-
setFrameBased
-
setTimeBased
-
next
-
tick
-
add
-
action
-
tween
-
clear
-
skip
-
pause
-
resume
-
loop
-
unloop
-
delay
-
wait
-
then
-
exec
-
cue
-
repeat
-
and
-
or
-
doAll
-
waitAll
-
waitUntil
-
fadeTo
-
fadeIn
-
fadeOut
-
moveTo
-
moveX
-
moveY
-
moveBy
-
hide
-
show
-
removeFromScene
-
scaleTo
-
scaleBy
-
rotateTo
-
rotateBy
-
-
Action.js
-
initialize
-
-
ParallelAction.js
-
Tween.js