Changeset 23540

Show
Ignore:
Timestamp:
11/13/08 13:33:22 (5 years ago)
Author:
fujidig
Message:

dialog, stick を実装

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • lang/javascript/hsp-on-js/trunk/gui-trial.js

    r23430 r23540  
    120120with(HSPonJS) { 
    121121        Utils.objectExtend(BuiltinFuncs[Token.Type.EXTCMD], { 
     122                0x03: function dialog(message, type, option) { 
     123                        this.scanArgs(arguments, '.?NSN'); 
     124                        message = message ? CP932.decode(message.toStrValue()._value) : ""; 
     125                        type = type ? type.toIntValue()._value : 0; 
     126                        option = option ? CP932.decode(option.toStrValue()._value) : ""; 
     127                        if(type & ~0xf) return; 
     128                        if(type & 2) { 
     129                                this.stat.assign(0, new IntValue(window.confirm(message) ? 6 : 7)); 
     130                        } else { 
     131                                window.alert(message); 
     132                                this.stat.assign(0, new IntValue(1)); 
     133                        } 
     134                }, 
    122135                0x0c: function pset(x, y) { 
    123136                        this.scanArgs(arguments, 'NN'); 
     
    287300                        this.ctx.fillRect(x, y, width, height); 
    288301                }, 
     302                0x34: function stick(v, notrigerMask) { 
     303                        this.scanArgs(arguments, 'vNN'); 
     304                        notrigerMask = notrigerMask ? notrigerMask.toIntValue()._value : 0; 
     305                        var state = 0; 
     306                        if(this.keyPressed[37]) state |= 1;     // カーソルキー左(←) 
     307                        if(this.keyPressed[38]) state |= 2;     // カーソルキー上(↑) 
     308                        if(this.keyPressed[39]) state |= 4;     // カーソルキー右(→) 
     309                        if(this.keyPressed[40]) state |= 8;     // カーソルキー下(↓) 
     310                        if(this.keyPressed[32]) state |= 16;    // スペースキー 
     311                        if(this.keyPressed[13]) state |= 32;    // Enterキー 
     312                        if(this.keyPressed[17]) state |= 64;    // Ctrlキー 
     313                        if(this.keyPressed[27]) state |= 128;   // ESCキー 
     314                        if(this.keyPressed[1])  state |= 256;   // マウスの左ボタン 
     315                        if(this.keyPressed[2])  state |= 512;   // マウスの右ボタン 
     316                        if(this.keyPressed[9])  state |= 1024;  // TABキー 
     317                        var lastState = this.lastStickState || 0; 
     318                        var trigger = state & ~lastState; 
     319                        this.lastStickState = state; 
     320                        v.assign(new IntValue(trigger | state & notrigerMask)); 
     321                } 
    289322        }); 
    290323        Utils.objectExtend(BuiltinFuncs[Token.Type.EXTSYSVAR], {