reed | 1b6ab44 | 2014-11-03 19:55:41 -0800 | [diff] [blame] | 1 | gShowBounds = false |
reed | 7b86466 | 2014-11-04 13:24:47 -0800 | [diff] [blame] | 2 | gUseBlurInTransitions = false |
reed | 86217d8 | 2014-10-25 20:44:40 -0700 | [diff] [blame] | 3 | |
Ben Wagner | d6de89b | 2018-05-22 11:24:21 -0400 | [diff] [blame] | 4 | gPath = "resources/lua/" |
reed | 86217d8 | 2014-10-25 20:44:40 -0700 | [diff] [blame] | 5 | |
| 6 | function load_file(file) |
reed | 07dada7 | 2014-10-29 20:36:05 -0700 | [diff] [blame] | 7 | local prev_path = package.path |
reed | 86217d8 | 2014-10-25 20:44:40 -0700 | [diff] [blame] | 8 | package.path = package.path .. ";" .. gPath .. file .. ".lua" |
| 9 | require(file) |
reed | 07dada7 | 2014-10-29 20:36:05 -0700 | [diff] [blame] | 10 | package.path = prev_path |
reed | d2e7dfb | 2014-10-13 19:43:17 -0700 | [diff] [blame] | 11 | end |
| 12 | |
reed | 86217d8 | 2014-10-25 20:44:40 -0700 | [diff] [blame] | 13 | load_file("slides_utils") |
reed | d2e7dfb | 2014-10-13 19:43:17 -0700 | [diff] [blame] | 14 | |
Ben Wagner | d6de89b | 2018-05-22 11:24:21 -0400 | [diff] [blame] | 15 | gSlides = parse_file(io.open("resources/lua/slides_content2.lua", "r")) |
reed | 18ea777 | 2014-10-11 11:28:07 -0700 | [diff] [blame] | 16 | |
reed | bdc49ae | 2014-10-14 09:34:52 -0700 | [diff] [blame] | 17 | function make_rect(l, t, r, b) |
| 18 | return { left = l, top = t, right = r, bottom = b } |
| 19 | end |
| 20 | |
Ben Wagner | c6c10b4 | 2017-08-07 09:56:21 -0400 | [diff] [blame] | 21 | function make_paint(typefacename, style, size, color) |
reed | 18ea777 | 2014-10-11 11:28:07 -0700 | [diff] [blame] | 22 | local paint = Sk.newPaint(); |
| 23 | paint:setAntiAlias(true) |
reed | 09a1d67 | 2014-10-11 13:13:11 -0700 | [diff] [blame] | 24 | paint:setSubpixelText(true) |
Ben Wagner | c6c10b4 | 2017-08-07 09:56:21 -0400 | [diff] [blame] | 25 | paint:setTypeface(Sk.newTypeface(typefacename, style)) |
reed | 18ea777 | 2014-10-11 11:28:07 -0700 | [diff] [blame] | 26 | paint:setTextSize(size) |
| 27 | paint:setColor(color) |
| 28 | return paint |
| 29 | end |
| 30 | |
reed | 9e233b2 | 2014-11-03 12:18:24 -0800 | [diff] [blame] | 31 | function draw_bullet(canvas, x, y, paint, indent) |
| 32 | if 0 == indent then |
| 33 | return |
| 34 | end |
| 35 | local ps = paint:getTextSize() |
| 36 | local cx = x - ps * .8 |
| 37 | local cy = y - ps * .4 |
| 38 | local radius = ps * .2 |
| 39 | canvas:drawCircle(cx, cy, radius, paint) |
| 40 | end |
| 41 | |
reed | 1b6ab44 | 2014-11-03 19:55:41 -0800 | [diff] [blame] | 42 | function stroke_rect(canvas, rect, color) |
| 43 | local paint = Sk.newPaint() |
| 44 | paint:setStroke(true); |
| 45 | paint:setColor(color) |
| 46 | canvas:drawRect(rect, paint) |
| 47 | end |
| 48 | |
reed | de330ff | 2014-11-02 19:19:34 -0800 | [diff] [blame] | 49 | function drawSlide(canvas, slide, master_template) |
reed | bb8a0ab | 2014-11-03 22:32:07 -0800 | [diff] [blame] | 50 | |
| 51 | if #slide == 1 then |
| 52 | template = master_template.title |
| 53 | canvas:drawText(slide[1].text, 320, 240, template[1]) |
| 54 | return |
| 55 | end |
| 56 | |
| 57 | template = master_template.slide |
reed | bdc49ae | 2014-10-14 09:34:52 -0700 | [diff] [blame] | 58 | |
| 59 | local x = template.margin_x |
| 60 | local y = template.margin_y |
reed | 9e233b2 | 2014-11-03 12:18:24 -0800 | [diff] [blame] | 61 | local scale = 1.25 |
reed | bdc49ae | 2014-10-14 09:34:52 -0700 | [diff] [blame] | 62 | |
reed | de330ff | 2014-11-02 19:19:34 -0800 | [diff] [blame] | 63 | if slide.blockstyle == "code" then |
| 64 | local paint = master_template.codePaint |
| 65 | local fm = paint:getFontMetrics() |
| 66 | local height = #slide * (fm.descent - fm.ascent) |
| 67 | y = (480 - height) / 2 |
| 68 | for i = 1, #slide do |
| 69 | local node = slide[i] |
reed | 9e233b2 | 2014-11-03 12:18:24 -0800 | [diff] [blame] | 70 | y = y - fm.ascent * scale |
reed | de330ff | 2014-11-02 19:19:34 -0800 | [diff] [blame] | 71 | canvas:drawText(node.text, x, y, paint) |
reed | 9e233b2 | 2014-11-03 12:18:24 -0800 | [diff] [blame] | 72 | y = y + fm.descent * scale |
reed | de330ff | 2014-11-02 19:19:34 -0800 | [diff] [blame] | 73 | end |
| 74 | return |
| 75 | end |
| 76 | |
reed | d2e7dfb | 2014-10-13 19:43:17 -0700 | [diff] [blame] | 77 | for i = 1, #slide do |
| 78 | local node = slide[i] |
reed | 9fbc3f3 | 2014-10-21 07:12:58 -0700 | [diff] [blame] | 79 | local paint = template[node.indent + 1].paint |
| 80 | local extra_dy = template[node.indent + 1].extra_dy |
reed | d2e7dfb | 2014-10-13 19:43:17 -0700 | [diff] [blame] | 81 | local fm = paint:getFontMetrics() |
reed | 9e233b2 | 2014-11-03 12:18:24 -0800 | [diff] [blame] | 82 | local x_offset = -fm.ascent * node.indent * 1.25 |
reed | bdc49ae | 2014-10-14 09:34:52 -0700 | [diff] [blame] | 83 | |
reed | 1b6ab44 | 2014-11-03 19:55:41 -0800 | [diff] [blame] | 84 | local bounds = make_rect(x + x_offset, y, 620, 640) |
| 85 | local blob, newBottom = Sk.newTextBlob(node.text, bounds, paint) |
| 86 | draw_bullet(canvas, x + x_offset, y - fm.ascent, paint, node.indent) |
| 87 | canvas:drawTextBlob(blob, 0, 0, paint) |
reed | 36c9c11 | 2014-11-04 10:58:42 -0800 | [diff] [blame] | 88 | y = newBottom + paint:getTextSize() * .5 + extra_dy |
reed | 1b6ab44 | 2014-11-03 19:55:41 -0800 | [diff] [blame] | 89 | |
| 90 | if gShowBounds then |
| 91 | bounds.bottom = newBottom |
| 92 | stroke_rect(canvas, bounds, {a=1,r=0,g=1,b=0}) |
| 93 | stroke_rect(canvas, blob:bounds(), {a=1,r=1,g=0,b=0}) |
| 94 | end |
| 95 | |
reed | 9fbc3f3 | 2014-10-21 07:12:58 -0700 | [diff] [blame] | 96 | end |
| 97 | end |
| 98 | |
reed | 18ea777 | 2014-10-11 11:28:07 -0700 | [diff] [blame] | 99 | -------------------------------------------------------------------------------------- |
reed | 9fbc3f3 | 2014-10-21 07:12:58 -0700 | [diff] [blame] | 100 | function make_tmpl(paint, extra_dy) |
| 101 | return { paint = paint, extra_dy = extra_dy } |
| 102 | end |
reed | 18ea777 | 2014-10-11 11:28:07 -0700 | [diff] [blame] | 103 | |
reed | bdc49ae | 2014-10-14 09:34:52 -0700 | [diff] [blame] | 104 | function SkiaPoint_make_template() |
Ben Wagner | c6c10b4 | 2017-08-07 09:56:21 -0400 | [diff] [blame] | 105 | normal = Sk.newFontStyle() |
| 106 | bold = Sk.newFontStyle(700) |
reed | bdc49ae | 2014-10-14 09:34:52 -0700 | [diff] [blame] | 107 | local title = { |
| 108 | margin_x = 30, |
| 109 | margin_y = 100, |
| 110 | } |
Ben Wagner | c6c10b4 | 2017-08-07 09:56:21 -0400 | [diff] [blame] | 111 | title[1] = make_paint("Arial", bold, 45, { a=1, r=1, g=1, b=1 }) |
reed | bdc49ae | 2014-10-14 09:34:52 -0700 | [diff] [blame] | 112 | title[1]:setTextAlign("center") |
Ben Wagner | c6c10b4 | 2017-08-07 09:56:21 -0400 | [diff] [blame] | 113 | title[2] = make_paint("Arial", bold, 25, { a=1, r=.75, g=.75, b=.75 }) |
reed | bdc49ae | 2014-10-14 09:34:52 -0700 | [diff] [blame] | 114 | title[2]:setTextAlign("center") |
reed | 18ea777 | 2014-10-11 11:28:07 -0700 | [diff] [blame] | 115 | |
reed | bdc49ae | 2014-10-14 09:34:52 -0700 | [diff] [blame] | 116 | local slide = { |
| 117 | margin_x = 20, |
reed | 9fbc3f3 | 2014-10-21 07:12:58 -0700 | [diff] [blame] | 118 | margin_y = 25, |
reed | bdc49ae | 2014-10-14 09:34:52 -0700 | [diff] [blame] | 119 | } |
Ben Wagner | c6c10b4 | 2017-08-07 09:56:21 -0400 | [diff] [blame] | 120 | slide[1] = make_tmpl(make_paint("Arial", bold, 35, { a=1, r=1, g=1, b=1 }), 18) |
| 121 | slide[2] = make_tmpl(make_paint("Arial", normal, 25, { a=1, r=1, g=1, b=1 }), 10) |
| 122 | slide[3] = make_tmpl(make_paint("Arial", normal, 20, { a=1, r=.9, g=.9, b=.9 }), 5) |
reed | bdc49ae | 2014-10-14 09:34:52 -0700 | [diff] [blame] | 123 | |
| 124 | return { |
| 125 | title = title, |
| 126 | slide = slide, |
Ben Wagner | c6c10b4 | 2017-08-07 09:56:21 -0400 | [diff] [blame] | 127 | codePaint = make_paint("Courier", normal, 20, { a=1, r=.9, g=.9, b=.9 }), |
reed | bdc49ae | 2014-10-14 09:34:52 -0700 | [diff] [blame] | 128 | } |
| 129 | end |
| 130 | |
| 131 | gTemplate = SkiaPoint_make_template() |
reed | 18ea777 | 2014-10-11 11:28:07 -0700 | [diff] [blame] | 132 | |
| 133 | gRedPaint = Sk.newPaint() |
| 134 | gRedPaint:setAntiAlias(true) |
| 135 | gRedPaint:setColor{a=1, r=1, g=0, b=0 } |
| 136 | |
reed | 09a1d67 | 2014-10-11 13:13:11 -0700 | [diff] [blame] | 137 | -- animation.proc is passed the canvas before drawing. |
| 138 | -- The animation.proc returns itself or another animation (which means keep animating) |
| 139 | -- or it returns nil, which stops the animation. |
| 140 | -- |
| 141 | local gCurrAnimation |
| 142 | |
reed | f355df5 | 2014-10-12 12:18:40 -0700 | [diff] [blame] | 143 | gSlideIndex = 1 |
| 144 | |
reed | 7b86466 | 2014-11-04 13:24:47 -0800 | [diff] [blame] | 145 | ----------------------------------------------------------------------------- |
| 146 | |
reed | 96affcd | 2014-10-13 12:38:04 -0700 | [diff] [blame] | 147 | function new_drawable_picture(pic) |
| 148 | return { |
| 149 | picture = pic, |
| 150 | width = pic:width(), |
| 151 | height = pic:height(), |
| 152 | draw = function (self, canvas, x, y, paint) |
| 153 | canvas:drawPicture(self.picture, x, y, paint) |
| 154 | end |
| 155 | } |
| 156 | end |
| 157 | |
| 158 | function new_drawable_image(img) |
| 159 | return { |
| 160 | image = img, |
| 161 | width = img:width(), |
| 162 | height = img:height(), |
| 163 | draw = function (self, canvas, x, y, paint) |
| 164 | canvas:drawImage(self.image, x, y, paint) |
| 165 | end |
| 166 | } |
| 167 | end |
reed | f355df5 | 2014-10-12 12:18:40 -0700 | [diff] [blame] | 168 | |
reed | 7b86466 | 2014-11-04 13:24:47 -0800 | [diff] [blame] | 169 | function convert_to_picture_drawable(slide) |
| 170 | local rec = Sk.newPictureRecorder() |
| 171 | drawSlide(rec:beginRecording(640, 480), slide, gTemplate) |
| 172 | return new_drawable_picture(rec:endRecording()) |
| 173 | end |
| 174 | |
| 175 | function convert_to_image_drawable(slide) |
| 176 | local surf = Sk.newRasterSurface(640, 480) |
| 177 | drawSlide(surf:getCanvas(), slide, gTemplate) |
| 178 | return new_drawable_image(surf:newImageSnapshot()) |
| 179 | end |
| 180 | |
reed | 86217d8 | 2014-10-25 20:44:40 -0700 | [diff] [blame] | 181 | function new_drawable_slide(slide) |
| 182 | return { |
| 183 | slide = slide, |
| 184 | draw = function (self, canvas, x, y, paint) |
| 185 | if (nil == paint or ("number" == type(paint) and (1 == paint))) then |
| 186 | canvas:save() |
| 187 | else |
| 188 | canvas:saveLayer(paint) |
| 189 | end |
| 190 | canvas:translate(x, y) |
| 191 | drawSlide(canvas, self.slide, gTemplate) |
| 192 | canvas:restore() |
| 193 | end |
| 194 | } |
| 195 | end |
| 196 | |
reed | 7b86466 | 2014-11-04 13:24:47 -0800 | [diff] [blame] | 197 | gNewDrawableFactory = { |
| 198 | default = new_drawable_slide, |
| 199 | picture = convert_to_picture_drawable, |
| 200 | image = convert_to_image_drawable, |
| 201 | } |
| 202 | |
| 203 | ----------------------------------------------------------------------------- |
| 204 | |
reed | 86217d8 | 2014-10-25 20:44:40 -0700 | [diff] [blame] | 205 | function next_slide() |
| 206 | local prev = gSlides[gSlideIndex] |
| 207 | |
reed | bb8a0ab | 2014-11-03 22:32:07 -0800 | [diff] [blame] | 208 | if gSlideIndex < #gSlides then |
| 209 | gSlideIndex = gSlideIndex + 1 |
| 210 | spawn_transition(prev, gSlides[gSlideIndex], true) |
reed | 86217d8 | 2014-10-25 20:44:40 -0700 | [diff] [blame] | 211 | end |
reed | 86217d8 | 2014-10-25 20:44:40 -0700 | [diff] [blame] | 212 | end |
| 213 | |
| 214 | function prev_slide() |
| 215 | local prev = gSlides[gSlideIndex] |
| 216 | |
reed | bb8a0ab | 2014-11-03 22:32:07 -0800 | [diff] [blame] | 217 | if gSlideIndex > 1 then |
| 218 | gSlideIndex = gSlideIndex - 1 |
| 219 | spawn_transition(prev, gSlides[gSlideIndex], false) |
reed | 86217d8 | 2014-10-25 20:44:40 -0700 | [diff] [blame] | 220 | end |
reed | 86217d8 | 2014-10-25 20:44:40 -0700 | [diff] [blame] | 221 | end |
| 222 | |
reed | 7b86466 | 2014-11-04 13:24:47 -0800 | [diff] [blame] | 223 | gDrawableType = "default" |
reed | 468b181 | 2014-10-19 11:42:54 -0700 | [diff] [blame] | 224 | |
reed | 07dada7 | 2014-10-29 20:36:05 -0700 | [diff] [blame] | 225 | load_file("slides_transitions") |
| 226 | |
reed | f355df5 | 2014-10-12 12:18:40 -0700 | [diff] [blame] | 227 | function spawn_transition(prevSlide, nextSlide, is_forward) |
| 228 | local transition |
| 229 | if is_forward then |
reed | 07dada7 | 2014-10-29 20:36:05 -0700 | [diff] [blame] | 230 | transition = gTransitionTable[nextSlide.transition] |
reed | f355df5 | 2014-10-12 12:18:40 -0700 | [diff] [blame] | 231 | else |
reed | 07dada7 | 2014-10-29 20:36:05 -0700 | [diff] [blame] | 232 | transition = gTransitionTable[prevSlide.transition] |
reed | f355df5 | 2014-10-12 12:18:40 -0700 | [diff] [blame] | 233 | end |
| 234 | |
| 235 | if not transition then |
reed | d2e7dfb | 2014-10-13 19:43:17 -0700 | [diff] [blame] | 236 | transition = fade_slide_transition |
reed | f355df5 | 2014-10-12 12:18:40 -0700 | [diff] [blame] | 237 | end |
| 238 | |
reed | 7b86466 | 2014-11-04 13:24:47 -0800 | [diff] [blame] | 239 | local prevDrawable = gNewDrawableFactory[gDrawableType](prevSlide) |
| 240 | local nextDrawable = gNewDrawableFactory[gDrawableType](nextSlide) |
reed | 96affcd | 2014-10-13 12:38:04 -0700 | [diff] [blame] | 241 | gCurrAnimation = transition(prevDrawable, nextDrawable, is_forward) |
reed | f355df5 | 2014-10-12 12:18:40 -0700 | [diff] [blame] | 242 | end |
| 243 | |
| 244 | -------------------------------------------------------------------------------------- |
| 245 | |
reed | 09a1d67 | 2014-10-11 13:13:11 -0700 | [diff] [blame] | 246 | function spawn_rotate_animation() |
| 247 | gCurrAnimation = { |
| 248 | angle = 0, |
| 249 | angle_delta = 5, |
| 250 | pivot_x = 320, |
| 251 | pivot_y = 240, |
reed | f355df5 | 2014-10-12 12:18:40 -0700 | [diff] [blame] | 252 | proc = function (self, canvas, drawSlideProc) |
| 253 | if self.angle >= 360 then |
| 254 | drawSlideProc(canvas) |
reed | 09a1d67 | 2014-10-11 13:13:11 -0700 | [diff] [blame] | 255 | return nil |
| 256 | end |
reed | f355df5 | 2014-10-12 12:18:40 -0700 | [diff] [blame] | 257 | canvas:translate(self.pivot_x, self.pivot_y) |
| 258 | canvas:rotate(self.angle) |
| 259 | canvas:translate(-self.pivot_x, -self.pivot_y) |
| 260 | drawSlideProc(canvas) |
reed | 09a1d67 | 2014-10-11 13:13:11 -0700 | [diff] [blame] | 261 | |
reed | f355df5 | 2014-10-12 12:18:40 -0700 | [diff] [blame] | 262 | self.angle = self.angle + self.angle_delta |
| 263 | return self |
reed | 09a1d67 | 2014-10-11 13:13:11 -0700 | [diff] [blame] | 264 | end |
| 265 | } |
| 266 | end |
| 267 | |
| 268 | function spawn_scale_animation() |
| 269 | gCurrAnimation = { |
| 270 | scale = 1, |
| 271 | scale_delta = .95, |
| 272 | scale_limit = 0.2, |
| 273 | pivot_x = 320, |
| 274 | pivot_y = 240, |
reed | f355df5 | 2014-10-12 12:18:40 -0700 | [diff] [blame] | 275 | proc = function (self, canvas, drawSlideProc) |
| 276 | if self.scale < self.scale_limit then |
| 277 | self.scale = self.scale_limit |
| 278 | self.scale_delta = 1 / self.scale_delta |
reed | 09a1d67 | 2014-10-11 13:13:11 -0700 | [diff] [blame] | 279 | end |
reed | f355df5 | 2014-10-12 12:18:40 -0700 | [diff] [blame] | 280 | if self.scale > 1 then |
| 281 | drawSlideProc(canvas) |
reed | 09a1d67 | 2014-10-11 13:13:11 -0700 | [diff] [blame] | 282 | return nil |
| 283 | end |
reed | f355df5 | 2014-10-12 12:18:40 -0700 | [diff] [blame] | 284 | canvas:translate(self.pivot_x, self.pivot_y) |
| 285 | canvas:scale(self.scale, self.scale) |
| 286 | canvas:translate(-self.pivot_x, -self.pivot_y) |
| 287 | drawSlideProc(canvas) |
reed | 09a1d67 | 2014-10-11 13:13:11 -0700 | [diff] [blame] | 288 | |
reed | f355df5 | 2014-10-12 12:18:40 -0700 | [diff] [blame] | 289 | self.scale = self.scale * self.scale_delta |
| 290 | return self |
reed | 09a1d67 | 2014-10-11 13:13:11 -0700 | [diff] [blame] | 291 | end |
| 292 | } |
| 293 | end |
| 294 | |
reed | 9fbc3f3 | 2014-10-21 07:12:58 -0700 | [diff] [blame] | 295 | local bgPaint = nil |
| 296 | |
| 297 | function draw_bg(canvas) |
| 298 | if not bgPaint then |
| 299 | bgPaint = Sk.newPaint() |
| 300 | local grad = Sk.newLinearGradient( 0, 0, { a=1, r=0, g=0, b=.3 }, |
| 301 | 640, 480, { a=1, r=0, g=0, b=.8 }) |
| 302 | bgPaint:setShader(grad) |
reed | bb8a0ab | 2014-11-03 22:32:07 -0800 | [diff] [blame] | 303 | bgPaint:setDither(true) |
reed | 9fbc3f3 | 2014-10-21 07:12:58 -0700 | [diff] [blame] | 304 | end |
| 305 | |
| 306 | canvas:drawPaint(bgPaint) |
| 307 | end |
| 308 | |
reed | bdc49ae | 2014-10-14 09:34:52 -0700 | [diff] [blame] | 309 | function onDrawContent(canvas, width, height) |
| 310 | local matrix = Sk.newMatrix() |
| 311 | matrix:setRectToRect(make_rect(0, 0, 640, 480), make_rect(0, 0, width, height), "center") |
| 312 | canvas:concat(matrix) |
| 313 | |
reed | 9fbc3f3 | 2014-10-21 07:12:58 -0700 | [diff] [blame] | 314 | draw_bg(canvas) |
| 315 | |
reed | f355df5 | 2014-10-12 12:18:40 -0700 | [diff] [blame] | 316 | local drawSlideProc = function(canvas) |
reed | bdc49ae | 2014-10-14 09:34:52 -0700 | [diff] [blame] | 317 | drawSlide(canvas, gSlides[gSlideIndex], gTemplate) |
reed | 09a1d67 | 2014-10-11 13:13:11 -0700 | [diff] [blame] | 318 | end |
| 319 | |
reed | 09a1d67 | 2014-10-11 13:13:11 -0700 | [diff] [blame] | 320 | if gCurrAnimation then |
reed | f355df5 | 2014-10-12 12:18:40 -0700 | [diff] [blame] | 321 | gCurrAnimation = gCurrAnimation:proc(canvas, drawSlideProc) |
reed | 09a1d67 | 2014-10-11 13:13:11 -0700 | [diff] [blame] | 322 | return true |
| 323 | else |
reed | f355df5 | 2014-10-12 12:18:40 -0700 | [diff] [blame] | 324 | drawSlideProc(canvas) |
reed | 09a1d67 | 2014-10-11 13:13:11 -0700 | [diff] [blame] | 325 | return false |
| 326 | end |
| 327 | end |
| 328 | |
| 329 | function onClickHandler(x, y) |
| 330 | return false |
| 331 | end |
| 332 | |
| 333 | local keyProcs = { |
| 334 | n = next_slide, |
| 335 | p = prev_slide, |
| 336 | r = spawn_rotate_animation, |
| 337 | s = spawn_scale_animation, |
reed | c766398 | 2014-10-21 10:46:01 -0700 | [diff] [blame] | 338 | ["="] = function () scale_text_delta(gTemplate, 1) end, |
| 339 | ["-"] = function () scale_text_delta(gTemplate, -1) end, |
reed | 1b6ab44 | 2014-11-03 19:55:41 -0800 | [diff] [blame] | 340 | |
| 341 | b = function () gShowBounds = not gShowBounds end, |
reed | 7b86466 | 2014-11-04 13:24:47 -0800 | [diff] [blame] | 342 | B = function () gUseBlurInTransitions = not gUseBlurInTransitions end, |
| 343 | |
| 344 | ["1"] = function () gDrawableType = "default" end, |
| 345 | ["2"] = function () gDrawableType = "picture" end, |
| 346 | ["3"] = function () gDrawableType = "image" end, |
reed | 09a1d67 | 2014-10-11 13:13:11 -0700 | [diff] [blame] | 347 | } |
| 348 | |
| 349 | function onCharHandler(uni) |
| 350 | local proc = keyProcs[uni] |
| 351 | if proc then |
| 352 | proc() |
| 353 | return true |
| 354 | end |
| 355 | return false |
| 356 | end |