mirror of
https://github.com/Heretek-AI/GDevelop.git
synced 2026-07-23 10:35:35 -04:00
b7902bb141
* This adds a **Light** object that can be added on the scene, with a customizable color and radius. * Add the **Light Obstacle** behavior to the object that must acts as obstacle (walls, etc...) to the lights. * You can customize the ambient color of the rest of the scene from almost white (useful to show light shadows) to entirely black (useful for horror/exploration games) or any color. * Use effects on the "Lighting" layer like "Kawase Blur" to achieve soft shadows.
43 lines
1.1 KiB
JavaScript
43 lines
1.1 KiB
JavaScript
// @ts-check
|
|
|
|
describe('gdjs.Layer', function() {
|
|
var runtimeGame = new gdjs.RuntimeGame({
|
|
variables: [],
|
|
resources: { resources: [] },
|
|
// @ts-ignore
|
|
properties: { windowWidth: 800, windowHeight: 600 },
|
|
});
|
|
var runtimeScene = new gdjs.RuntimeScene(runtimeGame);
|
|
|
|
it('benchmark convertCoords and convertInverseCoords', function() {
|
|
this.timeout(20000);
|
|
var layer = new gdjs.Layer(
|
|
{ name: 'My layer',
|
|
visibility: true,
|
|
effects: [],
|
|
cameras: [],
|
|
isLightingLayer: false,
|
|
followBaseLayerCamera: false,
|
|
ambientLightColorR: 128,
|
|
ambientLightColorG: 128,
|
|
ambientLightColorB: 128,
|
|
},
|
|
runtimeScene
|
|
);
|
|
layer.setCameraX(100, 0);
|
|
layer.setCameraY(200, 0);
|
|
layer.setCameraRotation(90, 0);
|
|
|
|
const benchmarkSuite = makeBenchmarkSuite();
|
|
benchmarkSuite
|
|
.add('convertCoords', () => {
|
|
layer.convertCoords(350, 450, 0);
|
|
})
|
|
.add('convertInverseCoords', () => {
|
|
layer.convertInverseCoords(350, 450, 0);
|
|
});
|
|
|
|
console.log(benchmarkSuite.run());
|
|
});
|
|
});
|