Skip to content

Commit

Permalink
Working interaction layer
Browse files Browse the repository at this point in the history
  • Loading branch information
ZotyDev committed Jan 19, 2024
1 parent fa63872 commit a8ff320
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 28 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# 🎴 Chromatic Canvas Changelog

## Version 1.0.1

- *Internal* - Added proper `InteractionLayer` for the module.

## Version 1.0.0

This module was part of [OIF](https://foundryvtt.com/packages/object-interaction-fx), which got the functionality from [Kandashi's Fluid Canvas](https://github.com/kandashi/kandashis-fluid-canvas) (MIT license before someone says something). My original intention was to keep this code contained inside **OIF** forever, but as I've developed new module ideas, making this functionality into a standalone module makes more sense now.
Expand Down
17 changes: 2 additions & 15 deletions module.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"id": "chromatic-canvas",
"title": "🎴 Chromatic Canvas (Library)",
"description": "Library that adds special effects to the canvas",
"version": "1.0.0",
"version": "1.0.1",
"library": true,
"authors": [
{
Expand Down Expand Up @@ -32,20 +32,7 @@
"download": "https://github.com/RPG-Made-Simple/FVTT-ChromaticCanvas/releases/latest/download/module.zip",
"readme": "https://github.com/RPG-Made-Simple/FVTT-ChromaticCanvas/blob/main/README.md",
"changelog": "https://github.com/RPG-Made-Simple/FVTT-ChromaticCanvas/blob/main/CHANGELOG.md",
"relationships": {
"requires": [
{
"id": "debugger",
"type": "module",
"compatibility": {}
},
{
"id": "toolbox",
"type": "module",
"compatibility": {}
}
]
},
"relationships": {},
"esmodules": [
"./module/scripts/module.js"
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@
// ? created from 0 but using Kandashi's work as reference :D.
import { Constants as C } from "./constants.js";

export class ChromaticCanvas extends InteractionLayer {
export class ChromaticCanvasLayer extends InteractionLayer {
constructor() {
super();

if (Gamepad.release.generation == 10) {
if (game.release.generation == 10) {
// Debug
C.D.info('Detected FoundryVTT 10, making compatibility changes...');

Expand All @@ -43,7 +43,7 @@ export class ChromaticCanvas extends InteractionLayer {
// Check if arguments are valid
if (!Toolbox.check(intensity, 'number')) {
// Debug
C.D.error('"intensity" is invalid');
C.D.error('"intensity" is missing');

return;
}
Expand All @@ -55,7 +55,7 @@ export class ChromaticCanvas extends InteractionLayer {
}
if (!Toolbox.check(iterations, 'number')) {
// Debug
C.D.error('"iterations" is empty');
C.D.error('"iterations" is missing');

return;
}
Expand Down
18 changes: 9 additions & 9 deletions module/scripts/module.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
// ? Chromatic Canvas is a simple library that exposes a API with methods to
// ? apply special effects to the canvas.
import { Constants as C } from "./constants.js";
import { ChromaticCanvas } from "./chromaticCanvas.js";
import { ChromaticCanvasLayer } from "./chromaticCanvasLayer.js";

////////////////////////////////////////////////////////////////////////////////
// Entry-point for everything
Expand All @@ -19,15 +19,9 @@ Hooks.once('init', () => {
Hooks.once('toolbox.ready', () => {
Toolbox.showcaseModule(C.NAME_FLAT);

// Setup the layer where the effects will be played
CONFIG.Canvas.layers['chromaticCanvas'] = {
group: 'interface',
layerClass: ChromaticCanvas,
}

// Setup the API and methods
window['ChromaticCanvas'] = {
screenShake: ChromaticCanvas.screenShake,
screenShake: ChromaticCanvasLayer.screenShake,
}

Hooks.call('chromatic-canvas.ready');
Expand All @@ -36,9 +30,15 @@ Hooks.once('init', () => {

// Debug info
Hooks.once('debugger.ready', () => {
C.D = new Debugger(C.ID, C.NAME, true, true);
C.D = new Debugger(C.ID, C.NAME, false, false);
C.D.info('Module Information:');
C.D.info(`Version ${game.modules.get(C.ID).version}`);
C.D.info('Library By ZotyDev');
});

// Setup the layer where the effects will be played
CONFIG.Canvas.layers['chromaticCanvas'] = {
group: 'interface',
layerClass: ChromaticCanvasLayer,
}
})

0 comments on commit a8ff320

Please sign in to comment.