Ver Código Fonte

look around with mouse.

not finished, doesn't really allow you to turn around, should probably
use two degrees of rotation. needs some research before i can implement
it.
Lucas Stadler 12 anos atrás
pai
commit
e6446aa31c
1 arquivos alterados com 15 adições e 0 exclusões
  1. 15 0
      js/pixl/public/trixl.html

+ 15 - 0
js/pixl/public/trixl.html

224
			trixl.input.keys.delete(ev.keyCode);
224
			trixl.input.keys.delete(ev.keyCode);
225
		});
225
		});
226
226
227
		trixl.input.mouse = {last: null};
228
		trixl.stage.addEventListener("mousemove",  function(ev) {
229
			var mouse = trixl.input.mouse;
230
231
			if (mouse.last === null) {
232
				mouse.last = {x: ev.clientX, y: ev.clientY};
233
			}
234
235
			var diff = { x: mouse.last.x - ev.clientX, y: mouse.last.y - ev.clientY };
236
			trixl.focus.a += diff.x * 0.01;
237
			trixl.focus.y += diff.y * 0.01;
238
239
			mouse.last = {x: ev.clientX, y: ev.clientY};
240
		});
241
227
		window.onresize = function() {
242
		window.onresize = function() {
228
			trixl.window.w = window.innerWidth;
243
			trixl.window.w = window.innerWidth;
229
			trixl.window.h = window.innerHeight;
244
			trixl.window.h = window.innerHeight;