2016-10-09 20:18:49 +02:00
|
|
|
#!/usr/bin/env python3
|
|
|
|
# Copyright (C) 2013-2016 Florian Festi
|
|
|
|
#
|
|
|
|
# This program is free software: you can redistribute it and/or modify
|
|
|
|
# it under the terms of the GNU General Public License as published by
|
|
|
|
# the Free Software Foundation, either version 3 of the License, or
|
|
|
|
# (at your option) any later version.
|
|
|
|
#
|
|
|
|
# This program is distributed in the hope that it will be useful,
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
# GNU General Public License for more details.
|
|
|
|
#
|
|
|
|
# You should have received a copy of the GNU General Public License
|
|
|
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
|
|
|
from boxes import *
|
|
|
|
|
2016-10-17 21:10:25 +02:00
|
|
|
class Arcade(Boxes):
|
2016-10-09 20:18:49 +02:00
|
|
|
"""Desktop Arcade Maschine"""
|
|
|
|
|
|
|
|
def __init__(self):
|
|
|
|
Boxes.__init__(self)
|
2016-11-01 14:03:07 +01:00
|
|
|
self.addSettingsArgs(edges.FingerJointSettings)
|
2016-10-17 21:10:25 +02:00
|
|
|
self.argparser.add_argument(
|
|
|
|
"--width", action="store", type=float, default=450.0,
|
|
|
|
help="inner width of the console")
|
2016-10-09 20:18:49 +02:00
|
|
|
|
|
|
|
def side(self, move=None):
|
2016-10-17 21:10:25 +02:00
|
|
|
# TODO: Add callbacks
|
|
|
|
|
|
|
|
y, h = self.y, self.h
|
2016-10-09 20:18:49 +02:00
|
|
|
t = self.thickness
|
|
|
|
|
2016-10-17 21:10:25 +02:00
|
|
|
if self.move(y+35, h+155, move, True):
|
2016-10-09 20:18:49 +02:00
|
|
|
return
|
|
|
|
|
2016-10-17 21:29:58 +02:00
|
|
|
self.moveTo(45, 0)
|
|
|
|
self.fingerHolesAt(10, 10, self.bottom, 0)
|
|
|
|
self.polyline(y-30, (90, 10))
|
2016-10-09 20:18:49 +02:00
|
|
|
self.fingerHolesAt(0.5*t, 10, self.back, 0)
|
|
|
|
self.fingerHolesAt(h-40-40, 10, self.back, 0)
|
|
|
|
|
|
|
|
self.polyline(h-10, (45, 10))
|
|
|
|
self.fingerHolesAt(0, 10, self.topback, 0)
|
|
|
|
self.fingerHolesAt(200, 10+0.5*t, self.top, 90)
|
|
|
|
self.fingerHolesAt(200-0.5*t, 110, self.speaker, -180)
|
|
|
|
self.polyline(200, (90, 10), 100, (90, 10), 100, (-90, 10), 350, (-30, 10))
|
|
|
|
self.fingerHolesAt(0, 10, self.keyb, 0)
|
|
|
|
self.fingerHolesAt(-0.5*t, 10+0.5*t, self.keyback, 90)
|
|
|
|
self.fingerHolesAt(150+0.5*t, 10+0.5*t, self.front, 90)
|
2016-10-17 21:29:58 +02:00
|
|
|
self.polyline(150, (90, 10), 124.45, (75, 10), 5)
|
2016-10-09 20:18:49 +02:00
|
|
|
|
2016-10-17 21:10:25 +02:00
|
|
|
self.move(y+35, h+155, move)
|
2016-10-09 20:18:49 +02:00
|
|
|
|
|
|
|
def keyboard(self):
|
2016-10-17 21:10:25 +02:00
|
|
|
# Add holes for the joystick and buttons here
|
2016-10-09 20:18:49 +02:00
|
|
|
pass
|
|
|
|
|
|
|
|
def speakers(self):
|
2016-10-17 21:10:25 +02:00
|
|
|
self.hole(self.width/4., 50, 40)
|
|
|
|
self.hole(self.width*3/4., 50, 40)
|
2016-10-09 20:18:49 +02:00
|
|
|
|
|
|
|
def render(self):
|
2016-10-17 21:29:58 +02:00
|
|
|
y, h = self.y, self.h = 540, 450
|
2016-10-17 21:10:25 +02:00
|
|
|
width = self.width
|
2016-10-09 20:18:49 +02:00
|
|
|
t = self.thickness
|
|
|
|
|
|
|
|
self.bottom = y-40-0.5*t
|
|
|
|
self.back = 40
|
|
|
|
self.backwall = h-40
|
2016-10-17 21:29:58 +02:00
|
|
|
self.front = 120
|
2016-10-09 20:18:49 +02:00
|
|
|
self.keyb = 150
|
2016-10-17 21:29:58 +02:00
|
|
|
self.keyback = 50
|
2016-10-09 20:18:49 +02:00
|
|
|
self.speaker = 150
|
|
|
|
self.top = 100-t
|
|
|
|
self.topback = 200-0.5*t
|
|
|
|
|
|
|
|
# Initialize canvas
|
|
|
|
self.open()
|
2016-10-17 21:10:25 +02:00
|
|
|
# Floor
|
|
|
|
self.rectangularWall(width, self.bottom, "efff", move="up")
|
2016-10-09 20:18:49 +02:00
|
|
|
# Back
|
2016-10-17 21:10:25 +02:00
|
|
|
self.rectangularWall(width, self.back, "Ffef", move="up")
|
|
|
|
self.rectangularWall(width, self.backwall, move="up")
|
|
|
|
self.rectangularWall(width, self.back, "efef", move="up")
|
2016-10-09 20:18:49 +02:00
|
|
|
|
2016-10-17 21:10:25 +02:00
|
|
|
# Front bottom
|
|
|
|
self.rectangularWall(width, self.front, "efff", move="up")
|
|
|
|
self.rectangularWall(width, self.keyb, "FfFf", callback=[self.keyboard], move="up")
|
|
|
|
self.rectangularWall(width, self.keyback, "ffef", move="up")
|
|
|
|
# Top
|
|
|
|
self.rectangularWall(width, self.speaker, "efff", callback=[None, None, self.speakers], move="up")
|
|
|
|
self.rectangularWall(width, self.top, "FfFf", move="up")
|
|
|
|
self.rectangularWall(width, self.topback, "ffef", move="up")
|
|
|
|
# Sides
|
|
|
|
self.side(move="up")
|
2016-10-09 20:18:49 +02:00
|
|
|
self.side(move="up")
|
|
|
|
|
|
|
|
self.close()
|
|
|
|
|
|
|
|
def main():
|
|
|
|
b = Arcade() # change to class name
|
|
|
|
b.parseArgs()
|
|
|
|
b.render()
|
|
|
|
|
|
|
|
if __name__ == '__main__':
|
|
|
|
main()
|