-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
114 lines (89 loc) · 2.77 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
<html>
<head>
<title>Istruzioni di gioco 1</title>
<meta http-equiv="refresh" content="8;URL=src/Istruzioni.html">
<style>
body {
font-family: Monospace;
background-color: #71b2cf;
margin: 0px;
overflow: hidden;
}
canvas {
width: 100%;
height: 100%;
}
</style>
<script src="lib/three.min.js"></script>
<script src="lib/stats.min.js"></script>
<script src="lib/Coordinates.js"></script>
</head>
<body>
<script>
// VARIABILI PER LA CREAZIONE DELLA SCENA
var scene, camera, renderer, controls, stats;
function Start() {
scene = new THREE.Scene();
camera = new THREE.PerspectiveCamera( 75, window.innerWidth / window.innerHeight, 0.1, 400 );
renderer = new THREE.WebGLRenderer( {antialias: true} );
renderer.setSize( window.innerWidth, window.innerHeight );
renderer.setClearColor( 0x71b2cf );
renderer.setPixelRatio( window.devicePixelRatio );
renderer.gammaInput = true;
renderer.gammaOutput = true;
renderer.shadowMap.enabled = true;
document.body.appendChild( renderer.domElement );
camera.position.set(0,0,12);
camera.lookAt( new THREE.Vector3(0,0,0));
// stats
stats = new Stats();
stats.domElement.style.position = 'absolute';
stats.domElement.style.top = '0px';
document.body.appendChild( stats.domElement );
inserisciLuceEmisferica();
// TESTO
stampaTesto("Usa le frecce per muoverti", 2, 0.4, -17, 11, -15 );
// Sinistra
stampaTesto("<--", 3, 0.5, -29, 1, -15 );
stampaTesto("(tasto A)", 2, 0.4, -30, -2, -15 );
// Destra
stampaTesto("-->", 3, 0.5, 25, 1, -15 );
stampaTesto("(tasto D)", 2, 0.4, 21, -2, -15 );
stampaTesto("Metti in pausa la partita con il tasto P", 2, 0.4, -23, -13, -15 );
} // Start()
function stampaTesto(testo, dimensione, altezza, x, y, z){
var fontLoader = new THREE.FontLoader();
fontLoader.load('font/helvetiker_bold.typeface.json', function(font) {
var geometriaTesto = new THREE.TextGeometry(testo, {
font: font,
size: dimensione,
height: altezza,
curveSegments: 10
});
geometriaTesto.computeBoundingBox();
var materialeTesto = new THREE.MeshPhongMaterial( {color: "red"} );
var testoFinale = new THREE.Mesh(geometriaTesto, materialeTesto);
testoFinale.position.set(x, y, z);
scene.add(testoFinale);
});
}
function inserisciLuceEmisferica(){
hemiLight = new THREE.HemisphereLight( 0xffffff, 0x0033ff, 0.8 );
hemiLight.color.setHSL( 0.6, 1, 0.6 );
hemiLight.position.set( 0, 500, 0 );
scene.add( hemiLight );
}
// UPDATE E CICLO DI RENDER
function Update() {
requestAnimationFrame( Update );
stats.update();
Render();
}
function Render() {
renderer.render(scene, camera);
}
Start();
Update();
</script>
</body>
</html>