1 // arcade controller thing
2 // Copyright (c) 2017 Clinton Ebadi <clinton@unknownlamer.org>
3 // GPLv3 or (at your option) any later version
4 // .. insert license text here ...
6 use <obiscad/bcube.scad>
7 use <obiscad/attach.scad>
15 rotate ([-10, 0, 0]) translate ([0, 0, box_h+20]) panel ();
25 box_h = 80; // fixme: box_d.
27 base_h = 5; //fixme: thickness?
29 // bcube parameters, clean up
37 hinge_joint_width = 4;
38 hinge_joint_thickness = 5;
39 hinge_base_height = 10;
43 module button (bezel = $button_d+4) {
53 for (x = [-js_width/2, js_width/2], y = [-js_height/2, js_height/2]) {
54 translate ([x, y, 0]) circle (d=bolt_d); // need slot instead
56 circle (d=center_hole_d);
58 %square ([js_width, js_height], center=true); // not right...
64 module case_base (h=base_h) {
65 bcube([panel_w, panel_h, h], cr, cres);
68 module case_walls () {
70 bcube([panel_w, panel_h, box_h-base_h], cr, cres);
71 bcube([panel_w-box_wall, panel_h-box_wall, box_h+1], cr, cres);
73 %connector (case_connector_wall (x=10));
74 attach (case_connector_wall (x=10), hinge_connector_back ()) hinge_female ();
79 translate ([0, 0, box_h/2]) case_walls ();
84 // specify which wall (rear, front, left, right).
85 // offset from center of wall, as vector
86 // optional: inside/outside
87 function case_connector_wall (x=0, y=0, z=0) = [ [panel_w/2-x, panel_h/2-y, (box_h-base_h)/2-z], [0,-1, 0], 0 ];
91 function hinge_connector_back (th=hinge_joint_thickness*2, h=hinge_base_height) = [ [0, th/2, h/2], [0,1, 0], 0 ];
93 module hinge_female () {
94 w = hinge_joint_width * 2;
95 th = hinge_joint_thickness * 2;
96 jt = hinge_joint_thickness;
97 jw = hinge_joint_width;
98 h = hinge_base_height;
100 %connector (hinge_connector_back ());
103 cube ([w, th, h], center=true);
104 joint_male_negative(male_joint_width=jw, male_joint_thickness=jt, forward_rom=90, backward_rom=90, male_joint_height=10);
114 linear_extrude (base_h*2,center=true) panel_layout ();
118 module panel_attach (position, angle=0) {
121 c1 = [ [x, y, base_h/2], [0,0,1], angle ];
122 a1 = [ [0,0, 0], [0,0,0], 0 ];
123 // %connector (c1); // fixme: don't use 2d for layout
124 attach (c1, a1) children ();
127 // panel layout inspired by the Neo Geo layout
128 module panel_layout () {
129 translate ([-panel_w/2 + 40, 0, 0]) {
130 panel_attach ([0, 0], 90) joystick ();
132 // p1, coin (floating off in the distance...)
133 translate ([160, 0, 0]) {
135 for (x = [0, $button_d+10]) {
136 panel_attach ([x, 42]) button ();
141 translate ([60, -20, 0]) {
142 panel_attach ([0, 0]) button ();
143 for (i = [ 1 : 3 ]) {
144 panel_attach ([i*($button_d+10)-10, $button_d]) button ();