Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(352)

Side by Side Diff: nacltoons/data/res/editor.lua

Issue 15070003: [nacltoons] Add compound shapes. (Closed) Base URL: https://nativeclient-sdk.googlecode.com/svn/trunk/src
Patch Set: Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 -- Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 -- Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 -- Use of this source code is governed by a BSD-style license that can be 2 -- Use of this source code is governed by a BSD-style license that can be
3 -- found in the LICENSE file. 3 -- found in the LICENSE file.
4 4
5 --- Editor logic. 5 --- Editor logic.
6 6
7 local util = require 'util' 7 local util = require 'util'
8 local gui = require 'gui' 8 local gui = require 'gui'
9 local drawing = require 'drawing' 9 local drawing = require 'drawing'
10 10
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 end 72 end
73 73
74 -- Store start local of object and start location of touch 74 -- Store start local of object and start location of touch
75 start_pos = ccp(self.node:getPositionX(), self.node:getPositionY()) 75 start_pos = ccp(self.node:getPositionX(), self.node:getPositionY())
76 touch_pos = ccp(x, y) 76 touch_pos = ccp(x, y)
77 return true 77 return true
78 end 78 end
79 79
80 function object_handlers.OnTouchMoved(self, x, y, tapcount) 80 function object_handlers.OnTouchMoved(self, x, y, tapcount)
81 local delta = ccp(x - touch_pos.x, y - touch_pos.y) 81 local delta = ccp(x - touch_pos.x, y - touch_pos.y)
82 util.Log('on touch moved ' .. self.node:getTag())
83 x = self.node:getPositionX()
binji 2013/05/10 16:59:01 does this do anything?
Sam Clegg 2013/05/15 20:18:43 Done.
Sam Clegg 2013/05/15 20:18:43 Done.
84 y = self.node:getPositionY()
85
82 self.node:setPosition(ccp(start_pos.x + delta.x, start_pos.y + delta.y)) 86 self.node:setPosition(ccp(start_pos.x + delta.x, start_pos.y + delta.y))
83 end 87 end
84 88
85 function object_handlers.OnTouchEnded(self) 89 function object_handlers.OnTouchEnded(self)
86 local new_position = ccp(self.node:getPositionX(), self.node:getPositionY()) 90 local new_position = ccp(self.node:getPositionX(), self.node:getPositionY())
87 AddAction(actions.MOVE, { object = self, 91 AddAction(actions.MOVE, { object = self,
88 old_position = start_pos, 92 old_position = start_pos,
89 new_position = new_position }) 93 new_position = new_position })
90 touch_pos = nil 94 touch_pos = nil
91 start_pos = nil 95 start_pos = nil
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
178 parent:addChild(menu, MENU_DRAW_ORDER) 182 parent:addChild(menu, MENU_DRAW_ORDER)
179 183
180 -- Override all the object behaviour scripts. 184 -- Override all the object behaviour scripts.
181 drawing.handlers = object_handlers 185 drawing.handlers = object_handlers
182 for _, object in pairs(level_obj.object_map) do 186 for _, object in pairs(level_obj.object_map) do
183 object.script = object_handlers 187 object.script = object_handlers
184 end 188 end
185 end 189 end
186 190
187 return editor 191 return editor
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698