Guest User

Untitled

a guest
Dec 9th, 2018
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 21.95 KB | None | 0 0
  1.  
  2. --# Main
  3. -- AgendaTimer
  4.  
  5. -- Use this function to perform your initial setup
  6.  
  7. displayMode(FULLSCREEN)
  8. rectMode(CORNERS)
  9. font("HelveticaNeue")
  10.  
  11. function setup()
  12. --clearProjectData()
  13. VIEWING = 1
  14. EDITING = 2
  15. TITLES = 3
  16. HELP = 4
  17. -------------
  18. meetings = {}
  19. meeting = nil
  20. item = nil
  21. timePassed = 0
  22. startTime = ElapsedTime
  23. status = TITLES
  24. split = false
  25. blinkTimer = 0
  26. showSlider = false
  27. meetingScroll = 0
  28. itemScroll = 0
  29. startTime = ElapsedTime
  30. -------------
  31. playBtn = Frame(0,0,0,0)
  32. stopBtn = Frame(0,0,0,0)
  33. pauseBtn = Frame(0,0,0,0)
  34. addBtn = Frame(0,0,0,0)
  35. helpBtn = Frame(0,0,0,0)
  36. slider = TimeSlider(1)
  37. timeFrame = Frame(0,0,0,0)
  38. startFrame = Frame(0,0,0,0)
  39. -------------
  40. selectedMeeting = nil
  41. selectedMeetingPos = 0
  42. selectedItem = nil
  43. selectedItemPos = 0
  44. loadMeetings()
  45. if #meetings < 1 then
  46. meeting = Meeting("Example Meeting")
  47. item = AgendaItem("Greeting", 1, 0, 10)
  48. meeting:addItem(item)
  49. item = AgendaItem("Roundtable", 1, 0, 10)
  50. meeting:addItem(item)
  51. item = AgendaItem("Break Out", 1, 0, 10)
  52. meeting:addItem(item)
  53. item = AgendaItem("Closing", 1, 0, 10)
  54. meeting:addItem(item)
  55. meetings[1] = meeting
  56. end
  57. -------------
  58.  
  59. selectedMeeting = meetings[1]
  60. end
  61.  
  62. function drawEditor()
  63. pushMatrix()
  64. if selectedMeeting and not isKeyboardShowing()
  65. and not showSlider then
  66. showKeyboard()
  67. elseif showSlider and isKeyboardShowing() then
  68. hideKeyboard()
  69. end
  70. stroke(255, 0, 0, 255)
  71. fill(127, 127, 127, 255)
  72. fontSize(64)
  73. if selectedItem ~= nil then
  74.  
  75. --translate(-200,0)
  76. end
  77. text("Sessions", WIDTH/4, HEIGHT-35)
  78. text("Topics", WIDTH/4*3, HEIGHT-35)
  79.  
  80. fontSize(24)
  81. textMode(CORNER)
  82. textAlign(LEFT)
  83. for i, meeting in ipairs(meetings) do
  84. meeting.frame = Frame(10, HEIGHT-140-i*50,
  85. WIDTH/2 - 20, HEIGHT-140-i*50+50)
  86. fill(48, 140, 28, 173)
  87. stroke(40, 40, 50)
  88. meeting.frame:draw()
  89. fill(209, 209, 209, 255)
  90. text(meeting.name, meeting.frame.left+10,
  91. meeting.frame.bottom+10)
  92.  
  93. end
  94. if selectedMeeting then
  95. meeting = selectedMeeting
  96. strokeWidth(5)
  97. stroke(117, 127, 181, 255)
  98. line(meeting.frame.right-35,meeting.frame.bottom+15,
  99. meeting.frame.right-35,meeting.frame.top-15)
  100. line(meeting.frame.right-35,meeting.frame.bottom+15,
  101. meeting.frame.right-15,meeting.frame:midY())
  102. line(meeting.frame.right-35,meeting.frame.top-15,
  103. meeting.frame.right-15,meeting.frame:midY())
  104. for i, item in ipairs(meeting.items) do
  105. item.frame = Frame(WIDTH/2 + 20, HEIGHT-140-i*50,
  106. WIDTH - 20, HEIGHT-140-i*50+50)
  107. fill(48, 140, 28, 169)
  108. stroke(40, 40, 50)
  109. item.frame:draw()
  110. fill(209, 209, 209, 255)
  111. fontSize(24)
  112. textAlign(LEFT)
  113. text(item.name, item.frame.left+10,
  114. item.frame.bottom+10)
  115. textAlign(RIGHT)
  116. fontSize(14)
  117. if math.floor(item.duration) < 10 then
  118. text(":0"..item.duration,
  119. item.frame.right - 48, item.frame.bottom+17)
  120. else
  121. text(":"..item.duration,
  122. item.frame.right - 48, item.frame.bottom+17)
  123. end
  124. if i == selectedItemPos then
  125. noFill()
  126. stroke(117, 127, 181, 255)
  127. ellipse(item.frame.right - 40, item.frame:midY(), 42)
  128. end
  129. end
  130. end
  131.  
  132. textMode(CENTER)
  133. textAlign(CENTER)
  134. stroke(127, 127, 127, 255)
  135. line(WIDTH/2, 40, WIDTH/2, HEIGHT-150)
  136. if selectedMeeting then
  137. stroke(24, 88, 189, 255)
  138. else
  139. stroke(122, 127, 134, 87)
  140. end
  141.  
  142. addBtn = Frame(25,HEIGHT-125,50,HEIGHT-100)
  143. helpBtn = Frame(WIDTH-50,HEIGHT-125,WIDTH-25,HEIGHT-100)
  144. stroke(117, 127, 181, 255)
  145. strokeWidth(6)
  146. fill(48, 122, 157, 255)
  147. --line(addBtn:midX(), addBtn.bottom, addBtn:midX(), addBtn.top)
  148. --line(addBtn.left, addBtn:midY(), addBtn.right, addBtn:midY())
  149. fontSize(60)
  150. text("+", addBtn:midX(), addBtn:midY())
  151. fontSize(48)
  152. text("?", helpBtn:midX(), helpBtn:midY())
  153. if selectedMeeting then
  154. noFill()
  155. stroke(31, 64, 116, 255)
  156. strokeWidth(5)
  157. if selectedItem == nil then
  158. selectedMeeting.frame:draw()
  159. else
  160. selectedItem.frame:draw()
  161. end
  162. end
  163. textMode(CORNER)
  164. textAlign(LEFT)
  165. if showSlider and selectedItem then
  166. item = selectedItem
  167. slider:draw(item.value)
  168. elseif selectedMeeting then
  169. if ElapsedTime > blinkTimer + 0.25 then
  170. strokeWidth(5)
  171. stroke(217, 217, 217, 242)
  172. if selectedItem == nil then
  173. fontSize(24)
  174. w,h = textSize(selectedMeeting.name)
  175. w = w + 14
  176. line(selectedMeeting.frame.left + w,
  177. selectedMeeting.frame.bottom + 10,
  178. selectedMeeting.frame.left + w,
  179. selectedMeeting.frame.top - 10 )
  180. else
  181. fontSize(24)
  182. item = selectedItem
  183. w,h = textSize(item.name)
  184. w = w + 14
  185. line(item.frame.left + w,
  186. item.frame.bottom + 10,
  187. item.frame.left + w,
  188. item.frame.top - 10 )
  189. end
  190. end
  191. if ElapsedTime > blinkTimer + 0.5 then
  192. blinkTimer = ElapsedTime
  193. end
  194. end
  195. textMode(CENTER)
  196. textAlign(CENTER)
  197. popMatrix()
  198. end
  199.  
  200. function draw()
  201. background(26, 26, 50, 255)
  202. strokeWidth(5)
  203. if status == VIEWING then
  204. -- meeting underway
  205. meeting:draw()
  206. elseif status == TITLES then
  207. drawTitleScreen()
  208. elseif status == HELP then
  209. drawHelpScreen()
  210. else
  211. -- in editor
  212. drawEditor()
  213. end
  214. touch()
  215. end
  216.  
  217. function findMeeting(touch)
  218. local m, mm
  219. for m, mm in ipairs(meetings) do
  220. if mm.frame:touched(CurrentTouch) then
  221. selectedMeeting = mm
  222. playBtn = Frame(meeting.frame.right - 65,
  223. mm.frame.bottom,meeting.frame.right,
  224. mm.frame.top)
  225. startFrame = mm.frame
  226. selectedItem = nil
  227. selectedItemPos = 0
  228. end -- end if touched
  229. end -- for m, meeting
  230. end
  231.  
  232. function findItem(touch)
  233. local i, item
  234. -- see if
  235. if selectedMeeting then
  236. for i, item in ipairs(selectedMeeting.items) do
  237. if item.frame:touched(CurrentTouch) then
  238. selectedItemPos = i
  239. selectedItem = item
  240. startFrame = item.frame
  241. timeFrame = item.frame
  242. timeFrame.left = item.frame.right - 65
  243. end
  244. end
  245. end -- end select item
  246. end
  247.  
  248. function newMeeting(touch)
  249. local meeting
  250. meeting = Meeting("")
  251. meeting.items[1] = AgendaItem("Welcome", 1, 0, 0)
  252. table.insert(meetings, meeting)
  253. selectedMeeting = meeting
  254. selectedMeetingPos = table.maxn(meetings)
  255. selectedItem = nil
  256. selectedItemPos = 0
  257. end
  258.  
  259. function newItem(touch)
  260. local item
  261. item = AgendaItem("", 1, 0, 0)
  262. table.insert(selectedMeeting.items, item)
  263. selectedItem = item
  264. selectedItemPos = table.maxn(selectedMeeting.items)
  265. end
  266.  
  267. function saveMeetings()
  268. local n, m, s, c, i
  269. s = ""
  270. for n, m in ipairs(meetings) do
  271. s = s .. m.name
  272. if n < #meetings then s=s.. "," end
  273. end
  274. saveProjectData("ONTOPIC", s)
  275. s = "ONTOPIC"
  276. for n, m in ipairs(meetings) do
  277. s=""
  278. for j, i in ipairs(m.items) do
  279. s = s .. i.name .. ","
  280. s = s .. math.floor(i.duration)
  281. if j < #m.items then s = s .. "," end
  282. end
  283. saveProjectData(m.name, s)
  284. end
  285. end
  286.  
  287. function loadMeetings()
  288. -- read existing meetings
  289. local keys, k, s, i, count, m, item
  290. keys = readProjectData("ONTOPIC")
  291. if keys ~= nil then
  292. -- keys are a comma-delimited list
  293. for k in string.gmatch(keys,"([^,]+)") do
  294. -- k = name of meeting
  295. m = Meeting(k)
  296. -- now read topics for this meeting
  297. s = readProjectData(k)
  298. count = 0
  299. for i in string.gmatch(s,"([^,]+)") do
  300. if count == 0 then
  301. name = i
  302. count = 1
  303. else
  304. item = AgendaItem(name, math.floor(i), 0, 0)
  305. table.insert(m.items, item)
  306. count = 0
  307. end
  308. end
  309. table.insert(meetings, m)
  310. end
  311. end
  312. end
  313.  
  314. function touch()
  315. if CurrentTouch.state == BEGAN and
  316. CurrentTouch.state ~= oldState then
  317.  
  318. -- track where touch began
  319. startX = CurrentTouch.x
  320.  
  321.  
  322. if status == VIEWING then
  323. -- viewing meeting or paused
  324.  
  325.  
  326. if selectedMeeting:touched(CurrentTouch) then
  327. status = EDITING
  328. end
  329.  
  330. elseif status == TITLES then
  331. if playBtn:touched(CurrentTouch) then
  332. status = EDITING
  333. playBtn = Frame(0,0,0,0)
  334. end
  335.  
  336. elseif status == HELP then
  337. if playBtn:touched(CurrentTouch) then
  338. status = EDITING
  339. playBtn = Frame(0,0,0,0)
  340. end
  341.  
  342. elseif status == EDITING then
  343. -- editing meeting
  344.  
  345. if playBtn:touched(CurrentTouch) then
  346. saveMeetings()
  347. meeting.timePassed = 0
  348. status = VIEWING
  349. end -- playBtn
  350.  
  351. if helpBtn:touched(CurrentTouch) then
  352. saveMeetings()
  353. status = HELP
  354. end -- playBtn
  355.  
  356. if addBtn:touched(CurrentTouch) then
  357. if selectedItem then
  358. newItem(touch)
  359. else
  360. newMeeting(touch)
  361. end
  362. end -- addBtn
  363.  
  364. findMeeting(CurrentTouch)
  365.  
  366. findItem(CurrentTouch)
  367.  
  368. if timeFrame:touched(CurrentTouch) and selectedItem then
  369. slider.value =
  370. selectedItem.duration
  371. showSlider = true
  372. end -- time frame
  373.  
  374. end -- status == EDITING
  375. end -- touch == BEGAN
  376.  
  377. if CurrentTouch.state == MOVING then
  378. if showSlider then
  379. slider:touched(CurrentTouch)
  380. selectedItem.duration = slider.value
  381. end
  382. end -- touch == MOVING
  383.  
  384. if CurrentTouch.state == ENDED and
  385. CurrentTouch.state ~= oldState then
  386. if showSlider then
  387. showSlider = false
  388. elseif startFrame:touched(CurrentTouch) and
  389. startX < CurrentTouch.x - 75 then
  390. -- look to see if in start frame
  391. sound(SOUND_POWERUP, 28072)
  392. if selectedMeeting.frame:touched(CurrentTouch) then
  393. table.remove(meetings, selectedMeetingPos)
  394. elseif selectedItem.frame:touched(CurrentTouch) then
  395. table.remove(selectedMeeting.items, selectedItemPos)
  396. selectedItem = nil
  397. selectedItemPos = 0
  398. end
  399. end
  400. end -- touch == ENDED
  401.  
  402. oldState = CurrentTouch.state
  403.  
  404. end
  405.  
  406. function keyboard(key)
  407. if key ~= nil then
  408. if string.byte(key) == 10 then
  409. selectedMeeting = nil
  410. saveMeetings()
  411. hideKeyboard()
  412. keyboardShown = false
  413. elseif string.byte(key) == nil then
  414. if string.len(selectedMeeting.name) > 0 then
  415. if selectedItem then
  416. selectedItem.name = string.sub(selectedItem.name,
  417. 1, string.len(selectedItem.name) - 1)
  418. else
  419. selectedMeeting.name =
  420. string.sub(selectedMeeting.name,
  421. 1, string.len(selectedMeeting.name) - 1)
  422. end
  423. end
  424. else
  425. if selectedItem then
  426. selectedItem.name = selectedItem.name..key
  427. else
  428. selectedMeeting.name = selectedMeeting.name..key
  429. end
  430. end
  431. end
  432. end
  433.  
  434.  
  435. --# Meeting
  436. Meeting = class()
  437.  
  438. function Meeting:init(txt)
  439. -- you can accept and set parameters here
  440. self.name = txt
  441. self.duration = 0
  442. self.startTime = ElapsedTime
  443. self.timePassed = 0
  444. self.paused = true
  445. self.items = {}
  446. self.style = 1
  447. self.frame = Frame(0,0,0,0)
  448. self.playBtn = Frame(0,0,0,0)
  449. self.stopBtn = Frame(0,0,0,0)
  450. self.pauseBtn = Frame(0,0,0,0)
  451. end
  452.  
  453. function Meeting:addItem(item)
  454. self.duration = self.duration + item.duration
  455. table.insert(self.items, item)
  456. end
  457.  
  458. function Meeting:draw()
  459. local i, pixScale, left, right, bottom, top, totalTime
  460. pushStyle()
  461. if isKeyboardShowing() then
  462. hideKeyboard()
  463. end
  464. if self.style == 1 then
  465. fill(127, 127, 127, 255)
  466. stroke(255, 255, 255, 255)
  467. top = HEIGHT / 2 + HEIGHT / 4
  468. bottom = HEIGHT / 2 - HEIGHT / 4
  469. rect(10, bottom, WIDTH - 10, top)
  470. pixScale = (WIDTH-20) / self.duration
  471. left = 0
  472. right = 10
  473. width = 0
  474. noStroke()
  475. self.duration = 0
  476. for i, item in ipairs(self.items) do
  477. self.duration = self.duration + item.duration
  478. end
  479. totalTime = 0
  480. for i, item in ipairs(self.items) do
  481. if totalTime + item.duration * 60 < self.timePassed then
  482. fill(178, 107, 21, 255)
  483. elseif totalTime > self.timePassed then
  484. fill(49, 140, 28, 255)
  485. else
  486. fill(149, 164, 24, 255)
  487. end
  488.  
  489. stroke(220, 218, 232, 255)
  490.  
  491. left = right
  492. width = (item.duration * pixScale)
  493. right = left + width
  494. rect(left, bottom+5, right, top-5)
  495. fontSize(16)
  496. fill(255, 255, 255, 255)
  497. if right - left < 80 then
  498. pushMatrix()
  499. translate(left + (width/2), HEIGHT/2 + 20)
  500. rotate(90)
  501. text(item.name, 0, 0)
  502. popMatrix()
  503. else
  504. text(item.name, left + (width/2), HEIGHT/2 + 20)
  505. fill(182, 182, 182, 255)
  506. text("("..timeString(item.duration*60)..")", left +
  507. (width/2), HEIGHT/2 )
  508. end
  509. totalTime = totalTime + item.duration*60
  510. if right - left > 50 then
  511. fontSize(14)
  512. text(timeString(totalTime, false),
  513. right-20, top + 11)
  514. end
  515. fontSize(30)
  516. if self.duration*60 - self.timePassed < 1 then
  517. self.paused = true
  518. end
  519. text(timeString((self.duration*60 - self.timePassed), true),
  520. WIDTH/2, HEIGHT-100)
  521. end
  522. end
  523. if self.paused then
  524. stroke(82, 31, 31, 255)
  525. else
  526. stroke(31, 42, 89, 255)
  527. end
  528. strokeWidth(5)
  529. i = 10 + pixScale * self.timePassed / 60
  530. line(i - 3, top, i - 3, top - 50)
  531. line(i + 3, top, i + 3, top - 50)
  532. line(i - 3, bottom, i - 3, bottom + 50)
  533. line(i + 3, bottom, i + 3, bottom + 50)
  534. if self.paused then
  535. stroke(91, 45, 31, 132)
  536. else
  537. stroke(31, 41, 84, 125)
  538. end
  539. line(i, bottom, i, top)
  540. fill(220, 220, 220, 255)
  541. fontSize(14)
  542. text(timeString(self.timePassed, true),i, bottom-18)
  543. fontSize(36)
  544. text(self.name, WIDTH/2, HEIGHT-50)
  545.  
  546. -- advance timer
  547. if not self.paused then
  548. self.timePassed = self.timePassed +
  549. (ElapsedTime - self.startTime)
  550. self.startTime = ElapsedTime
  551. end
  552.  
  553. -- calculate button positions and draw
  554. stroke(31, 64, 116, 255)
  555. strokeWidth(5)
  556. noFill()
  557. self.playBtn = Frame(100,50,150,100)
  558. line(100,50,100,100)
  559. line(100,100,140,75)
  560. line(140,75,100,50)
  561. self.pauseBtn = Frame(WIDTH/2-30,50,WIDTH/2+30,100)
  562. rect(WIDTH/2-30,50,WIDTH/2-5,100)
  563. rect(WIDTH/2+5,50,WIDTH/2+30,100)
  564. self.stopBtn = Frame(WIDTH-150,50,WIDTH-100,100)
  565. rect(self.stopBtn.left,self.stopBtn.bottom,
  566. self.stopBtn.right,self.stopBtn.top)
  567. popStyle()
  568. end
  569.  
  570. function Meeting:touched(touch)
  571.  
  572. if self.playBtn:touched(touch) and self.paused then
  573. sound(SOUND_PICKUP, 1329)
  574. self.paused = false
  575. self.startTime = ElapsedTime
  576. elseif self.pauseBtn:touched(touch) and not self.paused then
  577. self.paused = true
  578. elseif self.stopBtn:touched(touch) then
  579. return true
  580. end
  581. return false
  582. end
  583.  
  584. --# AgendaItem
  585. AgendaItem = class()
  586.  
  587. -- an item for a meeting agenda
  588.  
  589. function AgendaItem:init(txt, len, s, e)
  590. self.startTime = s
  591. self.endTime = e
  592. self.duration = len
  593. self.name = txt
  594. self.notes = ""
  595. self.frame = Frame(0,0,0,0)
  596. end
  597.  
  598. function AgendaItem:draw()
  599.  
  600. end
  601.  
  602. function AgendaItem:touched(touch)
  603. end
  604.  
  605. --# Frame
  606. Frame = class()
  607.  
  608. -- Frame (lite)
  609. -- ver. 1.1
  610. -- a simple rectangle for holding controls.
  611. -- ====================
  612.  
  613. function Frame:init(left, bottom, right, top)
  614. self.left = left
  615. self.right = right
  616. self.bottom = bottom
  617. self.top = top
  618. end
  619.  
  620. function Frame:inset(dx, dy)
  621. self.left = self.left + dx
  622. self.right = self.right - dx
  623. self.bottom = self.bottom + dy
  624. self.top = self.top - dy
  625. end
  626.  
  627. function Frame:offset(dx, dy)
  628. self.left = self.left + dx
  629. self.right = self.right + dx
  630. self.bottom = self.bottom + dy
  631. self.top = self.top + dy
  632. end
  633.  
  634. function Frame:draw()
  635. pushStyle()
  636. rectMode(CORNERS)
  637. rect(self.left, self.bottom, self.right, self.top)
  638. popStyle()
  639. end
  640.  
  641. function Frame:touched(touch)
  642. if touch.x >= self.left and touch.x <= self.right then
  643. if touch.y >= self.bottom and touch.y <= self.top then
  644. return true
  645. end
  646. end
  647. return false
  648. end
  649.  
  650. function Frame:ptIn(x, y)
  651. if x >= self.left and x <= self.right then
  652. if y >= self.bottom and y <= self.top then
  653. return true
  654. end
  655. end
  656. return false
  657. end
  658.  
  659. function Frame:overlaps(f)
  660. if self.left > f.right or self.right < f.left or
  661. self.bottom > f.top or self.top < f.bottom then
  662. return false
  663. else
  664. return true
  665. end
  666. end
  667.  
  668. function Frame:width()
  669. return self.right - self.left
  670. end
  671.  
  672. function Frame:height()
  673. return self.top - self.bottom
  674. end
  675.  
  676. function Frame:midX()
  677. return (self.left + self.right) / 2
  678. end
  679.  
  680. function Frame:midY()
  681. return (self.bottom + self.top) / 2
  682. end
  683.  
  684. --# TimeSlider
  685. TimeSlider = class()
  686.  
  687. function TimeSlider:init(v)
  688. -- you can accept and set parameters here
  689. self.value = v
  690. end
  691.  
  692. function TimeSlider:draw()
  693. local s, t, x, y
  694. popStyle()
  695. strokeWidth(0)
  696. fill(117, 127, 181, 255)
  697. rect(WIDTH - 100, 50, WIDTH - 10, HEIGHT - 10)
  698. strokeWidth(5)
  699. stroke(70, 70, 70, 255)
  700. ellipse(WIDTH - 55, HEIGHT - 55, 70)
  701.  
  702. fill(255, 255, 255, 255)
  703. if self.value < 10 then
  704. s = ":0" .. self.value
  705. else
  706. s = ":" .. self.value
  707. end
  708. fontSize(18)
  709. textMode(CENTER)
  710. textAlign(CENTER)
  711. text(s, WIDTH - 55, HEIGHT - 55)
  712. line(WIDTH - 90, HEIGHT - 100, WIDTH - 20, HEIGHT - 100)
  713. stroke(192, 192, 192, 255)
  714. fontSize(14)
  715. strokeWidth(2)
  716. stroke(255, 255, 255, 255)
  717. for i = 1,60 do
  718. y = HEIGHT-100-((HEIGHT - 160)/60 * i)
  719. line(WIDTH - 70, y, WIDTH - 20, y)
  720. end
  721. strokeWidth(5)
  722. for i = 1,6 do
  723. t = i * 10
  724. y = HEIGHT-100-((HEIGHT - 160) / 6 * i)
  725. line(WIDTH - 70, y, WIDTH - 20, y)
  726. if t < 10 then s = ":0" .. t else s = ":" .. t end
  727. text(s, WIDTH - 85, y )
  728. end
  729. stroke(255, 22, 0, 255)
  730. y = HEIGHT-100-((HEIGHT - 160)/60 * self.value)
  731. line(WIDTH - 75, y, WIDTH - 15, y)
  732.  
  733. pushStyle()
  734. end
  735.  
  736. function TimeSlider:touched(touch)
  737. local y
  738. y = (HEIGHT - 100 - touch.y) / (HEIGHT - 160) * 60
  739. if y < 1 then y = 1 elseif y > 60 then y = 60 end
  740. self.value = math.floor(y)
  741. end
  742.  
  743. --# Utils
  744.  
  745. function timeString(time, showSeconds)
  746. hours = math.floor(time / 3600)
  747. if hours < 10 then hours = "0"..hours end
  748. mins = math.floor(time / 60)
  749. mins = math.fmod(mins, 3600)
  750. if mins < 10 then mins = "0"..mins end
  751. if showSeconds then
  752. secs = math.floor(time)
  753. secs = math.fmod(secs, 60)
  754. if secs < 10 then secs = "0"..secs end
  755. return hours..":"..mins.." " ..secs.."s"
  756. else
  757. return hours..":"..mins
  758. end
  759. end
  760.  
  761. function drawTitleScreen()
  762. pushStyle()
  763. font("Futura-CondensedExtraBold")
  764. fontSize(96)
  765. text("OnTopic", WIDTH/2, HEIGHT-100)
  766. fontSize(30)
  767. font("Futura-Medium")
  768. text("Manage your meeting.", WIDTH/2, HEIGHT-200)
  769. text("Conduct your session.", WIDTH/2, HEIGHT-250)
  770. text("Keep on schedule.", WIDTH/2, HEIGHT-300)
  771. text("Stay on topic.", WIDTH/2, HEIGHT-350)
  772. playBtn = Frame(10, 10, WIDTH-10, HEIGHT-10)
  773. sprite("Cargo Bot:Made With Codea", WIDTH/2, 70)
  774. fontSize(24)
  775. font("Papyrus")
  776. text("Copyright 2012 by Mark Sumner", WIDTH/2, 300)
  777.  
  778. if ElapsedTime > startTime + 8 then
  779. status = EDITING
  780. playBtn = Frame(0,0,0,0)
  781. end
  782. popStyle()
  783. end
  784.  
  785. function drawHelpScreen()
  786. if isKeyboardShowing() then
  787. hideKeyboard()
  788. end
  789. pushStyle()
  790. font("Futura-CondensedExtraBold")
  791. fill(82, 82, 82, 255)
  792. fontSize(96)
  793. text("OnTopic", WIDTH/2, HEIGHT-100)
  794. font("Papyrus")
  795. fontSize(24)
  796. text("Copyright 2012 by Mark Sumner", WIDTH/2, HEIGHT-220)
  797. fill(153, 176, 187, 255)
  798. fontSize(30)
  799. font("Futura-Medium")
  800. textMode(CORNER)
  801. textAlign(LEFT)
  802. text("Create a new event or topic by selecting an", 100, HEIGHT-400)
  803. text("existing item and tapping '+'", 100, HEIGHT-450)
  804. text("Touch the topic timer to change the", 100, HEIGHT-550)
  805. text("duration of a topic.", 100, HEIGHT-600)
  806. text("Start the session with a tap on the ", 100, HEIGHT-700)
  807. text("play button.", 100, HEIGHT-750)
  808. playBtn = Frame(10, 10, WIDTH-10, HEIGHT-10)
  809.  
  810. popStyle()
  811. end
Add Comment
Please, Sign In to add comment