Skip to content

Commit

Permalink
docs part 2
Browse files Browse the repository at this point in the history
  • Loading branch information
xShadowBlade committed Feb 7, 2024
1 parent fd6f27b commit e3ea8f3
Show file tree
Hide file tree
Showing 156 changed files with 17,654 additions and 1,563 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/static.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
push:
branches: ["main"]
paths:
- "website/build/**"
- "documentation/production/**"

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
Expand Down Expand Up @@ -39,7 +39,7 @@ jobs:
uses: actions/upload-pages-artifact@v2
with:
# Upload entire repository
path: 'website/build'
path: 'documentation/production'
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v2
4 changes: 2 additions & 2 deletions dist/game/eMath.game.js
Original file line number Diff line number Diff line change
Expand Up @@ -2554,7 +2554,7 @@ function plainToInstance(cls, plain, options) {
// src/game/managers/dataManager.ts
var import_currency = require("../main/emath.js");
var import_attribute = require("../main/emath.js");
var import_e = __toESM(require("../main/emath.js"));
var import_e = require("../main/emath.js");
function md5(_) {
var $ = "0123456789abcdef";
function n(_2) {
Expand Down Expand Up @@ -2808,7 +2808,7 @@ var dataManager = class {
// },
},
{
class: import_e.default
class: import_e.Decimal
}
]);
function compareArrays(arr1, arr2) {
Expand Down
4 changes: 2 additions & 2 deletions dist/game/eMath.game.min.js

Large diffs are not rendered by default.

13 changes: 6 additions & 7 deletions dist/main/eMath.js
Original file line number Diff line number Diff line change
Expand Up @@ -5032,13 +5032,12 @@ var formats = { ...FORMATS, ...{
ev
} };
Decimal.formats = formats;
var e_default = Decimal;

// src/E/eMain.ts
var E = (x) => new e_default(x);
Object.getOwnPropertyNames(e_default).filter((b) => !Object.getOwnPropertyNames(class {
var E = (x) => new Decimal(x);
Object.getOwnPropertyNames(Decimal).filter((b) => !Object.getOwnPropertyNames(class {
}).includes(b)).forEach((prop) => {
E[prop] = e_default[prop];
E[prop] = Decimal[prop];
});

// src/classes/boost.ts
Expand Down Expand Up @@ -5231,7 +5230,7 @@ __decorateClass([
Expose()
], upgradeData.prototype, "id", 2);
__decorateClass([
Type(() => e_default)
Type(() => Decimal)
], upgradeData.prototype, "level", 2);
var upgradeStatic = class {
get data() {
Expand Down Expand Up @@ -5275,7 +5274,7 @@ var currency = class {
}
};
__decorateClass([
Type(() => e_default)
Type(() => Decimal)
], currency.prototype, "value", 2);
__decorateClass([
Type(() => upgradeData)
Expand Down Expand Up @@ -5498,7 +5497,7 @@ var attribute = class {
}
};
__decorateClass([
Type(() => e_default)
Type(() => Decimal)
], attribute.prototype, "value", 2);
var attributeStatic = class {
get pointer() {
Expand Down
2 changes: 1 addition & 1 deletion dist/main/eMath.min.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dist/pixiGame/eMath.pixiGame.js
Original file line number Diff line number Diff line change
Expand Up @@ -1492,7 +1492,7 @@ function plainToInstance(cls, plain, options) {
// src/game/managers/dataManager.ts
var import_currency = require("../main/emath.js");
var import_attribute = require("../main/emath.js");
var import_e = __toESM(require("../main/emath.js"));
var import_e = require("../main/emath.js");
function md5(_) {
var $ = "0123456789abcdef";
function n(_2) {
Expand Down Expand Up @@ -1746,7 +1746,7 @@ var dataManager = class {
// },
},
{
class: import_e.default
class: import_e.Decimal
}
]);
function compareArrays(arr1, arr2) {
Expand Down
4 changes: 2 additions & 2 deletions dist/pixiGame/eMath.pixiGame.min.js

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion docs/assets/navigation.js

This file was deleted.

1 change: 0 additions & 1 deletion docs/assets/search.js

This file was deleted.

25 changes: 0 additions & 25 deletions docs/classes/game.keyManager.html

This file was deleted.

2 changes: 0 additions & 2 deletions docs/functions/game_hookGame.hookGame.html

This file was deleted.

1 change: 0 additions & 1 deletion docs/functions/pixiGame_hookPixiGame.hookPixiGame.html

This file was deleted.

10 changes: 0 additions & 10 deletions docs/modules/game.html

This file was deleted.

1 change: 0 additions & 1 deletion docs/types/game_hookGame.eMathGameWeb.html

This file was deleted.

1 change: 0 additions & 1 deletion docs/variables/game_game.gameDefaultConfig.html

This file was deleted.

3 changes: 3 additions & 0 deletions documentation/README copy.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Website

This website is built using [Docusaurus 2](https://docusaurus.io/), a modern static website generator.
41 changes: 41 additions & 0 deletions documentation/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Website

This website is built using [Docusaurus](https://docusaurus.io/), a modern static website generator.

### Installation

```
$ yarn
```

### Local Development

```
$ yarn start
```

This command starts a local development server and opens up a browser window. Most changes are reflected live without having to restart the server.

### Build

```
$ yarn build
```

This command generates static content into the `build` directory and can be served using any static contents hosting service.

### Deployment

Using SSH:

```
$ USE_SSH=true yarn deploy
```

Not using SSH:

```
$ GIT_USER=<Your GitHub username> yarn deploy
```

If you are using GitHub pages for hosting, this command is a convenient way to build the website and push to the `gh-pages` branch.
3 changes: 3 additions & 0 deletions documentation/babel.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = {
presets: [require.resolve("@docusaurus/core/lib/babel/preset")],
};
37 changes: 37 additions & 0 deletions documentation/docs/install.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
---
id: install
title: Installation Guide
sidebar_label: Installation
---

---

You can install ``eMath.js`` via [npm](#install-via-npm) or include it in your HTML file via a [CDN](#include-using-cdn).

### Install via npm:

```bash
npm install emath.js
```

The package exports a default export named ``eMath``. Use as the following: (CJS support only in version ^2.0.0)

```js
import eMath from "emath.js";
```

### Include using CDN
**NOTE: This will not include types**
#### Development Build

```html
<script src="https://cdn.jsdelivr.net/gh/xShadowBlade/emath.js/dist/eMath.bundle.js"></script>
```

#### Production/Minified Build

```html
<script src="https://cdn.jsdelivr.net/gh/xShadowBlade/emath.js/dist/eMath.min.js"></script>
```

After you install, check out the [usage docs](./usage)
25 changes: 25 additions & 0 deletions documentation/docs/intro.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
---
id: intro
title: Welcome to eMath.js Documentation
sidebar_label: Introduction
---

---

Welcome to the documentation for eMath.js - a JavaScript library for enhancing incremental game development.

### Features

- **Support for Node.js and HTML**: eMath.js can be used in both Node.js and HTML projects.

- **Support for Typescript**: eMath.js exports type definitions to help develop your projects.

- **Integration**: eMath.js integrates with break_eternity.js, providing a robust foundation for your game development projects.

- **Advanced Formatting**: Enjoy advanced formatting capabilities to enhance the visual appeal of your in-game elements.

- **Boosts, Currency, and Attributes Management**: Leverage eMath.js classes to effortlessly manage boosts, currency, and attributes within your game.

### Getting Started

To get started with eMath.js, check out the [installation guide](./install) and [basic usage examples](./usage). If you encounter any issues or have questions, feel free to explore the comprehensive documentation.
9 changes: 9 additions & 0 deletions documentation/docs/tutorials/coinGame/code/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<!DOCTYPE html>
<html>
<head>
<script src="https://cdn.jsdelivr.net/gh/xShadowBlade/emath.js/dist/eMath.bundle.js"></script>
<script src="./script.js"></script>
</head>
<body>
</body>
</html>
79 changes: 79 additions & 0 deletions documentation/docs/tutorials/coinGame/code/script.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
/*
* In this example, we will create a button
* that when pressed gives you coins that you can use
* on an upgrade that gives you more coins on gain.
*/

/* global window document eMath */
window.addEventListener("load", () => {
const { E } = eMath;

// Initialize currency and static currency

const currency = new eMath.classes.currency();
const staticC = new eMath.classes.currencyStatic(() => currency);

// Create Coins Display

const coinsDisplay = document.createElement("p");
document.body.appendChild(coinsDisplay);
coinsDisplay.id = "coinsDisplay";

// Function to update the coins display

function updateDisplay () {
document.getElementById("coinsDisplay").innerHTML = `Coins: ${currency.value.format()} (x${staticC.boost.calculate().format()})`; // Updates the display and shows the multiplier. Ex. "Coins: 2.00 (x1.0)"
}
updateDisplay();

// Create gain button

const gainButton = document.createElement("button");
gainButton.innerHTML = "Gain Coins";
document.body.appendChild(gainButton);
gainButton.addEventListener("click", () => {
// Triggers when button is pressed
staticC.gain(); // Gain
updateDisplay(); // Updates the display for the amount of coins
updateDisplayUpgrade();
});

// Upgrades

staticC.addUpgrade([
{
name: "Basic Coin Boost",
cost: E(10),
costScaling: n => n.mul(2),
maxLevel: E(1000),
effect: function () {
console.log(this);
const level = this.getLevel();
console.log(level);

staticC.boost.bSet(
"boostUpg1Coins",
"Basic Coin Boost",
"Basic Coin Boost",
n => E(n).plus(level).sub(1),
1,
);
},
},
]);

// Buy Upgrades button

const buyUpgradesButton = document.createElement("button");
document.body.appendChild(buyUpgradesButton);
buyUpgradesButton.id = "buyUpgradesButton";
function updateDisplayUpgrade () {
document.getElementById("buyUpgradesButton").innerHTML = `Buy ${staticC.calculateUpgrade(0, 1)[0]} Upgrades for ${staticC.calculateUpgrade(0, 1)[1]} Coins`;
}
updateDisplayUpgrade();
buyUpgradesButton.addEventListener("click", () => {
staticC.buyUpgrade(0, 100);
updateDisplayUpgrade();
updateDisplay();
});
});
Loading

0 comments on commit e3ea8f3

Please sign in to comment.