Skip to content

Commit

Permalink
Merge commit '64ff5fbe34d0675196bb764e625d524086b1fada'
Browse files Browse the repository at this point in the history
  • Loading branch information
CosmoMyzrailGorynych committed Dec 13, 2023
2 parents a684a9c + 64ff5fb commit 554d3b4
Show file tree
Hide file tree
Showing 90 changed files with 2,156 additions and 1,369 deletions.
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
*.js eol=lf
*.ts eol=lf
*.tag eol=lf
*.pug eol=lf
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@

[![](https://img.shields.io/badge/license-MIT-informational?style=flat-square)](https://github.com/ct-js/ct-js/blob/develop/LICENSE) [![GitHub tag (latest by date)](https://img.shields.io/github/tag-date/ct-js/ct-js?label=version&style=flat-square)](https://github.com/ct-js/ct-js/releases) [![Gitlab CI master branch](https://img.shields.io/gitlab/pipeline-status/CoMiGo/ct-js?branch=master&label=ct.js%20builds&style=flat-square)](https://gitlab.com/CoMiGo/ct-js/-/commits/master) [![Gitlab CI develop branch](https://img.shields.io/gitlab/pipeline-status/CoMiGo/ct-js?branch=develop&label=nightly%20builds&style=flat-square)](https://gitlab.com/CoMiGo/ct-js/-/commits/develop)

[![](https://img.shields.io/discord/490052958310891520?style=flat-square&logo=discord&logoColor=white)](https://discord.gg/CggbPkb) [![GitHub issues by-label](https://img.shields.io/github/issues/ct-js/ct-js/state:to%20do?style=flat-square&label=todo%20issues)](https://github.com/ct-js/ct-js/issues?q=is%3Aissue+is%3Aopen+label%3A%22state%3Ato+do%22) [![GitHub issues by-label](https://img.shields.io/github/issues/ct-js/ct-js/state:current%20release?style=flat-square&label=current%20release%20issues)](https://github.com/ct-js/ct-js/issues?q=is%3Aissue+is%3Aopen+label%3A%22state%3Acurrent+release%22)
[![](https://img.shields.io/discord/490052958310891520?style=flat-square&logo=discord&logoColor=white)](https://discord.gg/yuvuDW5) [![GitHub issues by-label](https://img.shields.io/github/issues/ct-js/ct-js/state:to%20do?style=flat-square&label=todo%20issues)](https://github.com/ct-js/ct-js/issues?q=is%3Aissue+is%3Aopen+label%3A%22state%3Ato+do%22) [![GitHub issues by-label](https://img.shields.io/github/issues/ct-js/ct-js/state:current%20release?style=flat-square&label=current%20release%20issues)](https://github.com/ct-js/ct-js/issues?q=is%3Aissue+is%3Aopen+label%3A%22state%3Acurrent+release%22)
[![GitHub issues by-label](https://img.shields.io/github/issues/ct-js/ct-js/help%20wanted?style=flat-square&label=help%20wanted)](https://github.com/ct-js/ct-js/issues?q=is%3Aissue+is%3Aopen+label%3A%22help+wanted%22)

Ct.js is a 2D game editor that makes its bet on good documentation, visual tools and smooth workflow.

---

For bugs, feature requests, developing questions, please use [GitHub issues](https://github.com/ct-js/ct-js/issues) so we can better track them. For general support about making games, ask a question at our [discord server](https://discord.gg/CggbPkb).
For bugs, feature requests, developing questions, please use [GitHub issues](https://github.com/ct-js/ct-js/issues) so we can better track them. For general support about making games, ask a question at our [discord server](https://discord.gg/yuvuDW5).

---

Expand Down
81 changes: 81 additions & 0 deletions app/Changelog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,84 @@
## v3.3.0

*Thu Dec 14 2023*

### ✨ New Features

* Ct.js now adds hash sums of exported files' names to textures, icons, and your game's source code. It makes it easier to update your games on your own servers and prevents the usage of outdated assets for your players. Note that index.html file should never be cached — the other assets can now be cached. Sounds are currently left with the old behavior as I have bigger plans for them and hashing large sound files is probably not the best idea. If you need to cache-invalidate a sound asset (say, by replacing one sound file with another), you can recreate the sound asset under the same name.
Partially closes #409
* In the room editor, copies now show their templates' names when you hover them.
* Support for TypeScript in custom scripts
* Catmods: New Supabase Module (#425 by @ehanahamed)

### ⚡️ General Improvements

* Adds a transparent PIXI.js canvas option (#437 by @markmehere)
* Adds alpha setting for vkeys (#435 by @markmehere)
* Clamp zoom value in the room editor
Closes #407
* Exclude blank textures from export and retain shape (#433 by @markmehere)
* Introduces ct.keyboard.permitDefault and ct.pointer.permitDefault (#434 by @markmehere)
* Pug files must use LF
* styleUtils to TypeScript and new IStyle interface (#440 by @markmehere)
* Update Dutch translation (#405 by @GambleBranch)
* Update Japanese translation (#404 by @taxi13245)
* Updated lib.es5.d.ts (#432 by @markmehere)

### 🐛 Bug Fixes

* Allow setting scale value with plain numbers, like `this.scale = 5`.
Closes #403
* Allow textures to be set to -1 (#438)
* Fix "Cannot read properties of undefined" when caching tilemaps with funky posisions, which led to rounding errors and negative indices.
* Fix copies' custom properties in the room editor
* Fix shared asset pickers for sounds and emitter tandems
* Fix sounds', tandems', and rooms' IDs not being unwrapped for the content system
* Fixed Android export issue (#444 by @omkarpattanaik)
* Ignore attempts to export mac builds on Windows
* Update Discord invite links (#427 by @cemalgnlts)
* Use collision shape from a texture set in the extensions parameter of ct.templates.copy method

### 🍱 Demos, Dependencies and Stuff

* Update docs. Fix links to tutorials on the onboarding screen

### 📝 Docs

* 📝Fix typo in example code (#108 by @GambleBranch)
* 🐛 Bring back the adequate search plugin that doesn't ignore code in headers
* 🐛 Change a single spelling error in docs/ct.md (#110 by @FlyingPig525)
* 🐛 Fix a typo `created` in sound.howler's docs (#430 by @blueloveTH)
* 🐛 Fix broken links on the homepage
* 🐛 ru/README.md fix links (#106 by @progzone122)
* ✨ Add Giscus commenting service
* ⚡️ Fix dependencies' versions
* ⚡️ Tweak search settings a bit
* ⚡️ Update Vuepress and its theme, add search back
* 🐛 Docs: Fix links in fields-declaration
* 🐛 Docs: Fix links in input-methods
* 🐛 Docs: Fix links in settings-and-extensions
* 📝 Docs: Fix typo in docs/modding-ctjs/fields-declaration.md
* 📝 Fix old injects folder name in other languages
* 📝 Fix wrong injects folder name in events-and-injections.md
* 📝 Fix wrong/outdated injects folder name in mod-structure.md
* 📝 Add a comment to project-selector

### 🌐 Website

* 🐛 Fix links to Discord server
* ⚡️ A little refactor
* ⚡️ Add a line about "broken" files in MacOS to the download page
* ⚡️ Add a line about CoffeeScript into the presskit
* ⚡️ Replace AppImage installer with an .sh one (for Linux platform)
* ⚡️ Update homepage and the changelog

### 🌻 Misc

* 📝 Fix type definitions for ct.backgrounds & gamepad module (#443 by @ehanahamed)
* Update ct.backgrounds typedef
* Update ct.backgrounds.list type
* Added d.ts for gamepad catmod

## v3.2.0

*Mon Dec 26 2022*
Expand Down
73 changes: 73 additions & 0 deletions app/data/ct.libs/gamepad/types.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
declare namespace ct {
/**
* Use gamepads in the actions system
*/
namespace gamepad {
/**
* Represents an event handler that runs when a gamepad is connected or disconnected
* @param event - Run when connected or disconnected
* @param eventHandler - Function to run
*/
function on(event: "connected" | "disconnected", eventHandler:Function): void;
/**
* An array of Gamepad objects, one for each connected gamepad
*/
var list: Array<any>;
/**
* Returns whether the button is pressed (1) or not (0)
* @param code - Button code, can be "Button1", "Button2", "Button3", "Button4", "L1", "R1", "L2", "R2", "Select", "Start", "L3", "R3", "Up", "Down", "Left", "Right", or "Any"
*/
function getButton(
code:
"Button1" |
"Button2" |
"Button3" |
"Button4" |
"L1" |
"R1" |
"L2" |
"R2" |
"Select" |
"Start" |
"L3" |
"R3" |
"Up" |
"Down" |
"Left" |
"Right" |
"Any"
): number;
/**
* Gets the position of a joystick, from -1 to 1, with 0 being its resting position
* @param code - Joystick axis, one of "LStickX", "LStickY", "RStickX", or "RStickY"
*/
function getAxis(
code:
"LStickX" |
"LStickY" |
"RStickX" |
"RStickY"
): number;
/**
* The last button pressed
*/
var lastButton:
"Button1" |
"Button2" |
"Button3" |
"Button4" |
"L1" |
"R1" |
"L2" |
"R2" |
"Select" |
"Start" |
"L3" |
"R3" |
"Up" |
"Down" |
"Left" |
"Right" |
"Any";
}
}
6 changes: 5 additions & 1 deletion app/data/ct.libs/keyboard/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,8 @@ Tells if a `ctrl` button is held now.

## ct.keyboard.clear();

Resets all the parameters listed above.
Resets all the parameters listed above.

## ct.keyboard.permitDefault

When you call `ct.keyboard.permitDefault = true`, tells `ct.keyboard` not to execute `e.preventDefault()`. Useful if you have a HTML text box that must respond to the standard browser events.
9 changes: 7 additions & 2 deletions app/data/ct.libs/keyboard/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
alt: false,
shift: false,
ctrl: false,
permitDefault: false,
clear() {
delete ct.keyboard.lastKey;
delete ct.keyboard.lastCode;
Expand Down Expand Up @@ -40,7 +41,9 @@
ct.keyboard.string = '';
}
}
e.preventDefault();
if (!ct.keyboard.permitDefault) {
e.preventDefault();
}
},
onUp(e) {
ct.keyboard.shift = e.shiftKey;
Expand All @@ -51,7 +54,9 @@
} else {
setKey('Unknown', 0);
}
e.preventDefault();
if (!ct.keyboard.permitDefault) {
e.preventDefault();
}
}
};

Expand Down
6 changes: 6 additions & 0 deletions app/data/ct.libs/keyboard/types.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,12 @@ declare namespace ct {
*/
var ctrl: boolean;

/**
* Temporarily suspend e.preventDefault() calls. For example, to allow for a HTML text
* box to be used.
*/
var permitDefault: boolean;

/**
* Resets all the `ct.keyboard` parameters.
*/
Expand Down
4 changes: 4 additions & 0 deletions app/data/ct.libs/mouse/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,10 @@ Returns `true` if the mouse hovers over a given `copy` in UI coordinates. This d
## `ct.mouse.hide()`, `ct.mouse.show()`
Change the visibility of the mouse cursor.

## `ct.mouse.permitDefault`

When you call `ct.mouse.permitDefault = true`, tells `ct.mouse` not to execute `e.preventDefault()`. Useful if you have HTML controls that must respond to the standard browser events or wish to show the context menu.

## Codes for Actions

* `Left`;
Expand Down
13 changes: 10 additions & 3 deletions app/data/ct.libs/mouse/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
pressed: false,
down: false,
released: false,
permitDefault: false,
button: 0,
hovers(copy) {
if (!copy.shape) {
Expand Down Expand Up @@ -93,18 +94,24 @@
ct.mouse.down = true;
ct.mouse.button = e.button;
window.focus();
e.preventDefault();
if (!ct.mouse.permitDefault) {
e.preventDefault();
}
};
ct.mouse.listenerUp = function listenerUp(e) {
setKey(buttonMap[e.button] || buttonMap.unknown, 0);
ct.mouse.released = true;
ct.mouse.down = false;
ct.mouse.button = e.button;
window.focus();
e.preventDefault();
if (!ct.mouse.permitDefault) {
e.preventDefault();
}
};
ct.mouse.listenerContextMenu = function listenerContextMenu(e) {
e.preventDefault();
if (!ct.mouse.permitDefault) {
e.preventDefault();
}
};
ct.mouse.listenerWheel = function listenerWheel(e) {
setKey('Wheel', ((e.wheelDelta || -e.detail) < 0) ? -1 : 1);
Expand Down
5 changes: 5 additions & 0 deletions app/data/ct.libs/mouse/types.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@ declare namespace ct {
* a cursor inside the drawing canvas.
*/
var inside: boolean;
/**
* Temporarily suspend e.preventDefault() calls. For example, to allow for a HTML text
* box to be used.
*/
var permitDefault: boolean;
/** Returns `true` if the mouse hovers over a given `copy`.
* This does **not** take scaling and rotation into account,
* as well as polygonal shapes (as they are hollow).
Expand Down
2 changes: 1 addition & 1 deletion app/data/ct.libs/pointer/README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
This module abstracts the Web Pointer API, allowing you to track any type of pointers: mouses, touch events, tablet pens, or anything else that is supported by one's system.

The module replaces `ct.mouse` and `ct.touch` from previous versions, uniting their API and adding new features, like pressure and pen position reading.
The module replaces `ct.mouse` and `ct.touch` from previous versions, uniting their API and adding new features, like pressure and pen position reading. `ct.touch` may still be required on iOS.
2 changes: 2 additions & 0 deletions app/data/ct.libs/pointer/docs/General use.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,5 @@ For newcomers, you will probably start with the following:
if (ct.pointer.collides(this, undefined, true)) {
ct.sound.spawn('UI_Blep');
}

* `ct.pointer.permitDefault` can be set to `true` (e.g. `ct.pointer.permitDefault = true`) to tell `ct.pointer` not to execute `e.preventDefault()`. This is useful if you have HTML controls that must respond to the standard browser events or wish to show the context menu. If the setting "Do not cancel standard browser events" is checked this value will be ignored.
11 changes: 6 additions & 5 deletions app/data/ct.libs/pointer/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@
}
};
var handleMove = function (e) {
if (![/*%preventdefault%*/][0]) {
if (![/*%preventdefault%*/][0] && !ct.pointer.permitDefault) {
e.preventDefault();
}
let pointerHover = ct.pointer.hover.find(p => p.id === e.pointerId);
Expand All @@ -136,7 +136,7 @@
}
};
var handleDown = function (e) {
if (![/*%preventdefault%*/][0]) {
if (![/*%preventdefault%*/][0] && !ct.pointer.permitDefault) {
e.preventDefault();
}
ct.pointer.type = e.pointerType;
Expand All @@ -148,7 +148,7 @@
}
};
var handleUp = function (e) {
if (![/*%preventdefault%*/][0]) {
if (![/*%preventdefault%*/][0] && !ct.pointer.permitDefault) {
e.preventDefault();
}
const pointer = ct.pointer.down.find(p => p.id === e.pointerId);
Expand All @@ -162,7 +162,7 @@
};
var handleWheel = function handleWheel(e) {
setKey('Wheel', ((e.wheelDelta || -e.detail) < 0) ? -1 : 1);
if (![/*%preventdefault%*/][0]) {
if (![/*%preventdefault%*/][0] && !ct.pointer.permitDefault) {
e.preventDefault();
}
};
Expand Down Expand Up @@ -236,7 +236,7 @@
passive: false
});
document.addEventListener('contextmenu', e => {
if (![/*%preventdefault%*/][0]) {
if (![/*%preventdefault%*/][0] && !ct.pointer.permitDefault) {
e.preventDefault();
}
});
Expand All @@ -263,6 +263,7 @@
twist: 0,
width: 1,
height: 1,
permitDefault: false,
type: null,
clear() {
ct.pointer.down.length = 0;
Expand Down
5 changes: 5 additions & 0 deletions app/data/ct.libs/pointer/types.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,11 @@ declare namespace ct {
pointer?: IPointer | undefined | false,
checkReleased?: boolean
): false | IPointer;
/**
* Temporarily suspend e.preventDefault() calls. For example, to allow for a HTML text
* box to be used.
*/
var permitDefault: boolean;
/**
* Either returns the pointer that is currently hovering over the passed copy that exists
* in gameplay coordinates, or returns `false` if there is no such pointers.
Expand Down
2 changes: 1 addition & 1 deletion app/data/ct.libs/sound.howler/DOCS.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Spawns a new sound and plays it.
# 3D sounds

If neither `position` nor `x` options of `ct.sound.spawn` are specified, the created sound will be a regular 2D sound with no positioning.
If they are set, a 3D sound will be creaated. It is configured by ct.sound.howler settings and by a set of [additional options from Howler.js](https://github.com/goldfire/howler.js#pannerattro-id). Location values are measured in pixels.
If they are set, a 3D sound will be created. It is configured by ct.sound.howler settings and by a set of [additional options from Howler.js](https://github.com/goldfire/howler.js#pannerattro-id). Location values are measured in pixels.

**Example:**

Expand Down
Loading

0 comments on commit 554d3b4

Please sign in to comment.