Arcade: Make height of monitor and depth of keyboard adjustable
Resolves: #166
This commit is contained in:
parent
d6495fc7b4
commit
877915eb74
|
@ -25,33 +25,47 @@ class Arcade(Boxes):
|
|||
self.argparser.add_argument(
|
||||
"--width", action="store", type=float, default=450.0,
|
||||
help="inner width of the console")
|
||||
self.argparser.add_argument(
|
||||
"--monitor_height", action="store", type=float, default=350.0,
|
||||
help="inner width of the console")
|
||||
self.argparser.add_argument(
|
||||
"--keyboard_depth", action="store", type=float, default=150.0,
|
||||
help="inner width of the console")
|
||||
|
||||
def side(self, move=None):
|
||||
# TODO: Add callbacks
|
||||
|
||||
y, h = self.y, self.h
|
||||
t = self.thickness
|
||||
r = 10
|
||||
d_30 = 2* r * math.tan(math.radians(15))
|
||||
|
||||
if self.move(y+35, h+155, move, True):
|
||||
tw, th = y+2*r+(self.front+t) * math.sin(math.radians(15)), h+2*r+(self.topback+t)/2**0.5
|
||||
if self.move(tw, th, move, True):
|
||||
return
|
||||
|
||||
self.moveTo(45, 0)
|
||||
self.fingerHolesAt(10, 10, self.bottom, 0)
|
||||
self.polyline(y-30, (90, 10))
|
||||
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)
|
||||
self.polyline(150, (90, 10), 124.45, (75, 10), 5)
|
||||
self.moveTo(r+(self.front+t) * math.sin(math.radians(15)), 0)
|
||||
|
||||
self.move(y+35, h+155, move)
|
||||
with self.saved_context():
|
||||
self.moveTo(0, r)
|
||||
self.polyline(y, 90, h, 45, self.topback+t, 90, self.top+2*t, 90, 100, -90, self.monitor_height, -30, self.keyboard_depth+2*t, 90, self.front+t, 75)
|
||||
|
||||
self.fingerHolesAt(10, r+t/2, self.bottom, 0)
|
||||
self.polyline(y, (90, r))
|
||||
self.fingerHolesAt(0.5*t, r+t/2, self.back, 0)
|
||||
self.fingerHolesAt(h-40-40, r+t/2, self.back, 0)
|
||||
|
||||
self.polyline(h, (45, r))
|
||||
self.fingerHolesAt(0, r+t/2, self.topback, 0)
|
||||
self.fingerHolesAt(self.topback+t/2, r+t, self.top, 90)
|
||||
self.fingerHolesAt(self.topback, self.top+r+1.5*t, self.speaker, -180)
|
||||
self.polyline(self.topback+t, (90, r), self.top+2*t, (90, r), 100-2*r, (-90, r), self.monitor_height-2*r-d_30, (-30, r))
|
||||
self.fingerHolesAt(-d_30+t, r+.5*t, self.keyboard_depth, 0)
|
||||
self.fingerHolesAt(-d_30+0.5*t, r+t, self.keyback, 90)
|
||||
self.fingerHolesAt(self.keyboard_depth-d_30+1.5*t, r+t, self.front, 90)
|
||||
self.polyline(self.keyboard_depth-d_30+2*t, (90, r), self.front+t, (75, r))
|
||||
|
||||
self.move(tw, th, move)
|
||||
|
||||
def keyboard(self):
|
||||
# Add holes for the joystick and buttons here
|
||||
|
@ -62,19 +76,25 @@ class Arcade(Boxes):
|
|||
self.hole(self.width*3/4., 50, 40)
|
||||
|
||||
def render(self):
|
||||
y, h = self.y, self.h = 540, 450
|
||||
width = self.width
|
||||
t = self.thickness
|
||||
|
||||
self.bottom = y-40-0.5*t
|
||||
self.back = 40
|
||||
self.backwall = h-40
|
||||
self.front = 120
|
||||
self.keyb = 150
|
||||
self.keyback = 50
|
||||
self.speaker = 150
|
||||
self.top = 100-t
|
||||
self.topback = 200-0.5*t
|
||||
self.top = 100
|
||||
self.topback = 200
|
||||
y, h = self.y, self.h = 540, 450
|
||||
y = self.y = ((self.topback+self.top+3*t-100+self.monitor_height) / 2**0.5
|
||||
+ (self.keyboard_depth+2*t)*math.cos(math.radians(15))
|
||||
- (self.front+t) * math.sin(math.radians(15)))
|
||||
h = self.h = ((self.monitor_height-self.topback+self.top+1*t+100) / 2**0.5 +
|
||||
+ (self.keyboard_depth+2*t)*math.sin(math.radians(15))
|
||||
+ (self.front+t) * math.cos(math.radians(15)))
|
||||
|
||||
self.bottom = y-40-0.5*t
|
||||
self.backwall = h-40
|
||||
|
||||
# Floor
|
||||
self.rectangularWall(width, self.bottom, "efff", move="up")
|
||||
|
@ -85,7 +105,7 @@ class Arcade(Boxes):
|
|||
|
||||
# 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.keyboard_depth, "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")
|
||||
|
|
Loading…
Reference in New Issue