Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Michael Weber
RTSS_SS21
Commits
0991a0ca
Commit
0991a0ca
authored
Aug 31, 2021
by
Michael Weber
Browse files
Change position of touch buttons
parent
89ddebef
Changes
1
Hide whitespace changes
Inline
Side-by-side
TouchToSound/main.js
View file @
0991a0ca
const
images
=
[];
images
.
push
(
new
ImageSound
(
"
left.png
"
,
"
left.mp3
"
,
15
,
5
));
images
.
push
(
new
ImageSound
(
"
right.png
"
,
"
right.mp3
"
,
15
,
25
));
images
.
push
(
new
ImageSound
(
"
forward.png
"
,
"
forward.mp3
"
,
5
,
15
));
images
.
push
(
new
ImageSound
(
"
backwards.png
"
,
"
backwards.mp3
"
,
25
,
15
));
images
.
push
(
new
ImageSound
(
"
left.png
"
,
"
left.mp3
"
,
15
0
,
5
0
));
images
.
push
(
new
ImageSound
(
"
right.png
"
,
"
right.mp3
"
,
15
0
,
25
0
));
images
.
push
(
new
ImageSound
(
"
forward.png
"
,
"
forward.mp3
"
,
5
0
,
15
0
));
images
.
push
(
new
ImageSound
(
"
backwards.png
"
,
"
backwards.mp3
"
,
25
0
,
15
0
));
images
.
push
(
new
ImageSound
(
"
stop.jpg
"
,
"
stop.mp3
"
,
5
,
40
));
images
.
push
(
new
ImageSound
(
"
jump.png
"
,
"
jump.mp3
"
,
15
,
40
));
images
.
push
(
new
ImageSound
(
"
lookaround.png
"
,
"
look around.mp3
"
,
25
,
40
,
5
,
1
0
));
images
.
push
(
new
ImageSound
(
"
stop.jpg
"
,
"
stop.mp3
"
,
5
0
,
40
0
));
images
.
push
(
new
ImageSound
(
"
jump.png
"
,
"
jump.mp3
"
,
15
0
,
40
0
));
images
.
push
(
new
ImageSound
(
"
lookaround.png
"
,
"
look around.mp3
"
,
25
0
,
400
));
const
touchScreen
=
document
.
getElementById
(
"
touchScreen
"
);
images
.
forEach
(
image
=>
{
...
...
@@ -14,10 +14,10 @@ images.forEach(image => {
const
DOM_img
=
document
.
createElement
(
"
img
"
);
DOM_img
.
src
=
"
images/
"
+
image
.
image
;
DOM_img
.
classList
.
add
(
"
screen__image
"
);
DOM_img
.
style
.
top
=
image
.
top
+
"
%
"
;
DOM_img
.
style
.
left
=
image
.
left
+
"
%
"
;
DOM_img
.
style
.
width
=
image
.
width
+
"
%
"
;
DOM_img
.
style
.
height
=
image
.
height
+
"
%
"
;
DOM_img
.
style
.
top
=
image
.
top
+
"
px
"
;
DOM_img
.
style
.
left
=
image
.
left
+
"
px
"
;
DOM_img
.
style
.
width
=
image
.
width
+
"
px
"
;
DOM_img
.
style
.
height
=
image
.
height
+
"
px
"
;
DOM_img
.
dataset
.
sound
=
image
.
sound
;
DOM_img
.
alt
=
image
.
sound
;
...
...
@@ -40,7 +40,7 @@ function playSound(sound) {
}
}
function
ImageSound
(
image
,
sound
,
top
,
left
,
width
=
5
,
height
=
10
)
{
function
ImageSound
(
image
,
sound
,
top
,
left
,
width
=
5
0
,
height
=
10
0
)
{
this
.
image
=
image
;
this
.
sound
=
sound
;
this
.
top
=
top
;
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment