@@ -7,6 +7,7 @@ Licensed under the MIT License
7
7
const AJIPACK_WIDTH = 320 ;
8
8
const AJIPACK_HEIGHT = 240 ;
9
9
const AJIPACK_FPS = 33.0 ;
10
+ let ajiDate = new Date ( ) ;
10
11
let ajiDrawTime = Date . now ( ) ;
11
12
let ajiCanvas , ajiContext , ajiVideo ;
12
13
let ajiBG = [ new Image ( ) , new Image ( ) , new Image ( ) , new Image ( ) ] ;
@@ -44,6 +45,7 @@ function ajiInit() {
44
45
}
45
46
46
47
function ajiMain ( ) {
48
+ ajiDate = new Date ( ) ;
47
49
const ajiNowTime = Date . now ( ) ;
48
50
if ( ajiNowTime - ajiDrawTime >= 1000 / AJIPACK_FPS ) {
49
51
ajiDrawTime = ajiNowTime ;
@@ -155,6 +157,8 @@ function ajiDrawAlignText(text, x, y, w, align) {
155
157
}
156
158
}
157
159
160
+ // BG
161
+
158
162
async function ajiSetBG ( id , src ) {
159
163
if ( ajiExistData ( src ) == true ) {
160
164
await new Promise ( ( resolve , reject ) => {
@@ -179,6 +183,8 @@ async function ajiAddSprite(id, src) {
179
183
}
180
184
}
181
185
186
+ // Sprite
187
+
182
188
function ajiGetSprite ( id ) {
183
189
for ( let i = 0 ; i < ajiSprite . length ; i ++ ) {
184
190
if ( ajiSprite [ i ] . id == id ) {
@@ -233,6 +239,8 @@ function ajiDrawSpriteZoom(id, x, y, w, h) {
233
239
}
234
240
}
235
241
242
+ // Audio
243
+
236
244
async function ajiAddAudio ( id , src ) {
237
245
if ( ajiExistAudio ( id ) == false ) {
238
246
ajiAudio . push ( {
@@ -297,6 +305,8 @@ function ajiStopAudio(id) {
297
305
ajiAudio [ ajiFindAudioNumber ( id ) ] . source . stop ( ) ;
298
306
}
299
307
308
+ // Video
309
+
300
310
async function ajiLoadVideo ( src ) {
301
311
if ( ajiExistData ( src ) == true ) {
302
312
await new Promise ( ( resolve , reject ) => {
@@ -331,6 +341,8 @@ function ajiSetVideoCurrentTime(time) {
331
341
ajiVideo . currentTime = time ;
332
342
}
333
343
344
+ // Mouse
345
+
334
346
function ajiMouseX ( ) {
335
347
return ajiMouse . x ;
336
348
}
@@ -357,3 +369,41 @@ function ajiClick() {
357
369
return false ;
358
370
}
359
371
}
372
+
373
+ // Date & Time
374
+
375
+ function ajiGetYear ( ) {
376
+ return ajiDate . getFullYear ( ) ;
377
+ }
378
+
379
+ function ajiGetMonth ( ) {
380
+ return ajiDate . getMonth ( ) + 1 ;
381
+ }
382
+
383
+ function ajiGetDate ( ) {
384
+ return ajiDate . getDate ( ) ;
385
+ }
386
+
387
+ function ajiGetDay ( ) {
388
+ return ajiDate . getDay ( ) ;
389
+ }
390
+
391
+ function ajiGetHours ( ) {
392
+ return ajiDate . getHours ( ) ;
393
+ }
394
+
395
+ function ajiGetMinutes ( ) {
396
+ return ajiDate . getMinutes ( ) ;
397
+ }
398
+
399
+ function ajiGetSeconds ( ) {
400
+ return ajiDate . getSeconds ( ) ;
401
+ }
402
+
403
+ function ajiGetDateString ( ) {
404
+ return ajiDate . toLocaleDateString ( ) ;
405
+ }
406
+
407
+ function ajiGetTimeString ( ) {
408
+ return ajiDate . toLocaleTimeString ( ) ;
409
+ }
0 commit comments