Skip to content

Commit

Permalink
Laika website (#588)
Browse files Browse the repository at this point in the history
* WIP Laika site

* Cleaned up doc titles

* Fixed navigation order

* Better section headings

* Working on styles...

* Better colors with custom CSS

* Site building machinery

* Added favicons

* Fixed build script issues

* Remove old website stuff

* Rename website2 to website
  • Loading branch information
davesmith00000 authored Aug 19, 2023
1 parent 76a5477 commit 5297c87
Show file tree
Hide file tree
Showing 188 changed files with 312 additions and 31,799 deletions.
12 changes: 6 additions & 6 deletions indigo/build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@ ThisBuild / scalaVersion := scala3Version

lazy val indigoVersion = IndigoVersion.getVersion
// For the docs site
lazy val indigoDocsVersion = "0.14.0"
lazy val tyrianDocsVersion = "0.6.0"
lazy val indigoDocsVersion = "0.15.0-RC3"
lazy val tyrianDocsVersion = "0.7.1"
lazy val scalaJsDocsVersion = "1.13.1"
lazy val scalaDocsVersion = "3.3.0"
lazy val sbtDocsVersion = "1.9.0"
lazy val millDocsVersion = "0.10.12"
lazy val sbtDocsVersion = "1.9.2"
lazy val millDocsVersion = "0.11.0"

lazy val commonSettings: Seq[sbt.Def.Setting[_]] = Seq(
version := indigoVersion,
Expand Down Expand Up @@ -194,8 +194,8 @@ lazy val jsdocs = project
"io.indigoengine" %%% "indigo-json-circe" % indigoDocsVersion,
"io.indigoengine" %%% "indigo" % indigoDocsVersion,
"io.indigoengine" %%% "indigo-extras" % indigoDocsVersion,
"io.indigoengine" %%% "tyrian-io" % tyrianDocsVersion,
"io.indigoengine" %%% "tyrian-indigo-bridge" % tyrianDocsVersion
"io.indigoengine" %%% "tyrian-io" % tyrianDocsVersion//,
// "io.indigoengine" %%% "tyrian-indigo-bridge" % tyrianDocsVersion
)
)
.enablePlugins(ScalaJSPlugin)
Expand Down
1 change: 1 addition & 0 deletions indigo/docs/01-quickstart/directory.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
laika.title = "Setup & Configuration"
Original file line number Diff line number Diff line change
@@ -1,16 +1,11 @@
---
id: examples
title: Examples
---
# Examples

At various points in Indigo's development, little games and examples have been made. These help drive out requirements, test the feel of the engine against real examples and help ensure the build is stable.

They are not always very polished, but they are small and reasonably easy to follow.

> The examples have moved. They now track the latest public release!
They can all be found in the [indigo-examples](https://github.com/PurpleKingdomGames/indigo-examples) repo.

Please visit the [repo](https://github.com/PurpleKingdomGames/indigo-examples) for more information.

You can play a game of [Snake](/snake.html) and try the [The Cursed Pirate](/pirate.html) demo on this site. Please note that The Cursed Pirate is not a game, just a little demo of how you might build a platformer.
You can play a game of Snake and try the The Cursed Pirate Demo demo on this site. Please note that The Cursed Pirate is not a game, just a little demo of how you might build a platformer.
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
---
id: hello-indigo
title: Hello, Indigo!
---
# Hello, Indigo!

This is a quick start tutorial to help you build something with Indigo.

Expand All @@ -23,15 +20,15 @@ In this guide, we'll be using `IndigoSandbox` for brevity and our "game" will be
## "Hello, Indigo!"

We'll skip over the initial project set up and assume that you followed the [set up guide](setup-and-configuration.md), or have [checked out the repo](https://github.com/PurpleKingdomGames/hello-indigo) for reference.
We'll skip over the initial project set up and assume that you followed the [set up guide](quickstart.md), or have [checked out the repo](https://github.com/PurpleKingdomGames/hello-indigo) for reference.

Here is our starting point:

```scala mdoc:js:shared
import indigo.*
import scala.scalajs.js.annotation.JSExportTopLevel

@JSExportTopLevel("IndigoGame")
// @JSExportTopLevel("IndigoGame") // Pandering to mdoc
object HelloIndigo extends IndigoSandbox[Unit, Unit] {

val config: GameConfig =
Expand Down Expand Up @@ -100,7 +97,7 @@ One small thing to note is that most types in Indigo try to provide sensible def

We're going to follow the Mill version of the project below, but the SBT version is almost identical, substituting `sbt runGame` in place of `mill helloindigo.runGame`.

So assuming you have followed the [set up guide](setup-and-configuration.md), to run the demo enter the following from your command line:
So assuming you have followed the [set up guide](quickstart.md), to run the demo enter the following from your command line:

```bash
mill helloindigo.runGame
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
---
id: project-templates
title: Mill & SBT Game Templates
---
# Mill & SBT Templates

To help you get started quickly, we've put together a minimal project template for both [Mill](http://www.lihaoyi.com/mill/) and [SBT](https://www.scala-sbt.org/).

Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
---
id: setup-and-configuration
title: Setup & Configuration
---

## Quick setup
# Quick start

### Using giter8 / sbt new

Expand Down
1 change: 1 addition & 0 deletions indigo/docs/02-guides/directory.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
laika.title = Guides
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
---
id: howto-custom-entity
title: How to make a custom entity
---
# How to make a custom entity

## What are custom entities?

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
---
id: howto-fire-shader
title: How to write a fire shader
---
# How to write a fire shader

In this how-to guide, we're going to look at one approach to writing a little shader that produces procedural flames. Here's one I made earlier:

Expand Down Expand Up @@ -48,7 +45,7 @@ final case class Fire(
ShaderData(
Fire.shaderId,
UniformBlock(
"FireData",
UniformBlockName("FireData"),
Batch(
Uniform("OFFSET") -> float(offset),
Uniform("COLOR_OUTER") -> vec3(outer.r, outer.g, outer.b),
Expand Down Expand Up @@ -172,7 +169,7 @@ def toShaderData: ShaderData =
ShaderData(
Fire.shaderId,
UniformBlock(
"FireData",
UniformBlockName("FireData"),
Batch(
Uniform("OFFSET") -> float(offset),
Uniform("COLOR_OUTER") -> vec3(outer.r, outer.g, outer.b),
Expand All @@ -194,7 +191,7 @@ layout (std140) uniform FireData {
};
```

At some point in the future it would be good to improve the type safety around the relationship across this interface, but for now, please take care. More information on how this works including the **all important packing rules** can be found in the [Shaders Overview](shaders/shader-overview.md).
At some point in the future it would be good to improve the type safety around the relationship across this interface, but for now, please take care. More information on how this works including the **all important packing rules** can be found in the [Shaders Overview](/07-shaders/shaders-overview.md).

### UVs

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
---
id: howto-responsive-ui-with-tyrian
title: How to make a responsive UI using Tyrian
---
# How to make a responsive UI using Tyrian

## Responsive UI Using Tyrian

Expand Down Expand Up @@ -36,7 +33,7 @@ These are the steps we're going to take:
* [Set up the environment](#setting-up-the-environment) - e.g. clone `hello-indigo` and set up ParcelJS
* [Modify our build files](#setting-up-the-build) - e.g. update our `build.sbt` or `build.sc` files
* [Create our static files](#setting-up-the-html-and-parceljs) - e.ge create our html, js, css and other static content
* [Update Indigo with a new subsystem](#update-helloindigoscala) and [Initialise our Tyrian app](#create-a-tyrian-app)
* [Update Indigo with a new subsystem](#update-helloindigo-scala) and [Initialise our Tyrian app](#create-a-tyrian-app)
* [Get Tyrian publishing messages to Indigo](#tyrian-to-indigo-communication) (and Indigo to subscribe to them)
* [Get Indigo publishing messages to Tyrian](#indigo-to-tyrian-communication) (and Tyrian to subscribe to them)
* And finally [creating a responsive UI in CSS](#responsive-ui)
Expand All @@ -57,7 +54,7 @@ follow [this guide](howto-indigo-game.md)
or replace `HelloIndigo.scala` with
[this](https://gist.github.com/hobnob/c24f00936e91a7b7e5d644d19e4f1b32)

```scala mdoc:js:shared:invisible
```scala
import indigo.*
import indigo.scenes.*
import tyrian.TyrianSubSystem
Expand Down Expand Up @@ -373,7 +370,7 @@ Create a new file called `HelloTyrian.scala` inside the `helloindigo/src` folder
and add the following contents found below, or
[here](https://gist.github.com/hobnob/436318b3ae5eed5891ba2b18bb8c264b).

```scala mdoc:js
```scala
import cats.effect.IO
import tyrian.*
import tyrian.Html.*
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
---
id: howto-indigo-game
title: Converting `IndigoSandbox` to `IndigoGame`
---
# Converting `IndigoSandbox` to `IndigoGame`

## Basic Concepts

Expand Down
1 change: 1 addition & 0 deletions indigo/docs/03-gameloop/directory.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
laika.title = Gameloop
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
---
id: events
title: Events
---
# Events

## The event loop

Expand Down Expand Up @@ -71,7 +68,7 @@ of the site, and will also fire when the application loses or gains focus.

### `InputEvent`s

Handling `InputEvent`s can be a bit tricky in some situations, so Indigo includes `Mouse` and `Keyboard` classes that can be accessed from the [frame context](gameloop/frame-context.md), providing a rich interface to gather more complex information from those input devices.
Handling `InputEvent`s can be a bit tricky in some situations, so Indigo includes `Mouse` and `Keyboard` classes that can be accessed from the [frame context](/03-gameloop/frame-context.md), providing a rich interface to gather more complex information from those input devices.

#### `MouseEvent`s

Expand Down Expand Up @@ -137,7 +134,7 @@ the internet or indeed a single resource on the internet is available.
- `HttpError` - Unspecified error
- `HttpResponse(status, headers, body)`

### `StorageEvent`s
### StorageEvents

Used to load and save data from local storage.

Expand All @@ -155,7 +152,7 @@ be raised as a separate event.
- `FeatureNotAvailable(key, actionType)` - The storage feature is not available
- `Unspecified(key, actionType, message)` - An unknown error

### `AssetEvent`s
### AssetEvents

These are the low level events used to load additional assets at runtime. If you want a slightly more sophisticated loading experience, please look at the asset bundle loader sub system.

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
---
id: frame-context
title: Frame context
---
# Frame context

Updating a frame in Indigo is principally about doing two things:

Expand Down Expand Up @@ -39,7 +36,7 @@ The problem is that `Random` goes against our referential transparency principle

> Side note: Testing this kind of behavior with property based testing techniques works very well and often neatly side steps the issue of unknown values.
Similar problems occur if you attempt to implement [frame independence](/docs/information/glossary#frame-independence) based on the elapsed time. You could add a last updated field to Bob's model and use `System.currentTimeMillis` to get the delta, but again, how would you write a test for that.
Similar problems occur if you attempt to implement [frame independence](/10-information/glossary.md) based on the elapsed time. You could add a last updated field to Bob's model and use `System.currentTimeMillis` to get the delta, but again, how would you write a test for that.

The problem is that `Random` and `System.currentTimeMillis` are side effecting and that makes them hard to test.

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
---
id: outcome
title: Outcome Type
---
# Outcome Type

## What is an Outcome?

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
---
id: boot-and-start-up
title: Boot & Start Up
---
# Boot & Start Up

> Please note that the terms "start up" and "setup" are used interchangeably here. "Startup" is the name of the data type, while "setup" is the name of the method. This naming should probably be revisited...
Expand All @@ -10,7 +7,7 @@ In order to get your game up and running, it needs to go through an initializati
1. Boot - which only ever happens once;
2. Start up - which occurs on first run, and then whenever new assets are loaded dynamically.

A lot of what this process relates to is the loading and processing of assets, so it's worth [reading up on that too](platform/assets.md).
A lot of what this process relates to is the loading and processing of assets, so it's worth [reading up on that too](/05-platform/assets.md).

## Booting your game

Expand Down Expand Up @@ -83,7 +80,7 @@ IndigoGame.halt();

Calling `halt` does not clean up your page in any way, the assumption is that you will remove the relevant HTML dom nodes.

#### BootResult[_]
#### BootResult

In a simple game, all of your animations, fonts, subsystems, shaders, and assets can be declared during the boot stage. For more complex games, such as ones that have a pre-loader, you should only include the elements you need for the preloader scene here.

Expand Down
1 change: 1 addition & 0 deletions indigo/docs/04-organisation/directory.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
laika.title = Organisation
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
---
id: game-entry-points
title: Game Entry Points
---
# Game Entry Points

Entry points are typically traits that you extend in order to write your game, and they provide the basic structure that you need to adhere to, to make a game that Indigo understands. What they actually do underneath is provide a user friendly way to build the frame processor and start the engine that does all of the work.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ final case class PointsTrackerExample(startingPoints: Int) extends SubSystem:
val id: SubSystemId = SubSystemId("points tracker")

val eventFilter: GlobalEvent => Option[PointsTrackerEvent] = {
case e: PointsTrackerEvent => Option(e)
case _ => None
case e: PointsTrackerEvent @unchecked => Option(e)
case _ => None
}

def initialModel: Outcome[Int] =
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
---
id: assets
title: Assets & Asset Loading
---
# Assets & Asset Loading

## Asset Types

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
---
id: cross-platform-publishing
title: Cross Platform Publishing
---
# Cross Platform Publishing

Indigo supports basic publishing to/building for the following platforms:

Expand Down
1 change: 1 addition & 0 deletions indigo/docs/05-platform/directory.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
laika.title = "Platform & IO"
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
---
id: importers
title: File Format Importers
---
# File Importers

At the time of writing, Indigo has limited support for importing data from Aseprite and Tiled. The support that has been added was built on an "as needed" basis, and is far from complete.

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
---
id: input-handling
title: User Input Handling
---
# Input Handling

At the time of writing, Indigo understands three input device types: Mouse, Keyboard, and Gamepad.

Expand All @@ -20,15 +17,15 @@ There are input actions that are best represented as events, a mouse click for e

Input events only (currently) cover Mouse and Keyboard events, _not gamepads_, and can be detected during the model or view model update functions as you would any other event.

For more information, please see the [events](gameloop/events.md) page.
For more information, please see the [events](/03-gameloop/events.md) page.

## InputState (Continuous signals)

There are other types of input that don't make as much sense as events.

It is possible in Indigo to listen to every distinct mouse move event for example, but that is almost certainly not what you actually want to do. Most likely, what you really want is the cumulative position at the point that this frame is being processed.

Indigo does this by sampling the input states of the mouse, keyboard and gamepad and allowing you to access it through the [frame context](gameloop/frame-context.md).
Indigo does this by sampling the input states of the mouse, keyboard and gamepad and allowing you to access it through the [frame context](/03-gameloop/frame-context.md).

> Note that this is how gamepads are usually modeled and at the moment Indigo is no exception. Adding discrete events for specific button presses to emulate mouse-like behavior is under consideration.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
---
id: loading-and-saving-data
title: Loading & Saving Data
---
# Loading & Saving Data

Sooner or later, you're probably going to need to load data into your game or save user data.

### Dealing with save games

When you think of loading and saving, probably the first thing that comes to mind is save games.

Currently Indigo's local storage options are a bit limited, but what you can do is [storage events](/docs/gameloop/events#storageevents).
Currently Indigo's local storage options are a bit limited, but what you can do is [storage events](/03-gameloop/events.md#storageevents).

Storage events use your browsers local storage, which you can think of like a key value store. You process might be:

Expand All @@ -22,11 +19,11 @@ Storage events use your browsers local storage, which you can think of like a ke

### Loading local data

You can always load data in plain text format (that could be JSON or CSV for example), by using making use of the [asset loading](/docs/platform/assets#asset-loading) functionality. This allows you to dynamically load a data file at any time, process it, and apply it to you model.
You can always load data in plain text format (that could be JSON or CSV for example), by using making use of the [asset loading](/05-platform/assets.md#asset-loading) functionality. This allows you to dynamically load a data file at any time, process it, and apply it to you model.

### Loading and saving over a network

The other way to load and save data might be over a network, please see the [networking page for details](platform/networking.md).
The other way to load and save data might be over a network, please see the [networking page for details](/05-platform/networking.md).

Similar to the save game flow, you might do something like:

Expand Down
Loading

0 comments on commit 5297c87

Please sign in to comment.