slifer 0.1.2 → 0.1.3
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/README.md +20 -13
- package/bun.lockb +0 -0
- package/libs/libSDL2.so +0 -0
- package/libs/libSDL2_image.so +0 -0
- package/libs/libSDL2_ttf.so +0 -0
- package/package.json +1 -1
- package/src/ffi.ts +212 -198
- package/src/slifer.ts +116 -105
package/README.md
CHANGED
@@ -6,15 +6,18 @@
|
|
6
6
|
|
7
7
|
> [!CAUTION]
|
8
8
|
> Slifer is currently in alpha. Use at your own risk.
|
9
|
-
>
|
10
9
|
|
11
|
-
> [!NOTE]
|
12
|
-
> Not all basic features have been implemented. Many are missing such as
|
13
|
-
> As such, I recommend waiting for a beta release of
|
10
|
+
> [!NOTE]
|
11
|
+
> Not all basic features have been implemented. Many are missing such as
|
12
|
+
> window customization. As such, I recommend waiting for a beta release of
|
13
|
+
> Slifer before using it for a long term project.
|
14
14
|
|
15
|
-
Slifer is a game framework made to allow users to code games in typescript. The
|
15
|
+
Slifer is a game framework made to allow users to code games in typescript. The
|
16
|
+
framework uses bun and SDL2 under the hood to allow your game to render and
|
17
|
+
build natively to desktop.
|
16
18
|
|
17
19
|
## Contents
|
20
|
+
|
18
21
|
- [Goals](#goals)
|
19
22
|
- [Current Features](#current-features)
|
20
23
|
- [Future Features](#future-features)
|
@@ -22,38 +25,42 @@ Slifer is a game framework made to allow users to code games in typescript. The
|
|
22
25
|
|
23
26
|
## Goals
|
24
27
|
|
25
|
-
- Contain all basic game framework implementations. Such as drawing images,
|
28
|
+
- Contain all basic game framework implementations. Such as drawing images,
|
29
|
+
drawing text and making animations from a sprite sheet.
|
26
30
|
- Provide an easy transition from web development to game development.
|
27
31
|
- Create an easy to use framework. Slifer should handle the bulk of the work
|
28
32
|
- Keep updates consistent.
|
29
33
|
|
30
34
|
## Current Features
|
35
|
+
|
31
36
|
- Create a native desktop window with custom title and size.
|
32
37
|
- Handle both keyboard and mouse inputs
|
33
38
|
- Load and draw images onto the window
|
34
39
|
|
35
40
|
## Future Features
|
41
|
+
|
36
42
|
- Audio Implementation
|
37
43
|
- Animation library
|
38
44
|
- Save file library
|
39
45
|
|
40
46
|
## Example
|
47
|
+
|
41
48
|
```ts
|
42
|
-
import Slifer from
|
49
|
+
import Slifer from "slifer";
|
43
50
|
|
44
51
|
Slifer.createWindow("Example Window", 640, 480);
|
45
52
|
|
46
53
|
const bg = Slifer.Graphics.makeColor(36, 36, 36, 255);
|
47
54
|
|
48
55
|
while (!Slifer.shouldClose()) {
|
49
|
-
|
56
|
+
Slifer.Graphics.setBackground(bg);
|
50
57
|
|
51
|
-
|
52
|
-
|
53
|
-
|
58
|
+
if (Slifer.Keyboard.isPressed("escape")) {
|
59
|
+
Slifer.isRunning = false;
|
60
|
+
}
|
54
61
|
|
55
|
-
|
62
|
+
Slifer.Graphics.render();
|
56
63
|
}
|
57
64
|
|
58
65
|
Slifer.quit();
|
59
|
-
```
|
66
|
+
```
|
package/bun.lockb
CHANGED
Binary file
|
package/libs/libSDL2.so
ADDED
Binary file
|
Binary file
|
Binary file
|
package/package.json
CHANGED
package/src/ffi.ts
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
import { dlopen, FFIType, suffix } from
|
1
|
+
import { dlopen, FFIType, suffix } from "bun:ffi";
|
2
2
|
|
3
3
|
let libSDLImport;
|
4
4
|
let libImageImport;
|
@@ -6,208 +6,222 @@ let libTTFImport;
|
|
6
6
|
let libGFXImport;
|
7
7
|
|
8
8
|
if (process.platform == "win32") {
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
9
|
+
//@ts-expect-error
|
10
|
+
libSDLImport = await import("../libs/libSDL2.dll");
|
11
|
+
//@ts-expect-error
|
12
|
+
libImageImport = await import("../libs/libSDL2_image.dll");
|
13
|
+
//@ts-expect-error
|
14
|
+
libTTFImport = await import("../libs/libSDL2_ttf.dll");
|
15
15
|
} else if (process.platform == "darwin") {
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
16
|
+
//@ts-expect-error
|
17
|
+
libSDLImport = await import("../libs/libSDL2.dylib");
|
18
|
+
//@ts-expect-error
|
19
|
+
libImageImport = await import("../libs/libSDL2_image.dylib");
|
20
|
+
//@ts-expect-error
|
21
|
+
libTTFImport = await import("../libs/libSDL2_ttf.dylib");
|
22
|
+
} else if (process.platform == "linux") {
|
23
|
+
//@ts-expect-error
|
24
|
+
libSDLImport = await import("../libs/libSDL2.so");
|
25
|
+
//@ts-expect-error
|
26
|
+
libImageImport = await import("../libs/libSDL2_image.so");
|
27
|
+
//@ts-expect-error
|
28
|
+
libTTFImport = await import("../libs/libSDL2_ttf.so");
|
22
29
|
}
|
23
30
|
|
24
31
|
export const libsdl = dlopen(libSDLImport.default, {
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
32
|
+
SDL_Init: {
|
33
|
+
args: [FFIType.int],
|
34
|
+
returns: FFIType.int,
|
35
|
+
},
|
36
|
+
SDL_GetRevision: {
|
37
|
+
returns: "cstring",
|
38
|
+
},
|
39
|
+
SDL_CreateWindow: {
|
40
|
+
args: ["cstring", "int", "int", "int", "int", "u32"],
|
41
|
+
returns: "pointer",
|
42
|
+
},
|
43
|
+
SDL_CreateRenderer: {
|
44
|
+
args: ["pointer", "int", "u32"],
|
45
|
+
returns: "pointer",
|
46
|
+
},
|
47
|
+
SDL_GetDesktopDisplayMode: {
|
48
|
+
args: ["int", "pointer"],
|
49
|
+
returns: "int",
|
50
|
+
},
|
51
|
+
SDL_GetDisplayOrientation: {
|
52
|
+
args: ["int"],
|
53
|
+
returns: "int",
|
54
|
+
},
|
55
|
+
SDL_SetWindowFullscreen: {
|
56
|
+
args: ["pointer", "u32"],
|
57
|
+
returns: "int",
|
58
|
+
},
|
59
|
+
SDL_PollEvent: {
|
60
|
+
args: ["pointer"],
|
61
|
+
returns: "int",
|
62
|
+
},
|
63
|
+
SDL_RenderClear: {
|
64
|
+
args: ["pointer"],
|
65
|
+
returns: "int",
|
66
|
+
},
|
67
|
+
SDL_RenderCopy: {
|
68
|
+
args: ["pointer", "pointer", "pointer", "pointer"],
|
69
|
+
returns: "int",
|
70
|
+
},
|
71
|
+
SDL_RenderPresent: {
|
72
|
+
args: ["pointer"],
|
73
|
+
returns: "void",
|
74
|
+
},
|
75
|
+
SDL_CreateTextureFromSurface: {
|
76
|
+
args: ["pointer", "pointer"],
|
77
|
+
returns: "pointer",
|
78
|
+
},
|
79
|
+
SDL_DestroyRenderer: {
|
80
|
+
args: ["pointer"],
|
81
|
+
returns: "void",
|
82
|
+
},
|
83
|
+
SDL_DestroyWindow: {
|
84
|
+
args: ["pointer"],
|
85
|
+
returns: "void",
|
86
|
+
},
|
87
|
+
SDL_Quit: {
|
88
|
+
returns: "void",
|
89
|
+
},
|
90
|
+
SDL_GetKeyName: {
|
91
|
+
args: ["int"],
|
92
|
+
returns: "cstring",
|
93
|
+
},
|
94
|
+
SDL_GetKeyFromScancode: {
|
95
|
+
args: ["int"],
|
96
|
+
returns: "int",
|
97
|
+
},
|
98
|
+
SDL_GetPerformanceCounter: {
|
99
|
+
returns: "u64",
|
100
|
+
},
|
101
|
+
SDL_GetPerformanceFrequency: {
|
102
|
+
returns: "u64",
|
103
|
+
},
|
104
|
+
SDL_QueryTexture: {
|
105
|
+
args: ["pointer", "pointer", "pointer", "pointer", "pointer"],
|
106
|
+
returns: "int",
|
107
|
+
},
|
108
|
+
SDL_GetMouseState: {
|
109
|
+
args: ["pointer", "pointer"],
|
110
|
+
returns: "u32",
|
111
|
+
},
|
112
|
+
SDL_CreateColorCursor: {
|
113
|
+
args: ["pointer", "int", "int"],
|
114
|
+
returns: "pointer",
|
115
|
+
},
|
116
|
+
SDL_SetCursor: {
|
117
|
+
args: ["pointer"],
|
118
|
+
returns: "void",
|
119
|
+
},
|
120
|
+
SDL_SetRenderDrawColor: {
|
121
|
+
args: ["pointer", "int", "int", "int", "int"],
|
122
|
+
returns: "void",
|
123
|
+
},
|
124
|
+
SDL_RenderFillRect: {
|
125
|
+
args: ["pointer", "pointer"],
|
126
|
+
returns: "bool",
|
127
|
+
},
|
128
|
+
SDL_GetWindowPosition: {
|
129
|
+
args: ["pointer", "pointer", "pointer"],
|
130
|
+
returns: "void",
|
131
|
+
},
|
132
|
+
SDL_SetWindowPosition: {
|
133
|
+
args: ["pointer", "int", "int"],
|
134
|
+
returns: "void",
|
135
|
+
},
|
136
|
+
SDL_SetWindowHitTest: {
|
137
|
+
args: ["pointer", FFIType.function, "pointer"],
|
138
|
+
returns: "int",
|
139
|
+
},
|
140
|
+
SDL_GetWindowSize: {
|
141
|
+
args: ["pointer", "pointer", "pointer"],
|
142
|
+
returns: "void",
|
143
|
+
},
|
144
|
+
SDL_CreateSystemCursor: {
|
145
|
+
args: ["int"],
|
146
|
+
returns: "pointer",
|
147
|
+
},
|
148
|
+
SDL_GetError: {
|
149
|
+
returns: "cstring",
|
150
|
+
},
|
151
|
+
SDL_SetHint: {
|
152
|
+
args: ["cstring", "cstring"],
|
153
|
+
returns: "bool",
|
154
|
+
},
|
155
|
+
SDL_MinimizeWindow: {
|
156
|
+
args: ["pointer"],
|
157
|
+
returns: "void",
|
158
|
+
},
|
159
|
+
SDL_GetShapedWindowMode: {
|
160
|
+
args: ["pointer", "pointer"],
|
161
|
+
returns: "int",
|
162
|
+
},
|
163
|
+
SDL_CreateShapedWindow: {
|
164
|
+
args: ["cstring", "int", "int", "int", "int", "u32"],
|
165
|
+
returns: "pointer",
|
166
|
+
},
|
167
|
+
SDL_SetWindowShape: {
|
168
|
+
args: ["pointer", "pointer", "pointer"],
|
169
|
+
returns: "int",
|
170
|
+
},
|
171
|
+
SDL_SetWindowIcon: {
|
172
|
+
args: ["pointer", "pointer"],
|
173
|
+
returns: "void",
|
174
|
+
},
|
175
|
+
SDL_RaiseWindow: {
|
176
|
+
args: ["pointer"],
|
177
|
+
returns: "void",
|
178
|
+
},
|
179
|
+
SDL_RenderCopyEx: {
|
180
|
+
args: [
|
181
|
+
"pointer",
|
182
|
+
"pointer",
|
183
|
+
"pointer",
|
184
|
+
"pointer",
|
185
|
+
"double",
|
186
|
+
"pointer",
|
187
|
+
"int",
|
188
|
+
],
|
189
|
+
returns: "int",
|
190
|
+
},
|
191
|
+
});
|
177
192
|
|
178
193
|
export const libimage = dlopen(libImageImport.default, {
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
})
|
194
|
+
IMG_Init: {
|
195
|
+
args: ["int"],
|
196
|
+
returns: "int",
|
197
|
+
},
|
198
|
+
IMG_Load: {
|
199
|
+
args: ["cstring"],
|
200
|
+
returns: "pointer",
|
201
|
+
},
|
202
|
+
});
|
188
203
|
|
189
204
|
export const libttf = dlopen(libTTFImport.default, {
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
})
|
205
|
+
TTF_Init: {
|
206
|
+
returns: "int",
|
207
|
+
},
|
208
|
+
TTF_OpenFont: {
|
209
|
+
args: ["cstring", "int"],
|
210
|
+
returns: "pointer",
|
211
|
+
},
|
212
|
+
TTF_RenderText_Solid: {
|
213
|
+
args: ["pointer", "cstring", "u32"],
|
214
|
+
returns: "pointer",
|
215
|
+
},
|
216
|
+
TTF_SizeText: {
|
217
|
+
args: ["pointer", "cstring", "pointer", "pointer"],
|
218
|
+
returns: "int",
|
219
|
+
},
|
220
|
+
TTF_Quit: {
|
221
|
+
returns: "void",
|
222
|
+
},
|
223
|
+
TTF_CloseFont: {
|
224
|
+
args: ["pointer"],
|
225
|
+
returns: "void",
|
226
|
+
},
|
227
|
+
});
|
package/src/slifer.ts
CHANGED
@@ -1,115 +1,126 @@
|
|
1
1
|
import { libimage, libsdl, libttf } from "./ffi";
|
2
2
|
import Global from "./global";
|
3
|
-
import { ptr } from
|
3
|
+
import { ptr } from "bun:ffi";
|
4
4
|
import Graphics from "./modules/graphics";
|
5
5
|
import Keyboard from "./modules/keyboard";
|
6
6
|
import Mouse from "./modules/mouse";
|
7
7
|
|
8
8
|
export class SliferClass {
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
9
|
+
isRunning: boolean = true;
|
10
|
+
|
11
|
+
// Modules
|
12
|
+
Graphics = new Graphics();
|
13
|
+
Keyboard = new Keyboard();
|
14
|
+
Mouse = new Mouse();
|
15
|
+
|
16
|
+
constructor() {
|
17
|
+
const baseInit = libsdl.symbols.SDL_Init(0x00000020);
|
18
|
+
if (baseInit != 0) throw `SDL failed to initialize`;
|
19
|
+
|
20
|
+
const imageInit = libimage.symbols.IMG_Init(3);
|
21
|
+
if (imageInit != 3) throw `SDL Image failed to initialize`;
|
22
|
+
|
23
|
+
const ttfInit = libttf.symbols.TTF_Init();
|
24
|
+
if (ttfInit != 0) throw `SDL TTF failed to initialize`;
|
25
|
+
|
26
|
+
if (process.platform == "darwin") {
|
27
|
+
const tempFont = libttf.symbols.TTF_OpenFont(
|
28
|
+
Buffer.from("/System/Library/Fonts/SFNSMono.ttf"),
|
29
|
+
12,
|
30
|
+
);
|
31
|
+
if (tempFont == null) throw `Default font loading failed`;
|
32
|
+
Global.ptrFont = tempFont;
|
33
|
+
} else if (process.platform == "linux") {
|
34
|
+
const tempFont = libttf.symbols.TTF_OpenFont(
|
35
|
+
Buffer.from("/usr/share/fonts/truetype/dejavu/DejaVuSansMono.ttf"),
|
36
|
+
12,
|
37
|
+
);
|
38
|
+
if (tempFont == null) throw `Default font loading failed`;
|
39
|
+
Global.ptrFont = tempFont;
|
33
40
|
}
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
41
|
+
}
|
42
|
+
|
43
|
+
/**
|
44
|
+
* @param title Title of window
|
45
|
+
* @param width Width of window
|
46
|
+
* @param height Height of window
|
47
|
+
*/
|
48
|
+
createWindow(title: string, width: number, height: number): void {
|
49
|
+
// Creating cstring buffer from string
|
50
|
+
const _title = Buffer.from(title + "\x00");
|
51
|
+
|
52
|
+
// Creating window pointer
|
53
|
+
const _win = libsdl.symbols.SDL_CreateWindow(
|
54
|
+
_title,
|
55
|
+
0x2FFF0000,
|
56
|
+
0x2FFF0000,
|
57
|
+
width,
|
58
|
+
height,
|
59
|
+
0,
|
60
|
+
);
|
61
|
+
if (_win == null) throw `Window creation failed`;
|
62
|
+
Global.ptrWindow = _win;
|
63
|
+
|
64
|
+
// Creating renderer pointer
|
65
|
+
const _ren = libsdl.symbols.SDL_CreateRenderer(Global.ptrWindow, -1, 0);
|
66
|
+
if (_ren == null) throw `Renderer Creation failed`;
|
67
|
+
Global.ptrRenderer = _ren;
|
68
|
+
}
|
69
|
+
|
70
|
+
/**
|
71
|
+
* @returns if the window should close
|
72
|
+
*/
|
73
|
+
shouldClose(): boolean {
|
74
|
+
// Clear the renderer
|
75
|
+
libsdl.symbols.SDL_RenderClear(Global.ptrRenderer);
|
76
|
+
|
77
|
+
// Poll Events
|
78
|
+
const eventArray = new Uint16Array(32);
|
79
|
+
const isEvent = libsdl.symbols.SDL_PollEvent(ptr(eventArray));
|
80
|
+
|
81
|
+
if (isEvent) {
|
82
|
+
switch (eventArray[0]) {
|
83
|
+
// Quit event
|
84
|
+
case 256:
|
85
|
+
this.isRunning = false;
|
86
|
+
break;
|
87
|
+
// Keydown event
|
88
|
+
case 768:
|
89
|
+
const _dscancode = eventArray[8];
|
90
|
+
const _dkey = libsdl.symbols.SDL_GetKeyFromScancode(_dscancode);
|
91
|
+
const _dname = libsdl.symbols.SDL_GetKeyName(_dkey);
|
92
|
+
Keyboard.setKeyDown(_dname.toString().toLowerCase());
|
93
|
+
break;
|
94
|
+
// Keyup event
|
95
|
+
case 769:
|
96
|
+
const _uscancode = eventArray[8];
|
97
|
+
const _ukey = libsdl.symbols.SDL_GetKeyFromScancode(_uscancode);
|
98
|
+
const _uname = libsdl.symbols.SDL_GetKeyName(_ukey);
|
99
|
+
Keyboard.setKeyUp(_uname.toString().toLowerCase());
|
100
|
+
break;
|
101
|
+
// Mouse down event
|
102
|
+
case 1025:
|
103
|
+
const _dbtn = eventArray[8] - 256;
|
104
|
+
Mouse.setButtonDown(_dbtn);
|
105
|
+
break;
|
106
|
+
// Mouse up event
|
107
|
+
case 1026:
|
108
|
+
const _ubtn = eventArray[8];
|
109
|
+
Mouse.setButtonUp(_ubtn);
|
110
|
+
break;
|
111
|
+
}
|
104
112
|
}
|
105
113
|
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
114
|
+
return !this.isRunning;
|
115
|
+
}
|
116
|
+
|
117
|
+
/**
|
118
|
+
* Slifers quit method
|
119
|
+
*/
|
120
|
+
quit() {
|
121
|
+
libttf.symbols.TTF_CloseFont(Global.ptrFont);
|
122
|
+
libsdl.symbols.SDL_DestroyRenderer(Global.ptrRenderer);
|
123
|
+
libsdl.symbols.SDL_DestroyWindow(Global.ptrWindow);
|
124
|
+
libsdl.symbols.SDL_Quit();
|
125
|
+
}
|
126
|
+
}
|