Skip to content

Commit 2e5eee5

Browse files
committed
Add mode event
1 parent 4dab7f9 commit 2e5eee5

File tree

3 files changed

+17
-5
lines changed

3 files changed

+17
-5
lines changed

js/window.js

+14-2
Original file line numberDiff line numberDiff line change
@@ -225,13 +225,12 @@ class Window extends EventEmitter {
225225
}
226226

227227
this.makeCurrent();
228-
229-
// Vertical sync (on cards that support it)
230228
glfw.swapInterval(this._vsync);
231229

232230
this._pxWidth = this._width * this._ratio;
233231
this._pxHeight = this._height * this._ratio;
234232

233+
this.emit('mode', { mode: this._mode });
235234
this.emit('resize', { width: this._pxWidth, height: this._pxHeight });
236235
}
237236

@@ -435,6 +434,19 @@ class Window extends EventEmitter {
435434
glfw.setWindowPos(this._window, x, y);
436435
}
437436

437+
get vsync() {
438+
return this._vsync;
439+
}
440+
set vsync(isVsyncEnabled) {
441+
if (this._vsync === isVsyncEnabled) {
442+
return;
443+
}
444+
445+
this._vsync = isVsyncEnabled;
446+
this.makeCurrent();
447+
glfw.swapInterval(this._vsync);
448+
}
449+
438450

439451
get framebufferSize() { return glfw.getFramebufferSize(this._window); }
440452

package-lock.json

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"author": "Luis Blanco <[email protected]>",
33
"name": "glfw-raub",
4-
"version": "6.2.0",
4+
"version": "6.3.0",
55
"description": "GLFW for Node.js",
66
"license": "MIT",
77
"main": "index.js",

0 commit comments

Comments
 (0)