Skip to content

Commit f4f7967

Browse files
committed
Simplify by inlining functions
1 parent c43c4ff commit f4f7967

File tree

1 file changed

+5
-21
lines changed

1 file changed

+5
-21
lines changed

raylib.js

Lines changed: 5 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,6 @@ class RaylibJs {
5151
this.#reset();
5252
}
5353

54-
get quit() {
55-
return this.views.stop[0] !== 0;
56-
}
57-
5854
async start({wasmPath, shared}) {
5955
if (this.wasm !== undefined) {
6056
console.error("The game is already running. Please stop() it first.");
@@ -91,18 +87,6 @@ class RaylibJs {
9187
this.CloseWindow();
9288
}
9389

94-
get currentMouseWheelMoveState() {
95-
return Math.sign(-this.views.mouse[2]);
96-
}
97-
98-
set currentMouseWheelMoveState(v) {
99-
this.views.mouse[2] = v;
100-
}
101-
102-
get currentMousePosition() {
103-
return { x: this.views.mouse[0], y: this.views.mouse[1] };
104-
}
105-
10690
InitWindow(width, height, title_ptr) {
10791
this.ctx.canvas.width = width;
10892
this.ctx.canvas.height = height;
@@ -111,7 +95,7 @@ class RaylibJs {
11195
}
11296

11397
WindowShouldClose() {
114-
return this.quit;
98+
return this.views.stop[0] !== 0;
11599
}
116100

117101
CloseWindow() {
@@ -147,7 +131,7 @@ class RaylibJs {
147131

148132
EndDrawing() {
149133
this.prevKeys.set(this.views.keys);
150-
this.currentMouseWheelMoveState = 0.0;
134+
this.views.mouse[2] = 0.0;
151135
const img = this.ctx.canvas.transferToImageBitmap();
152136
this.ctx.drawImage(img, 0, 0);
153137
reply("frame", img);
@@ -207,7 +191,7 @@ class RaylibJs {
207191
}
208192

209193
GetMouseWheelMove() {
210-
return this.currentMouseWheelMoveState;
194+
return Math.sign(-this.views.mouse[2]);
211195
}
212196
IsGestureDetected() {
213197
return false;
@@ -236,8 +220,8 @@ class RaylibJs {
236220

237221
GetMousePosition(result_ptr) {
238222
const bcrect = this.views.boundingRect;
239-
const x = this.currentMousePosition.x - bcrect[0];
240-
const y = this.currentMousePosition.y - bcrect[1];
223+
const x = this.views.mouse[0] - bcrect[0];
224+
const y = this.views.mouse[1] - bcrect[1];
241225

242226
const buffer = this.wasm.instance.exports.memory.buffer;
243227
new Float32Array(buffer, result_ptr, 2).set([x, y]);

0 commit comments

Comments
 (0)