Skip to content

Commit 3c269ca

Browse files
committed
0.6.0
1 parent 519859d commit 3c269ca

File tree

17 files changed

+1428
-387
lines changed

17 files changed

+1428
-387
lines changed

build.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ var steps = [
154154
console.log(stepInfo, 'Installing node_modules...');
155155
// install node_modules in dist
156156
await new Promise((resolve, reject) => {
157-
const child = exec('npm install --production', { cwd: path.join(__dirname, 'dist') });
157+
const child = exec('npm install --omit=dev', { cwd: path.join(__dirname, 'dist') });
158158
child.stdout.on('data', (data) => {
159159
console.log(indentLines(data.toString(), 4));
160160
});

client/assets/textures/basic_car.png

5.23 KB
Loading

client/assets/textures/tools/axle.png

5.6 KB
Loading

client/assets/textures/tools/bolt.png

7.04 KB
Loading

client/index.css

+146-5
Original file line numberDiff line numberDiff line change
@@ -365,9 +365,33 @@ details summary {
365365
color: #ffffff50;
366366
font-family: "Urbanist", sans-serif;
367367
font-size: 1em;
368-
padding: 0 0.7em;
368+
padding: 0;
369369
z-index: 100;
370-
border-radius: 1rem;
370+
border-radius: 0.8rem;
371+
-webkit-backface-visibility: hidden;
372+
-webkit-perspective: 1000;
373+
-webkit-transform: translate3d(0, 0, 0);
374+
-webkit-transform: translateZ(0);
375+
backface-visibility: hidden;
376+
perspective: 1000;
377+
transform: translate3d(0, 0, 0);
378+
transform: translateZ(0);
379+
backdrop-filter: blur(35px);
380+
display: none;
381+
position: absolute;
382+
user-select: none;
383+
min-width: 8rem;
384+
margin-top: 0.7rem;
385+
}
386+
387+
.object-options-menu {
388+
background: #03081dc0;
389+
color: #ffffff50;
390+
font-family: "Urbanist", sans-serif;
391+
font-size: 1em;
392+
padding: 0;
393+
z-index: 100;
394+
border-radius: 0.8rem;
371395
-webkit-backface-visibility: hidden;
372396
-webkit-perspective: 1000;
373397
-webkit-transform: translate3d(0, 0, 0);
@@ -377,12 +401,17 @@ details summary {
377401
transform: translate3d(0, 0, 0);
378402
transform: translateZ(0);
379403
backdrop-filter: blur(35px);
380-
top: 2rem;
381-
left: 0;
382404
display: none;
383405
position: absolute;
384406
user-select: none;
385-
width: 8rem;
407+
min-width: 8rem;
408+
margin-left: 0.3rem;
409+
margin-top: 0.3rem;
410+
flex-direction: column;
411+
}
412+
413+
.object-options-menu .button {
414+
padding: 0.2em 0.5rem;
386415
}
387416

388417
.file-menu-content ul {
@@ -394,6 +423,16 @@ details summary {
394423
.file-menu-content li {
395424
padding: 0.2rem 1rem;
396425
margin: 0;
426+
display: flex;
427+
align-items: center;
428+
justify-content: flex-start;
429+
}
430+
431+
.file-menu-content li svg {
432+
width: 1.2rem;
433+
height: 1.2rem;
434+
fill: #fff;
435+
margin-right: 0.5rem;
397436
}
398437

399438
.button {
@@ -453,6 +492,8 @@ details summary {
453492
fill: #e0ddff40;
454493
}
455494

495+
496+
456497
.toolbar img {
457498
width: 100%;
458499
height: 100%;
@@ -829,15 +870,39 @@ details summary {
829870
flex-shrink: 0;
830871
transition: background 0.1s ease-in-out;
831872
display: flex;
873+
flex-direction: column;
832874
justify-content: center;
833875
align-items: center;
834876
user-select: none;
877+
position: relative;
878+
}
879+
880+
.object .options {
881+
position: absolute;
882+
top: 0.2rem;
883+
right: 0;
884+
width: 1.2rem;
885+
height: 1.2rem;
886+
}
887+
888+
889+
890+
.object .options svg {
891+
fill: #ffffff00;
835892
}
836893

837894
.object:hover {
838895
background: #ffffff30;
839896
}
840897

898+
.object:hover .options svg {
899+
fill: #ffffff80;
900+
}
901+
902+
.object:hover .options svg:hover {
903+
fill: #ffffff;
904+
}
905+
841906
.object img {
842907
width: 70%;
843908
height: 70%;
@@ -880,4 +945,80 @@ details summary {
880945
.object-grid-bar span {
881946
margin: 0.5rem 0;
882947
color: #ffffffff;
948+
}
949+
950+
.toolbar.save-list {
951+
height: auto;
952+
display: flex;
953+
/* make it rows */
954+
flex-direction: column;
955+
/* align left */
956+
justify-content: flex-start;
957+
align-items: flex-start;
958+
border-radius: 1rem;
959+
user-select: none;
960+
position: fixed;
961+
top: 3rem;
962+
left: 0.5rem;
963+
bottom: auto;
964+
min-width: 30rem;
965+
}
966+
967+
968+
969+
.save-list .top-bar {
970+
display: flex;
971+
flex-direction: row;
972+
justify-content: space-between;
973+
align-items: center;
974+
width: 100%;
975+
}
976+
977+
.save-list .top-bar .close svg {
978+
width: 1.5rem;
979+
height: 1.5rem;
980+
}
981+
982+
.save-list .top-bar .close:hover svg {
983+
fill: #ffffff;
984+
}
985+
986+
.save-list .top-bar .close:active svg {
987+
fill: #ffffff20;
988+
}
989+
990+
.save-grid .scene {
991+
width: 100%;
992+
padding: 0.5rem;
993+
}
994+
995+
.save-grid {
996+
width: 100%;
997+
max-height: 20rem;
998+
overflow-y: auto;
999+
margin-bottom: 0.5rem;
1000+
}
1001+
1002+
.save-grid .top-text {
1003+
width: 100%;
1004+
display: block;
1005+
}
1006+
1007+
.save-list .top-bar .close {
1008+
margin-top: 0.5rem;
1009+
}
1010+
1011+
.save-list span {
1012+
margin: 0.5rem 0;
1013+
color: #ffffffff;
1014+
}
1015+
1016+
.toolbar .tool.ready svg {
1017+
transform: scale(1.1);
1018+
fill: #e0ddff50;
1019+
}
1020+
1021+
.toolbar .tool.drop svg {
1022+
transform: scale(1.3);
1023+
fill: #ffffff;
8831024
}

client/index.html

+34-17
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@
4545
<div class="version-info" id="version-info">Simulo Alpha</div>
4646
<div id="pause-overlay">
4747
<svg data-src="icons/pause.svg"></svg>
48-
Note: the select/move tool and the drag tool are currently unstable when paused!
4948
</div>
5049
<div class="popup-container">
5150
<div class="starting-popup">
@@ -55,7 +54,7 @@ <h3>Welcome back</h3>
5554
</div>
5655
<h4>Reminder:</h4>
5756
<ul>
58-
<li>This Alpha version is not stable enough to build anything serious with, treat it only as a demo of the
57+
<li>This Alpha version is not stable enough to build anything serious with, treat it mostly as a demo of the
5958
Simulo
6059
game
6160
engine.</li>
@@ -71,6 +70,9 @@ <h4>Reminder:</h4>
7170
</li>
7271
<li>Use number keys (<kbd>1</kbd>, <kbd>2</kbd>, <kbd>3</kbd>) to switch between
7372
toolbars. If a toolbar is disabled, you won't be able to open it.</li>
73+
<li>You can save objects by dragging them to the Objects tab of the toolbar. You can also copy-paste objects
74+
with
75+
CTRL+C and CTRL+V after selecting them with the Move Tool.</li>
7476
</ul>
7577
<h4>Pick a theme!</h4>
7678
<div class="themes"></div>
@@ -184,7 +186,7 @@ <h4>Pick a theme!</h4>
184186
<div class="tool" data-tool="addAxle">
185187
<svg data-src="icons/axle.svg"></svg>
186188
</div>
187-
<div class="tool" data-tool="addFixedJoint">
189+
<div class="tool" data-tool="addBolt">
188190
<svg data-src="icons/bolt.svg"></svg>
189191
</div>
190192
</div>
@@ -209,25 +211,40 @@ <h4>Pick a theme!</h4>
209211
</div>
210212
</div>
211213

212-
<div class="toolbar file">
213-
<div class="file-menu" data-file="file">File<div class="file-menu-content" id="file">
214-
<ul>
215-
<li class="button">Joe</li>
216-
<li class="button">Joe</li>
217-
</ul>
218-
</div>
219-
</div>
220-
<div class="file-menu" data-file="settings">Settings<div class="file-menu-content" id="settings">
221-
<ul>
222-
<li class="button">Joe</li>
223-
<li class="button">Joe</li>
224-
</ul>
214+
<div class="toolbar save-list" id="save-list" style="display: none;">
215+
<div class="top-bar"><span>Scenes</span>
216+
<div class="close" onclick="closeSaveList()">
217+
<svg data-src="icons/close.svg"></svg>
225218
</div>
226219
</div>
220+
<div class="save-grid"></div>
221+
<script>
222+
let saveList = document.getElementById("save-list");
223+
function closeSaveList() {
224+
saveList.style.display = "none";
225+
}
226+
</script>
227227
</div>
228228

229+
<div class="toolbar file">
230+
<div class="file-menu" data-file="file">File</div>
231+
<div class="file-menu" data-file="settings">Settings</div>
232+
</div>
229233

230-
234+
<div class="file-menu-content" id="file">
235+
<ul>
236+
<li class="button" data-file="new-scene"><svg data-src="icons/plus-box.svg"></svg>New scene</li>
237+
<li class="button" data-file="save-scene"><svg data-src="icons/content-save.svg"></svg>Save scene</li>
238+
<li class="button" data-file="load-scene"><svg data-src="icons/folder.svg"></svg>Load scene</li>
239+
<li class="button" data-file="import"><svg data-src="icons/upload.svg"></svg>Import</li>
240+
<li class="button" data-file="export-scene"><svg data-src="icons/download.svg"></svg>Export scene</li>
241+
</ul>
242+
</div>
243+
<div class="file-menu-content" id="settings">
244+
<ul>
245+
<li class="button">Coming soon!</li>
246+
</ul>
247+
</div>
231248

232249

233250
<div class="chat" style="display: none;">

client/src/SimuloClientController/index.ts

+437-79
Large diffs are not rendered by default.

client/src/SimuloViewer/index.ts

+6-4
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ class SimuloViewer {
6363
ctx: CanvasRenderingContext2D;
6464
/** The canvas that the viewer is drawing to. You can update this along with `ctx` to change the canvas mid-run. */
6565
canvas: HTMLCanvasElement;
66-
cameraOffset: { x: number, y: number };
66+
cameraOffset: { x: number, y: number } = { x: 0, y: 0 };
6767
cameraZoom = 30;
6868
private lastX: number;
6969
private lastY: number;
@@ -159,6 +159,10 @@ class SimuloViewer {
159159
}
160160
private lastTouchX = 0;
161161
private lastTouchY = 0;
162+
resetCamera() {
163+
this.cameraOffset = { x: window.innerWidth / 2, y: (window.innerHeight / 2) - 700 }; // start at center, offset by 700. can be changed later by controller
164+
this.cameraZoom = 30;
165+
}
162166
constructor(canvas: HTMLCanvasElement) {
163167
console.log("SimuloViewer constructor");
164168
this.canvas = canvas;
@@ -173,9 +177,7 @@ class SimuloViewer {
173177
if (this.canvas.tabIndex == -1) {
174178
this.canvas.tabIndex = 1;
175179
}
176-
var windowEnd = this.transformPoint(window.innerWidth, window.innerHeight);
177-
this.cameraOffset = { x: windowEnd.x / 2, y: (windowEnd.y / 2) - 700 }; // start at center, offset by 700. can be changed later by controller
178-
180+
this.resetCamera();
179181
this.lastX = window.innerWidth / 2;
180182
this.lastY = window.innerHeight / 2;
181183
this.lastMouseX = this.lastX;

media/imulo.png

63.9 KB
Loading

0 commit comments

Comments
 (0)