Skip to content
This repository was archived by the owner on Apr 6, 2024. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
71 commits
Select commit Hold shift + click to select a range
66370d3
Migrate most of the top-level user docs
kamranayub Mar 30, 2019
9259e92
wip add typedoc
kamranayub May 4, 2020
26f9d15
wip transform marked links from typedoc
kamranayub May 9, 2020
2c547aa
Merge branch 'site' into gh-25/docs-migrate
kamranayub May 9, 2020
80f24f7
wip transform links
kamranayub May 10, 2020
34f3bc4
Add jest and babel for tests
kamranayub May 10, 2020
38ca17e
Merge branch 'site' of https://github.com/excaliburjs/excaliburjs.git…
kamranayub May 12, 2020
938ab70
update pkgs
kamranayub May 12, 2020
f18ebcb
wip better symbol lookup
kamranayub May 12, 2020
e375dae
Merge branch 'site' of https://github.com/excaliburjs/excaliburjs.git…
kamranayub May 13, 2020
f7bad78
handle all or most symbol types
kamranayub May 13, 2020
9ff521e
add back missing pkg
kamranayub May 13, 2020
e03d363
jest setup
kamranayub May 13, 2020
dee5abb
Fix import
kamranayub May 13, 2020
56b0318
update styles
kamranayub May 13, 2020
cffcd96
update compiled styles
kamranayub May 13, 2020
950fafd
update engine docs and fix links
kamranayub May 13, 2020
49ecaf0
Update to patched gatsby-source-typedoc
kamranayub May 13, 2020
e22b16a
update TS
kamranayub May 14, 2020
d540cb3
update styles, source-typedoc, travis
kamranayub May 14, 2020
e9d779a
Update docs from master
kamranayub May 14, 2020
11f2a7e
less padding for indent
kamranayub May 14, 2020
42f1d67
third level headings
kamranayub May 14, 2020
46916ee
Fix errors
kamranayub May 14, 2020
bebc5fe
Update docs with latest patterns and APIs
kamranayub May 14, 2020
975d308
More styles, more actor docs polish
kamranayub May 14, 2020
d97c960
Add Gemfile for netlify
kamranayub May 14, 2020
bbb5f4f
Add skip docs releases flag
kamranayub May 14, 2020
3875a25
more docs polishing
kamranayub May 14, 2020
672cbee
Add gemfile lock
kamranayub May 14, 2020
2209f01
fix lint-staged glob
kamranayub May 14, 2020
fe813a0
Fix broken symbol links in actors
kamranayub May 15, 2020
07e819d
Polish scene docs, add vector docs
kamranayub May 15, 2020
6168913
vector docs, scene docs, docs margin
kamranayub May 15, 2020
f023a48
scene docs, styles
kamranayub May 15, 2020
6c41a1d
use release tag name in nav
kamranayub May 15, 2020
09a7fc6
Add placeholders and vec constants
kamranayub May 15, 2020
1f8b197
Better flow through the starting docs, rename engine to intro
kamranayub May 15, 2020
bb68a46
more detailed intro
kamranayub May 15, 2020
ffffb01
table styles, actor/intro polish
kamranayub May 17, 2020
f41b682
Polish asset docs
kamranayub May 17, 2020
dfd5d5d
Update docs/06-actors-actions.md
kamranayub May 17, 2020
3e36cb3
fix recommendation and verbiage
kamranayub May 17, 2020
186d6b9
Merge branch 'gh-25/docs-migrate' of https://github.com/excaliburjs/e…
kamranayub May 17, 2020
6a0c82b
Fix recommendations
kamranayub May 17, 2020
1fa6b83
Add docs-example component
kamranayub May 21, 2020
812d6bf
Ensure ex dir is reset before pulling
kamranayub May 21, 2020
319d7ca
fix closing tag
kamranayub May 21, 2020
4d7b42d
fix restore cmd
kamranayub May 21, 2020
ab65e2f
Fix var decls
kamranayub May 23, 2020
759175c
Clean up diplaymode section
kamranayub May 23, 2020
51a11e3
Add screen/world coords, native vs. scaled res
kamranayub May 23, 2020
b83b2c4
Clarify actor animation
kamranayub May 23, 2020
0be8d5e
Fixup physics grammar/flow for actor-body
kamranayub May 23, 2020
36369bb
fix typo
kamranayub May 23, 2020
49d2f44
Address file system clarification, link to example templates
kamranayub May 23, 2020
879027d
Add base uri info
kamranayub May 23, 2020
da8c057
mention tiled
kamranayub May 23, 2020
5e23c06
fix formatting in drawing animation section
kamranayub May 23, 2020
7a2d3c1
Add todo
kamranayub May 23, 2020
d894ade
More UI docs, add other pointer events
kamranayub May 23, 2020
233fb10
Fix headings for uniqueness in input
kamranayub May 23, 2020
96e2301
Polish fx
kamranayub May 23, 2020
6069382
Hide math placeholders
kamranayub May 23, 2020
6718df1
Shore up features list
kamranayub May 23, 2020
01d0549
Update docs/99-utilities.md
kamranayub May 23, 2020
968ce2a
Fix timers example and callout adding to game
kamranayub May 23, 2020
ffe0a99
Merge branch 'gh-25/docs-migrate' of https://github.com/excaliburjs/e…
kamranayub May 23, 2020
4cfa1d9
Polish resolution docs
kamranayub May 23, 2020
6785a3f
Fix heading
kamranayub May 23, 2020
e684448
fixes gh-30
kamranayub May 23, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,11 @@ npm-debug.log
TODO.md

# Always-ignore folders
_current
_ghpages
node_modules
.grunt
pages/api/edge
static/docs/api/edge
ex/
.cache/
public/
3 changes: 0 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,6 @@ env:
before_install:
- gem install sass -v 3.4.24
script:
# Remove @types packages that
# conflict with Typedoc builds for Excalibur
- rm -rf ./node_modules/@types/
- npm run docs
- npm run build
after_success:
Expand Down
4 changes: 4 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# frozen_string_literal: true
source "https://rubygems.org"

gem "sass", "3.4.24"
13 changes: 13 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
GEM
remote: https://rubygems.org/
specs:
sass (3.4.24)

PLATFORMS
x64-mingw32

DEPENDENCIES
sass (= 3.4.24)

BUNDLED WITH
2.1.4
1 change: 1 addition & 0 deletions __mocks__/file-mock.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = 'test-file-stub'
6 changes: 5 additions & 1 deletion docs.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ function build(version, title) {
stdio: [0, 1, 2],
})
} else {
child_process.execSync('git restore .', { cwd: exPath, stdio: [0, 1, 2] })
child_process.execSync('git pull', { cwd: exPath, stdio: [0, 1, 2] })
}
child_process.execSync('git rev-parse HEAD', {
Expand Down Expand Up @@ -66,7 +67,10 @@ if (process.argv.length === 3) {
build('edge', 'Edge')
}

if (process.env.TRAVIS_CI && !process.env.GH_TOKEN) {
if (
process.env.SKIP_DOCS_RELEASES ||
(process.env.TRAVIS_CI && !process.env.GH_TOKEN)
) {
console.info(
'Missing GH_TOKEN environment variable, skipping building release tags'
)
Expand Down
2 changes: 2 additions & 0 deletions docs/00-welcome.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,5 @@ path: /docs
Excalibur is a simple, free game engine written in TypeScript for making 2D games in HTML5 canvas. Our goal with Excalibur is to make it _incredibly simple_ to create and write 2D HTML/JS games aimed at folks new to game development all the way up to more experienced game developers. We take care of all the boilerplate engine code, cross-platform targeting, and more so you don’t have to. Use as much or as little as you need!

Excalibur is an open source project licensed under the 2-clause BSD license (this means you can use it in commercial projects!). It’s free and always will be. We welcome any feedback or contributions! If you make something with Excalibur, please [let us know](https://groups.google.com/forum/#!forum/excaliburjs) so we can feature you in our online gallery.

Get started by [installing Excalibur](/docs/installation) in your project and [building your first game](/docs/getting-started), then dive in and learn [how to use Excalibur](/docs/intro). You can also check out the [examples](/examples) collection to see the engine in action with code samples!
15 changes: 7 additions & 8 deletions docs/01-installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -116,11 +116,10 @@ Just include the `excalibur.min.js` file on your page and you’ll be set.
```html
<!DOCTYPE html>
<html lang="en">
<head>
</head>
<body>
<script src="excalibur.min.js"></script>
</body>
<head> </head>
<body>
<script src="excalibur.min.js"></script>
</body>
</html>
```

Expand All @@ -135,7 +134,7 @@ For a simple TypeScript-based game, using triple-slash references works great. I
```js
/// <reference path="node_modules/excalibur/dist/excalibur.d.ts" />

var game = new ex.Engine({ ... });
const game = new ex.Engine({ ... });
```

Make sure the path is relative to the current TS file. You only need to include the reference on your “entrypoint” file. Then simply include `excalibur.min.js` as mentioned above in your HTML page.
Expand Down Expand Up @@ -169,7 +168,7 @@ import * as ex from 'excalibur'

In a module loader system, such as Webpack, it will automatically bundle Excalibur. See the [webpack example repo][example-webpack]

To support tree-shaking, you should use *named imports*:
To support tree-shaking, you should use _named imports_:

```js
import { Actor } from 'excalibur'
Expand All @@ -179,4 +178,4 @@ import { Actor } from 'excalibur'
Excalibur doesn't do the best optimization to support tree-shaking--likely you'll end up importing everything.
</docs-note>

[example-webpack]: https://github.com/excaliburjs/example-ts-webpack
[example-webpack]: https://github.com/excaliburjs/example-ts-webpack
78 changes: 45 additions & 33 deletions docs/02-getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,19 @@ path: /docs/getting-started

Review the [Installing Excalibur.js][docs-install] for instructions.

## Global Namespace vs. Imports

In this tutorial, we are using the global `ex.` namespace, which works within a browser environment. If you are using ES2015 modules, you would replace `ex.` with an import statement at the top of the file:

```ts
import * as ex from 'excalibur'
```

<docs-note>See [notes about ES2015 imports](/docs/installation#module-loaders-and-bundlers) with module loaders and bundlers.</docs-note>

## Build Your Game Script

Create a script in your project, here I’ve named it `game.js`. Excalibur games are built off of the `ex.Engine` container. It is important to start the engine once you are done building your game.
Create a script in your project, here I’ve named it `game.js`. Excalibur games are built off of the [ex.Engine](/docs/intro) container. It is important to start the engine once you are done building your game.

<docs-note>Call `game.start()` right away so you don’t forget</docs-note>

Expand All @@ -19,7 +29,7 @@ Create a script in your project, here I’ve named it `game.js`. Excalibur games
// Create an instance of the engine.
// I'm specifying that the game be 800 pixels wide by 600 pixels tall.
// If no dimensions are specified the game will be fullscreen.
var game = new ex.Engine({
const game = new ex.Engine({
width: 800,
height: 600,
})
Expand All @@ -33,13 +43,12 @@ Include your game script after the excalibur script.

```html
<html>
<head>
</head>
<body>
<head> </head>
<body>
<!-- Include your script at the end of the body tag -->
<script src="excalibur-version.js"></script>
<script src="game.js"></script>
</body>
</body>
</html>
...
```
Expand All @@ -60,15 +69,15 @@ To do this Excalibur uses a primitive called an [Actor][docs-actor], and places
// game.js

// Create an instance of the engine.
var game = new ex.Engine({
const game = new ex.Engine({
width: 800,
height: 600,
})

// Create an actor with x position of 150px,
// y position of 40px from the bottom of the screen,
// width of 200px, height and a height of 20px
var paddle = new ex.Actor(150, game.drawHeight - 40, 200, 20)
const paddle = new ex.Actor(150, game.drawHeight - 40, 200, 20)

// Let's give it some color with one of the predefined
// color constants
Expand All @@ -93,7 +102,7 @@ That’s neat, but this game is way more fun if things move around. Let’s make

```js
// Add a mouse move listener
game.input.pointers.primary.on('move', function(evt) {
game.input.pointers.primary.on('move', function (evt) {
paddle.pos.x = evt.target.lastWorldPos.x
})
```
Expand All @@ -102,7 +111,7 @@ What’s breakout without the ball? To make the ball bounce, Excalibur comes pre

```js
// Create a ball
var ball = new ex.Actor(100, 300, 20, 20)
const ball = new ex.Actor(100, 300, 20, 20)

// Set the color
ball.color = ex.Color.Red
Expand All @@ -119,12 +128,12 @@ ball.collisionType = ex.CollisionType.Passive
// "ex.CollisionType.Fixed - this means participate, but this object is unmovable"

// On collision bounce the ball
ball.on('precollision', function(ev) {
ball.on('precollision', function (ev) {
// reverse course after any collision
// intersections are the direction body A has to move to not be clipping body B
// `ev.intersection` is a vector `normalize()` will make the length of it 1
// `negate()` flips the direction of the vector
var intersection = ev.intersection.normalize()
const intersection = ev.intersection.normalize()

// The largest component of intersection is our axis to flip
if (Math.abs(intersection.x) > Math.abs(intersection.y)) {
Expand All @@ -142,7 +151,7 @@ The ball will now bounce off of the paddle, but does not bounce with the side of

```js
// Wire up to the postupdate event
ball.on('postupdate', function() {
ball.on('postupdate', function () {
// If the ball collides with the left side
// of the screen reverse the x velocity
if (this.pos.x < this.width / 2) {
Expand All @@ -167,7 +176,7 @@ Don’t like square balls? Neither do we. You can create your own custom drawing

```js
// Draw is passed a rendering context and a delta in milliseconds since the last frame
ball.draw = function(ctx, delta) {
ball.draw = function (ctx, delta) {
// Optionally call original 'base' method
// ex.Actor.prototype.draw.call(this, ctx, delta)

Expand All @@ -188,20 +197,20 @@ Breakout needs some bricks to break. To do this we calculate our brick layout an
// Build Bricks

// Padding between bricks
var padding = 20 // px
var xoffset = 65 // x-offset
var yoffset = 20 // y-offset
var columns = 5
var rows = 3
const padding = 20 // px
const xoffset = 65 // x-offset
const yoffset = 20 // y-offset
const columns = 5
const rows = 3

var brickColor = [ex.Color.Violet, ex.Color.Orange, ex.Color.Yellow]
const brickColor = [ex.Color.Violet, ex.Color.Orange, ex.Color.Yellow]

// Individual brick width with padding factored in
var brickWidth = game.drawWidth / columns - padding - padding / columns // px
var brickHeight = 30 // px
var bricks = []
for (var j = 0; j < rows; j++) {
for (var i = 0; i < columns; i++) {
const brickWidth = game.drawWidth / columns - padding - padding / columns // px
const brickHeight = 30 // px
const bricks = []
for (let j = 0; j < rows; j++) {
for (let i = 0; i < columns; i++) {
bricks.push(
new ex.Actor(
xoffset + i * (brickWidth + padding) + padding,
Expand All @@ -214,7 +223,7 @@ for (var j = 0; j < rows; j++) {
}
}

bricks.forEach(function(brick) {
bricks.forEach(function (brick) {
// Make sure that bricks can participate in collisions
brick.collisionType = ex.CollisionType.Active

Expand All @@ -227,7 +236,7 @@ When the ball collides with bricks, we want to remove them from the scene. Updat

```js
// On collision remove the brick, bounce the ball
ball.on('precollision', function(ev) {
ball.on('precollision', function (ev) {
if (bricks.indexOf(ev.other) > -1) {
// kill removes an actor from the current scene
// therefore it will no longer be drawn or updated
Expand All @@ -238,7 +247,7 @@ ball.on('precollision', function(ev) {
// intersections are the direction body A has to move to not be clipping body B
// `ev.intersection` is a vector `normalize()` will make the length of it 1
// `negate()` flips the direction of the vector
var intersection = ev.intersection.normalize()
const intersection = ev.intersection.normalize()

// The largest component of intersection is our axis to flip
if (Math.abs(intersection.x) > Math.abs(intersection.y)) {
Expand All @@ -252,18 +261,21 @@ ball.on('precollision', function(ev) {
Finally, if the ball leaves the screen, the player loses!

```js
ball.on('exitviewport', function() {
ball.on('exitviewport', function () {
alert('You lose!')
})
```

![Final Breakout screenshot](02-getting-started/breakout-final.png)

Congratulations! You have just created your first game in Excalibur! Please review the documentation for more examples and an [API Reference][docs-api].
Congratulations! You have just created your first game in Excalibur!

It's time to [get introduced][docs-intro] to the engine for more examples or advanced users can browse the [API Reference][docs-api].

<script async src="//jsfiddle.net/excaliburjs/s33mLjn3/embed/js,result/"></script>
<iframe width="100%" height="700" src="//jsfiddle.net/excaliburjs/s33mLjn3/embedded/js,result/" allowfullscreen="allowfullscreen" allowpaymentrequest frameborder="0"></iframe>

[docs-install]: /docs/installation
[docs-actor]: /docs/api/edge/classes/_actor_.actor.html
[docs-scene]: /docs/api/edge/classes/_scene_.scene.html
[docs-intro]: /docs/intro
[docs-actor]: /docs/actors
[docs-scene]: /docs/scenes
[docs-api]: /docs/api/edge
32 changes: 14 additions & 18 deletions docs/03-features.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,26 +3,22 @@ title: Features
path: /docs/features
---

We are still pre-1.0 but Excalibur has many powerful features built-in already that make it simple
to build and design your games:
We are still pre-1.0 but Excalibur has many powerful features built-in already that let you focus on building and designing your games:

- Built with [TypeScript](https://www.typescriptlang.org) first
- [Fully-documented API](https://excaliburjs.com/docs/api/edge)
- Works in all major browsers (Chrome, Firefox, IE11) and most mobile browsers (Android Chrome, Apple Safari). We strive to support the last two major versions.
- HTML Canvas-based rendering engine
- Full Web Audio support and fallback HTML5 audio support
- Full HTML5 Gamepad API support
- Full keyboard, mouse, and touch support using a unified Pointers API
- Support for basic collisions
- Support for [rigid body physics system](https://excaliburjs.com/docs/api/edge/classes/_physics_.physics.html)
- Cross-platform support using [Electron](http://electron.atom.io/) or [Apache Cordova](https://cordova.apache.org/)
- Simple `update`/`draw` pattern to keep logic and drawing separated
- Simple `Actor` model with `Scenes`, Actions API, cameras, and more
- Preloader API supporting resources like images, sounds, video, and generic resources
- Basic primitives like sprites, spritesheets, animations, and textures
- Sprite effects, particle emitters and post processor support
- Works in all major browsers (Chrome, Firefox, Edge) and most mobile browsers (Android Chrome, Apple Safari). We strive to support the last two major versions.
- HTML Canvas-based rendering engine (WebGL is coming in 1.0!)
- [Actor model](/docs/actors) with [Scenes](/docs/scenes), cameras, and more
- Designed to keep [logic and drawing separated](/docs/intro)
- Asset loading for [images, sounds, video, and generic resources](/docs/assets)
- Basic [drawing primitives](/docs/drawings) like sprites, spritesheets, animations, and textures
- Support for [rigid body physics](/docs/physics)
- Game input with [keyboard, mouse, and gamepads support](/docs/input)
- Support for tile-based maps (with [Tiled support](https://github.com/excaliburjs/excalibur-tiled))
- Logging API for debugging
- Promises-based async API
- Math API with `Vectors`, `Rays`, `Lines`, `Projections`, and more
- [Sprite effects, particle emitters and post processor support](/docs/fx)
- [Math API](/docs/math) with `Vectors`, `Rays`, `Lines`, `Projections`, and more
- Publish games using [Electron](http://electron.atom.io/), [Apache Cordova](https://cordova.apache.org/), Ionic or anything else that supports a `WebView`
- [Utilities](/docs/utilities) such as logging API for debugging
- Promise-based async API
- and much more!
Loading