sfml.js 0.0.1-preview.22 → 0.0.1-preview.27
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/binding.gyp +6 -1
- package/index.d.ts +1 -0
- package/lib/clock.d.ts +1 -3
- package/lib/clock.js +3 -1
- package/lib/color.d.ts +1 -3
- package/lib/color.js +1 -1
- package/lib/drawable/circle_shape.d.ts +2 -4
- package/lib/drawable/circle_shape.js +2 -2
- package/lib/drawable/convex_shape.d.ts +2 -4
- package/lib/drawable/convex_shape.js +2 -2
- package/lib/drawable/drawable.d.ts +1 -3
- package/lib/drawable/drawable.js +1 -1
- package/lib/drawable/plugin_package.d.ts +2 -2
- package/lib/drawable/plugin_package.js +2 -2
- package/lib/drawable/rectangle_shape.d.ts +5 -4
- package/lib/drawable/rectangle_shape.js +14 -2
- package/lib/drawable/shape.d.ts +3 -5
- package/lib/drawable/shape.js +2 -2
- package/lib/drawable/sprite.d.ts +5 -7
- package/lib/drawable/sprite.js +4 -4
- package/lib/drawable/text.d.ts +7 -10
- package/lib/drawable/text.js +3 -3
- package/lib/drawable/transformable.js +1 -1
- package/lib/font.d.ts +5 -4
- package/lib/font.js +23 -5
- package/lib/image.d.ts +3 -0
- package/lib/image.js +10 -0
- package/lib/mouse.js +1 -1
- package/lib/poll_event.d.ts +2 -4
- package/lib/render_window.d.ts +12 -9
- package/lib/render_window.js +12 -5
- package/lib/sfml.d.ts +23 -0
- package/lib/sfml.js +17 -14
- package/lib/sound/base.d.ts +33 -0
- package/lib/sound/base.js +109 -0
- package/lib/sound/music.d.ts +10 -0
- package/lib/sound/music.js +58 -0
- package/lib/sound/sound.d.ts +8 -0
- package/lib/sound/sound.js +32 -0
- package/lib/texture.d.ts +12 -3
- package/lib/texture.js +47 -2
- package/lib/time.d.ts +1 -1
- package/lib/video_mode.d.ts +1 -3
- package/lib/video_mode.js +1 -1
- package/package.json +7 -3
- package/src/base_class_with_loading.h +19 -0
- package/src/drawable/package_plugin-inl.h +10 -1
- package/src/drawable/rectangle_shape.cc +34 -0
- package/src/drawable/rectangle_shape.h +3 -0
- package/src/font.cc +33 -2
- package/src/font.h +5 -1
- package/src/image.cc +56 -0
- package/src/image.h +32 -0
- package/src/load_from_file_worker.h +79 -0
- package/src/render_window.cc +38 -0
- package/src/render_window.h +2 -0
- package/src/sfml.cc +9 -0
- package/src/sound/music.cc +102 -0
- package/src/sound/music.h +34 -0
- package/src/sound/sound.cc +109 -0
- package/src/sound/sound.h +42 -0
- package/src/sound/sound_source.cc +75 -0
- package/src/sound/sound_source.h +64 -0
- package/src/texture.cc +77 -64
- package/src/texture.h +8 -3
- package/src/utils-inl.h +7 -1
- package/tsconfig.json +8 -0
package/binding.gyp
CHANGED
|
@@ -80,6 +80,7 @@
|
|
|
80
80
|
"./src/clock.cc",
|
|
81
81
|
"./src/color.cc",
|
|
82
82
|
"./src/font.cc",
|
|
83
|
+
"./src/image.cc",
|
|
83
84
|
"./src/keyboard.cc",
|
|
84
85
|
"./src/mouse.cc",
|
|
85
86
|
"./src/poll_event.cc",
|
|
@@ -99,7 +100,11 @@
|
|
|
99
100
|
"./src/drawable/text.cc",
|
|
100
101
|
|
|
101
102
|
"./src/gen/keycode.cc",
|
|
102
|
-
"./src/gen/mouse_button.cc"
|
|
103
|
+
"./src/gen/mouse_button.cc",
|
|
104
|
+
|
|
105
|
+
"./src/sound/music.cc",
|
|
106
|
+
"./src/sound/sound.cc",
|
|
107
|
+
"./src/sound/sound_source.cc"
|
|
103
108
|
],
|
|
104
109
|
"dependencies": [
|
|
105
110
|
"keycode.cc",
|
package/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './lib/sfml';
|
package/lib/clock.d.ts
CHANGED
package/lib/clock.js
CHANGED
package/lib/color.d.ts
CHANGED
package/lib/color.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
const Shape = require('./shape');
|
|
3
|
+
const { Shape } = require('./shape');
|
|
4
4
|
const { validateTypeOf } = require('../common');
|
|
5
5
|
|
|
6
6
|
class CircleShape extends Shape {
|
|
@@ -23,4 +23,4 @@ class CircleShape extends Shape {
|
|
|
23
23
|
}
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
-
module.exports = CircleShape;
|
|
26
|
+
module.exports = { CircleShape };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
const Shape = require('./shape');
|
|
3
|
+
const { Shape } = require('./shape');
|
|
4
4
|
const { validateTypeOf } = require('../common');
|
|
5
5
|
const { Vector2F } = require('../vector2');
|
|
6
6
|
|
|
@@ -32,4 +32,4 @@ class ConvexShape extends Shape {
|
|
|
32
32
|
}
|
|
33
33
|
}
|
|
34
34
|
|
|
35
|
-
module.exports = ConvexShape;
|
|
35
|
+
module.exports = { ConvexShape };
|
package/lib/drawable/drawable.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { Color } from '../color';
|
|
2
2
|
import { FloatRect } from '../rect';
|
|
3
|
-
import
|
|
3
|
+
import { Texture } from '../texture';
|
|
4
4
|
|
|
5
5
|
export interface PluginPackageTexture {
|
|
6
6
|
setTexture(texture: Texture): void;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
const Color = require('../color');
|
|
3
|
+
const { Color } = require('../color');
|
|
4
4
|
const { IntRect } = require('../rect');
|
|
5
|
-
const Texture = require('../texture');
|
|
5
|
+
const { Texture } = require('../texture');
|
|
6
6
|
const { validateTypeOf } = require('../common');
|
|
7
7
|
|
|
8
8
|
const TEXTURE = Symbol('PluginPackageTexture::texture');
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { Shape } from './shape';
|
|
2
2
|
import { PointType, Vector2F } from '../vector2';
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
export class RectangleShape extends Shape {
|
|
5
5
|
constructor(size: PointType<Vector2F>);
|
|
6
|
-
}
|
|
7
6
|
|
|
8
|
-
|
|
7
|
+
setSize(size: PointType<Vector2F>): void;
|
|
8
|
+
getSize(): Vector2F;
|
|
9
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
const Shape = require('./shape');
|
|
3
|
+
const { Shape } = require('./shape');
|
|
4
4
|
const { Vector2F } = require('../vector2');
|
|
5
5
|
|
|
6
6
|
class RectangleShape extends Shape {
|
|
@@ -11,6 +11,18 @@ class RectangleShape extends Shape {
|
|
|
11
11
|
|
|
12
12
|
super('RectangleShape', size);
|
|
13
13
|
}
|
|
14
|
+
|
|
15
|
+
setSize(size) {
|
|
16
|
+
if (!(size instanceof Vector2F)) {
|
|
17
|
+
size = new Vector2F(size?.x, size?.y);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
this._raw().setSize(size);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
getSize() {
|
|
24
|
+
return this._raw().getSize();
|
|
25
|
+
}
|
|
14
26
|
}
|
|
15
27
|
|
|
16
|
-
module.exports = RectangleShape;
|
|
28
|
+
module.exports = { RectangleShape };
|
package/lib/drawable/shape.d.ts
CHANGED
|
@@ -1,16 +1,14 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { Drawable } from './drawable';
|
|
2
2
|
import { PluginPackageBound, PluginPackageColorAndThickness, PluginPackageTexture } from './plugin_package';
|
|
3
3
|
import { Transformable } from './transformable';
|
|
4
4
|
import { Vector2F } from '../vector2';
|
|
5
5
|
|
|
6
6
|
type ShapePluginPackage = Transformable & PluginPackageColorAndThickness & PluginPackageTexture & PluginPackageBound;
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
export interface Shape extends ShapePluginPackage {}
|
|
9
|
+
export class Shape extends Drawable {
|
|
10
10
|
setPointCount(count: number): void;
|
|
11
11
|
getPointCount(): number;
|
|
12
12
|
getPoint(idx: number): Vector2F;
|
|
13
13
|
setPoint(idx: number, point: Vector2F): void;
|
|
14
14
|
}
|
|
15
|
-
|
|
16
|
-
export = Shape;
|
package/lib/drawable/shape.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
const Drawable = require('./drawable');
|
|
3
|
+
const { Drawable } = require('./drawable');
|
|
4
4
|
const {
|
|
5
5
|
setPluginPackageBound,
|
|
6
6
|
setPluginPackageColorAndThickness,
|
|
@@ -27,4 +27,4 @@ setPluginPackageColorAndThickness(Shape.prototype);
|
|
|
27
27
|
setPluginPackageTexture(Shape.prototype);
|
|
28
28
|
setTransformable(Shape.prototype);
|
|
29
29
|
|
|
30
|
-
module.exports = Shape;
|
|
30
|
+
module.exports = { Shape };
|
package/lib/drawable/sprite.d.ts
CHANGED
|
@@ -1,17 +1,15 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
1
|
+
import { Color } from '../color';
|
|
2
|
+
import { Drawable } from './drawable';
|
|
3
3
|
import { IntRect } from '../rect';
|
|
4
4
|
import { PluginPackageBound, PluginPackageTexture } from './plugin_package';
|
|
5
|
-
import
|
|
5
|
+
import { Texture } from '../texture';
|
|
6
6
|
import { Transformable } from './transformable';
|
|
7
7
|
|
|
8
8
|
type SpritePluginPackage = Transformable & PluginPackageTexture & PluginPackageBound;
|
|
9
9
|
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
export interface Sprite extends SpritePluginPackage {}
|
|
11
|
+
export class Sprite extends Drawable {
|
|
12
12
|
constructor(texture?: Texture, rect?: IntRect);
|
|
13
13
|
setColor(color: number | Color): void;
|
|
14
14
|
getColor(): Color;
|
|
15
15
|
}
|
|
16
|
-
|
|
17
|
-
export = Sprite;
|
package/lib/drawable/sprite.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
const Color = require('../color');
|
|
4
|
-
const Drawable = require('./drawable');
|
|
3
|
+
const { Color } = require('../color');
|
|
4
|
+
const { Drawable } = require('./drawable');
|
|
5
5
|
const { IntRect } = require('../rect');
|
|
6
6
|
const { setPluginPackageBound, setPluginPackageTexture } = require('./plugin_package');
|
|
7
7
|
const { setTransformable } = require('./transformable');
|
|
8
|
-
const Texture = require('../texture');
|
|
8
|
+
const { Texture } = require('../texture');
|
|
9
9
|
const { validateTypeOf } = require('../common');
|
|
10
10
|
|
|
11
11
|
class Sprite extends Drawable {
|
|
@@ -45,4 +45,4 @@ setPluginPackageBound(Sprite.prototype);
|
|
|
45
45
|
setPluginPackageTexture(Sprite.prototype);
|
|
46
46
|
setTransformable(Sprite.prototype);
|
|
47
47
|
|
|
48
|
-
module.exports = Sprite;
|
|
48
|
+
module.exports = { Sprite };
|
package/lib/drawable/text.d.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { Drawable } from './drawable';
|
|
2
2
|
import { PluginPackageBound, PluginPackageColorAndThickness } from './plugin_package';
|
|
3
3
|
import { Transformable } from './transformable';
|
|
4
|
-
import
|
|
4
|
+
import { Font } from '../font';
|
|
5
5
|
|
|
6
6
|
type TextPluginPackage = Transformable & PluginPackageColorAndThickness & PluginPackageBound;
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
constructor(str?: string, font?: Font, characterSize?: number
|
|
8
|
+
export interface Text extends TextPluginPackage {}
|
|
9
|
+
export class Text extends Drawable implements TextPluginPackage {
|
|
10
|
+
constructor(str?: string, font?: Font, characterSize?: number);
|
|
11
11
|
setString(str: string): void;
|
|
12
12
|
setFont(font: Font): void;
|
|
13
13
|
setCharacterSize(characterSize: number): void;
|
|
@@ -15,15 +15,12 @@ declare class Text extends Drawable implements PluginPackage {
|
|
|
15
15
|
setLetterSpacing(letterSpacing: number): void;
|
|
16
16
|
setStyle(style: Text.Style): void;
|
|
17
17
|
}
|
|
18
|
-
|
|
19
|
-
declare namespace Text {
|
|
18
|
+
export namespace Text {
|
|
20
19
|
enum Style {
|
|
21
20
|
Regular = 0,
|
|
22
21
|
Bold = 1 << 0,
|
|
23
22
|
Italic = 1 << 1,
|
|
24
23
|
Underlined = 1 << 2,
|
|
25
24
|
StrikeThrough = 1 << 3,
|
|
26
|
-
}
|
|
25
|
+
}
|
|
27
26
|
}
|
|
28
|
-
|
|
29
|
-
export = Text;
|
package/lib/drawable/text.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
const Drawable = require('./drawable');
|
|
4
|
-
const Font = require('../font');
|
|
3
|
+
const { Drawable } = require('./drawable');
|
|
4
|
+
const { Font } = require('../font');
|
|
5
5
|
const {
|
|
6
6
|
setPluginPackageBound,
|
|
7
7
|
setPluginPackageColorAndThickness,
|
|
@@ -85,4 +85,4 @@ setTransformable(Text.prototype);
|
|
|
85
85
|
|
|
86
86
|
Text.Style = require('../../build/Release/binding.node').Text.Style;
|
|
87
87
|
|
|
88
|
-
module.exports = Text;
|
|
88
|
+
module.exports = { Text };
|
package/lib/font.d.ts
CHANGED
|
@@ -10,13 +10,14 @@ interface Glyph {
|
|
|
10
10
|
textureRect: IntRect;
|
|
11
11
|
}
|
|
12
12
|
|
|
13
|
-
export
|
|
13
|
+
export class Font {
|
|
14
14
|
constructor();
|
|
15
|
-
|
|
15
|
+
loadFromFileSync(filename: string): boolean;
|
|
16
|
+
loadFromFile(filename: string): Promise<void>;
|
|
16
17
|
getInfo(): Info;
|
|
17
|
-
getGlyph(codePoint: number, characterSize: number, bold: boolean, outlineThickness
|
|
18
|
+
getGlyph(codePoint: number, characterSize: number, bold: boolean, outlineThickness?: number): Glyph;
|
|
18
19
|
getKerning(first: number, second: number, characterSize: number): number;
|
|
19
20
|
getLineSpacing(characterSize: number): number;
|
|
20
21
|
getUnderlinePosition(characterSize: number): number;
|
|
21
22
|
getUnderlineThickness(characterSize: number): number;
|
|
22
|
-
}
|
|
23
|
+
}
|
package/lib/font.js
CHANGED
|
@@ -4,7 +4,7 @@ const path = require('path');
|
|
|
4
4
|
const util = require('util');
|
|
5
5
|
|
|
6
6
|
const { Font: _Font } = require('../build/Release/binding.node');
|
|
7
|
-
const { validateTypeOf } = require('./common');
|
|
7
|
+
const { createDeferred, validateTypeOf } = require('./common');
|
|
8
8
|
|
|
9
9
|
const GET_INFO = Symbol('Font::getInfo');
|
|
10
10
|
|
|
@@ -20,11 +20,29 @@ class Font extends _Font {
|
|
|
20
20
|
return {};
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
-
|
|
24
|
-
|
|
23
|
+
async loadFromFile(filename) {
|
|
24
|
+
const { promise, resolve, reject } = createDeferred();
|
|
25
25
|
validateTypeOf(filename, 'filename', 'string');
|
|
26
26
|
filename = path.resolve(process.cwd(), filename);
|
|
27
|
-
|
|
27
|
+
const err = super.loadFromFile(filename, err => {
|
|
28
|
+
if (err) {
|
|
29
|
+
reject(err);
|
|
30
|
+
} else {
|
|
31
|
+
resolve();
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
if (err) {
|
|
36
|
+
process.nextTick(() => { reject(err); });
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
return promise;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
loadFromFileSync(filename) {
|
|
43
|
+
validateTypeOf(filename, 'filename', 'string');
|
|
44
|
+
filename = path.resolve(process.cwd(), filename);
|
|
45
|
+
return super.loadFromFileSync(filename);
|
|
28
46
|
}
|
|
29
47
|
|
|
30
48
|
getGlyph(codePoint, characterSize, bold, outlineThickness = 0) {
|
|
@@ -111,4 +129,4 @@ class Font extends _Font {
|
|
|
111
129
|
}
|
|
112
130
|
}
|
|
113
131
|
|
|
114
|
-
module.exports = Font;
|
|
132
|
+
module.exports = { Font };
|
package/lib/image.d.ts
ADDED
package/lib/image.js
ADDED
package/lib/mouse.js
CHANGED
|
@@ -5,7 +5,7 @@ const {
|
|
|
5
5
|
isButtonPressed: _isButtonPressed,
|
|
6
6
|
setPosition: _setPosition,
|
|
7
7
|
} = require('../build/Release/binding.node');
|
|
8
|
-
const RenderWindow = require('./render_window');
|
|
8
|
+
const { RenderWindow } = require('./render_window');
|
|
9
9
|
const { Vector2I } = require('./vector2');
|
|
10
10
|
|
|
11
11
|
exports.isButtonPressed = _isButtonPressed;
|
package/lib/poll_event.d.ts
CHANGED
|
@@ -70,7 +70,5 @@ interface MouseWheelScrollEvent {
|
|
|
70
70
|
};
|
|
71
71
|
}
|
|
72
72
|
|
|
73
|
-
type Event = OtherEvent | SizeEvent | KeyEvent | TextEvent | MouseMoveEvent | MouseButtonEvent |
|
|
74
|
-
MouseWheelScrollEvent;
|
|
75
|
-
|
|
76
|
-
export = Event;
|
|
73
|
+
export type Event = OtherEvent | SizeEvent | KeyEvent | TextEvent | MouseMoveEvent | MouseButtonEvent |
|
|
74
|
+
MouseWheelEvent | MouseWheelScrollEvent;
|
package/lib/render_window.d.ts
CHANGED
|
@@ -1,11 +1,15 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import { Color } from './color';
|
|
2
|
+
import { Drawable } from './drawable/drawable';
|
|
3
|
+
import { Event } from './poll_event';
|
|
4
|
+
import { Image } from './image';
|
|
5
|
+
import { VideoMode } from './video_mode';
|
|
6
|
+
import { Vector2U } from './vector2';
|
|
4
7
|
|
|
5
|
-
|
|
8
|
+
export class RenderWindow {
|
|
6
9
|
constructor(videoMode?: VideoMode, title?: string, style?: RenderWindow.Style);
|
|
7
10
|
|
|
8
|
-
|
|
11
|
+
capture(): Image;
|
|
12
|
+
clear(color: number | Color): void;
|
|
9
13
|
close(): void;
|
|
10
14
|
draw(content: Drawable): void;
|
|
11
15
|
display(): void;
|
|
@@ -20,9 +24,10 @@ declare class RenderWindow {
|
|
|
20
24
|
setKeyRepeatEnabled(enabled: boolean): void;
|
|
21
25
|
setFramerateLimit(limit: number): void;
|
|
22
26
|
setActive(active?: boolean): void;
|
|
23
|
-
}
|
|
24
27
|
|
|
25
|
-
|
|
28
|
+
getSize(): Vector2U;
|
|
29
|
+
}
|
|
30
|
+
export namespace RenderWindow {
|
|
26
31
|
enum Style {
|
|
27
32
|
None = 0,
|
|
28
33
|
Titlebar = 1 << 0,
|
|
@@ -32,5 +37,3 @@ declare namespace RenderWindow {
|
|
|
32
37
|
Default = Titlebar | Resize | Close,
|
|
33
38
|
}
|
|
34
39
|
}
|
|
35
|
-
|
|
36
|
-
export = RenderWindow;
|
package/lib/render_window.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
const Color = require('./color');
|
|
4
|
-
const Drawable = require('./drawable/drawable');
|
|
3
|
+
const { Color } = require('./color');
|
|
4
|
+
const { Drawable } = require('./drawable/drawable');
|
|
5
5
|
const { RenderWindow: _RenderWindow } = require('../build/Release/binding.node');
|
|
6
6
|
const { validateTypeOf } = require('./common');
|
|
7
|
-
const VideoMode = require('./video_mode');
|
|
7
|
+
const { VideoMode } = require('./video_mode');
|
|
8
8
|
|
|
9
9
|
const DRAW_DRAWABLE = Symbol('RenderWindow::drawDrawable');
|
|
10
10
|
const RAW_RENDER_WINDOW = Symbol('RenderWindow::rawRenderWindow');
|
|
@@ -26,7 +26,10 @@ class RenderWindow {
|
|
|
26
26
|
}
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
-
|
|
29
|
+
capture() {
|
|
30
|
+
return this[RAW_RENDER_WINDOW].capture();
|
|
31
|
+
}
|
|
32
|
+
|
|
30
33
|
clear(color = 0) {
|
|
31
34
|
if (!(color instanceof Color)) {
|
|
32
35
|
color = new Color(color);
|
|
@@ -100,9 +103,13 @@ class RenderWindow {
|
|
|
100
103
|
validateTypeOf(active, 'active', 'boolean');
|
|
101
104
|
this[RAW_RENDER_WINDOW].setActive(active);
|
|
102
105
|
}
|
|
106
|
+
|
|
107
|
+
getSize() {
|
|
108
|
+
return this[RAW_RENDER_WINDOW].getSize();
|
|
109
|
+
}
|
|
103
110
|
}
|
|
104
111
|
|
|
105
112
|
RenderWindow.Style = _RenderWindow.Style;
|
|
106
113
|
RenderWindow.RAW_RENDER_WINDOW = RAW_RENDER_WINDOW;
|
|
107
114
|
|
|
108
|
-
module.exports = RenderWindow;
|
|
115
|
+
module.exports = { RenderWindow };
|
package/lib/sfml.d.ts
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export * from './clock';
|
|
2
|
+
export * from './color';
|
|
3
|
+
export * from './font';
|
|
4
|
+
export * from './image';
|
|
5
|
+
export * as Keyboard from './keyboard';
|
|
6
|
+
export * as Mouse from './mouse';
|
|
7
|
+
export * from './rect';
|
|
8
|
+
export * from './render_window';
|
|
9
|
+
export * from './texture';
|
|
10
|
+
|
|
11
|
+
export * as Time from './time';
|
|
12
|
+
|
|
13
|
+
export * from './vector2';
|
|
14
|
+
export * from './video_mode';
|
|
15
|
+
|
|
16
|
+
export * from './drawable/circle_shape';
|
|
17
|
+
export * from './drawable/convex_shape';
|
|
18
|
+
export * from './drawable/rectangle_shape';
|
|
19
|
+
export * from './drawable/sprite';
|
|
20
|
+
export * from './drawable/text';
|
|
21
|
+
|
|
22
|
+
export * from './sound/music';
|
|
23
|
+
export * from './sound/sound';
|
package/lib/sfml.js
CHANGED
|
@@ -1,26 +1,29 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
module.exports = {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
...require('./clock'),
|
|
5
|
+
...require('./color'),
|
|
6
|
+
...require('./font'),
|
|
7
|
+
...require('./image'),
|
|
7
8
|
Keyboard: require('./keyboard'),
|
|
8
9
|
Mouse: require('./mouse'),
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
...require('./render_window'),
|
|
11
|
+
...require('./texture'),
|
|
12
|
+
...require('./video_mode'),
|
|
12
13
|
|
|
13
|
-
Time:
|
|
14
|
-
...require('./time'),
|
|
15
|
-
},
|
|
14
|
+
Time: require('./time'),
|
|
16
15
|
|
|
17
16
|
...require('./rect'),
|
|
18
17
|
...require('./vector2'),
|
|
19
18
|
|
|
20
19
|
// drawable
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
20
|
+
...require('./drawable/circle_shape'),
|
|
21
|
+
...require('./drawable/convex_shape'),
|
|
22
|
+
...require('./drawable/rectangle_shape'),
|
|
23
|
+
...require('./drawable/sprite'),
|
|
24
|
+
...require('./drawable/text'),
|
|
25
|
+
|
|
26
|
+
// sound
|
|
27
|
+
...require('./sound/music'),
|
|
28
|
+
...require('./sound/sound'),
|
|
26
29
|
};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
export class SoundSource {
|
|
2
|
+
constructor(innerName: string, ...args: any);
|
|
3
|
+
|
|
4
|
+
play(): void;
|
|
5
|
+
pause(): void;
|
|
6
|
+
stop(): void;
|
|
7
|
+
|
|
8
|
+
getStatus(): SoundSource.Status;
|
|
9
|
+
|
|
10
|
+
setPitch(pitch: number): void;
|
|
11
|
+
getPitch(): number;
|
|
12
|
+
|
|
13
|
+
setVolume(volume: number): void;
|
|
14
|
+
getVolume(): number;
|
|
15
|
+
|
|
16
|
+
setMinDistance(distance: number): void;
|
|
17
|
+
getMinDistance(): number;
|
|
18
|
+
|
|
19
|
+
setAttenuation(attenuation: number): void;
|
|
20
|
+
getAttenuation(): number;
|
|
21
|
+
|
|
22
|
+
setRelativeToListener(relative: boolean): void;
|
|
23
|
+
getRelativeToListener(): boolean;
|
|
24
|
+
isRelativeToListener(): boolean;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export namespace SoundSource {
|
|
28
|
+
enum Status {
|
|
29
|
+
Stopped = 0,
|
|
30
|
+
Paused = 1,
|
|
31
|
+
Playing = 2,
|
|
32
|
+
}
|
|
33
|
+
}
|