@@ -2,26 +2,35 @@ package kha;
2
2
3
3
import kha .WindowOptions ;
4
4
5
+ @:structInit
6
+ private class AudioOptions {
7
+ /** Allow `audio2.Audio` api initialization on mobile browsers (only for HTML5 target) **/
8
+ public var allowMobileWebAudio = false ;
9
+ }
10
+
5
11
@:structInit
6
12
class SystemOptions {
7
- @:optional public var title : String = " Kha" ;
8
- @:optional public var width : Int = - 1 ;
9
- @:optional public var height : Int = - 1 ;
10
- @:optional public var window : WindowOptions = null ;
11
- @:optional public var framebuffer : FramebufferOptions = null ;
13
+ public var title : String = " Kha" ;
14
+ public var width : Int = - 1 ;
15
+ public var height : Int = - 1 ;
16
+ public var window : WindowOptions = null ;
17
+ public var framebuffer : FramebufferOptions = null ;
18
+ public var audio : AudioOptions = null ;
12
19
13
20
/**
14
- * Used to provide parameters for System.start
21
+ * Used to provide parameters for ` System.start`
15
22
* @param title The application title is the default window title (unless the window parameter provides a title of its own)
16
23
* and is used for various other purposes - for example for save data locations
17
- * @param width Just a shortcut which overwrites window.width if set
18
- * @param height Just a shortcut which overwrites window.height if set
24
+ * @param width Just a shortcut which overwrites ` window.width` if set
25
+ * @param height Just a shortcut which overwrites ` window.height` if set
19
26
* @param window Optionally provide window options
20
27
* @param framebuffer Optionally provide framebuffer options
28
+ * @param audio Optionally provide audio options
21
29
*/
22
- public function new (title : String = " Kha" , ? width : Int = - 1 , ? height : Int = - 1 , window : WindowOptions = null , framebuffer : FramebufferOptions = null ) {
30
+ public function new (title : String = " Kha" , ? width : Int = - 1 , ? height : Int = - 1 , ? window : WindowOptions , ? framebuffer : FramebufferOptions ,
31
+ ? audio : AudioOptions ) {
23
32
this .title = title ;
24
- this .window = window == null ? {} : window ;
33
+ this .window = window ?? {};
25
34
26
35
if (width > 0 ) {
27
36
this .window .width = width ;
@@ -39,11 +48,10 @@ class SystemOptions {
39
48
this .height = this .window .height ;
40
49
}
41
50
42
- if (this .window .title == null ) {
43
- this .window .title = title ;
44
- }
51
+ this .window .title ?? = title ;
45
52
46
- this .framebuffer = framebuffer == null ? {} : framebuffer ;
53
+ this .framebuffer = framebuffer ?? {};
54
+ this .audio = audio ?? {};
47
55
}
48
56
}
49
57
0 commit comments