Changeset 527 for trunk/thune/gl/boot.c

Show
Ignore:
Timestamp:
05/26/08 17:22:18 (6 months ago)
Author:
krobillard
Message:

Added thune-gl widget! datatype.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/thune/gl/boot.c

    r516 r527  
    1   "[file string!] [\n" 
    2   "    file 16 read\n" 
    3   "    dup \"RIFF\" match ift (file load-wav return)\n" 
    4   "    file read\n" 
    5   "    dup \"#!\" match ift (eol find)\n" 
    6   "    to-block kernel-ops infuse\n" 
    7   "] func :load\n" 
    81  "[\n" 
    92  "    none :orient\n" 
     
    169  "context :camera\n" 
    1710  "[\n" 
    18   "    none :parent\n" 
    19   "    none :children\n" 
    2011  "    0,0 :area\n" 
    2112  "    none :key-down\n" 
     
    3021  "    none :draw\n" 
    3122  "]\n" 
    32   "context :widget-proto\n" 
     23  "context :t-widget-proto\n" 
     24  "[\n" 
     25  "    none :texture\n" 
     26  "    none :tex-size\n" 
     27  "    none :control-font\n" 
     28  "    none :title-font\n" 
     29  "    none :label\n" 
     30  "    none :area\n" 
     31  "    none :window-margin\n" 
     32  "    none :window\n" 
     33  "    none :button-size-limit\n" 
     34  "    none :button-up\n" 
     35  "    none :button-down\n" 
     36  "    none :button-hover\n" 
     37  "]\n" 
     38  "context dup :gui-style-proto :gui-style\n" 
    3339  "[\n" 
    3440  "    none :value\n" 
     
    4753  "        3 :mouse-mb]\n" 
    4854  "] case\n" 
    49   "[\n" 
    50   "    copy\n" 
    51   "    dup [dup first key-code 1 poke drop] iter/2\n" 
    52   "    [dup none select do] copy swap 2 poke\n" 
    53   "]\n" 
    54   "proc :key-handler\n" 
    55   "[wid | handler]\n" 
    56   "[\n" 
    57   "    [] display.events [\n" 
    58   "        dup first wid get dup :handler\n" 
    59   "        ift (second handler do) drop\n" 
    60   "    ] iter/2\n" 
    61   "]\n" 
    62   "func :handle.events\n" 
    63   "[wid | handler]\n" 
    64   "[\n" 
    65   "    [] 'wait display.events [\n" 
    66   "        dup first wid get dup :handler\n" 
    67   "        ift (second handler do) drop\n" 
    68   "    ] iter/2\n" 
    69   "]\n" 
    70   "func :wait-events\n" 
     55  "[drop display.events] proc :handle-events\n" 
     56  "[drop display.events/wait] proc :wait-events\n" 
    7157  "[list block! | ctx wrd n]\n" 
    7258  "[\n" 
     
    128114  "]\n" 
    129115  "make-opcodes :draw-list-opcodes\n" 
     116  "[draw-list! swap make] proc :draw-list\n" 
     117  "[draw-list! swap paren! as make] proc :draw-list.compile\n" 
    130118  "[\n" 
    131   "    draw-list! swap make\n" 
     119  "    copy\n" 
     120  "    dup [dup first key-code 1 poke drop] iter/2\n" 
    132121  "]\n" 
    133   "proc :draw-list\n" 
     122  "proc :key-handler\n" 
     123  "[desc | wid]\n" 
    134124  "[\n" 
    135   "    draw-list! swap paren! as make\n" 
    136   "]\n" 
    137   "proc :draw-list.compile\n" 
    138   "[desc | tok wid]\n" 
    139   "[\n" 
    140   "    widget-proto [] make :wid\n" 
    141   "    desc wid bind [\n" 
    142   "        :tok\n" 
    143   "        'key-down block! (tok/2 key-handler :wid/key-down)\n" 
    144   "        | 'key-up block! (tok/2 key-handler :wid/key-up)\n" 
    145   "        | 'mouse-move block! (tok/2 :wid/mouse-move)\n" 
    146   "        | 'mouse-down block! (tok/2 :wid/mouse-down)\n" 
    147   "        | 'mouse-up block! (tok/2 :wid/mouse-up)\n" 
    148   "        | 'mouse-wheel block! (tok/2 :wid/mouse-wheel)\n" 
    149   "        | 'close block! (tok/2 :wid/close)\n" 
    150   "        | 'resize block! (tok/2 :wid/resize)\n" 
    151   "        | 'joystick block! (tok/2 :wid/joystick)\n" 
    152   "        | 'draw block! (tok/2 :wid/draw)\n" 
    153   "        | 'draw-list block! (tok/2 draw-list :wid/draw)\n" 
    154   "        | 'parent word! (tok/2 get :wid/parent)\n" 
    155   "    ] parse.some\n" 
    156   "    wid/parent\n" 
    157   "    ['area wid/parent get :wid/area]\n" 
    158   "    [display.area :wid/area]\n" 
    159   "    either\n" 
    160   "    wid/resize ift (wid/area wid/resize do drop)\n" 
     125  "    desc t-widget-proto copy dup :wid set-key-values\n" 
     126  "    wid/key-down if-some (key-handler :wid/key-down)\n" 
     127  "    wid/key-up if-some (key-handler :wid/key-up)\n" 
     128  "    wid/draw if-some (draw-list :wid/draw)\n" 
    161129  "    wid\n" 
    162130  "]\n" 
    163   "func :make-widget\n" 
     131  "func :t-widget-context\n" 
     132  "[widget! [t-widget none] rot 2 poke make] proc :make-widget\n" 
     133  "[file string!] [\n" 
     134  "    file 16 read\n" 
     135  "    dup \"RIFF\" match ift (file load-wav return)\n" 
     136  "    file read\n" 
     137  "    dup \"#!\" match ift (eol find)\n" 
     138  "    to-block kernel-ops infuse\n" 
     139  "] func :load\n" 
    164140  "[load shader! swap make] proc :load.shader\n" 
    165141  "[load.png texture! swap make] proc :load.tex\n" 
     
    180156  "    0.0 0.0 0.0 1.0 \n" 
    181157  "] :unit-matrix\n" 
    182   "[\n" 
    183   "    unit-matrix copy swap 13 poke\n" 
    184   "]\n" 
    185   "proc :make-matrix\n" 
     158  "[unit-matrix copy swap 13 poke] proc :make-matrix\n"