
separate( cube )


procedure getMouseInputs( mainWin : access GLFWwindow; Wwid,Whit: gldouble ) is
	use interfaces.c;
	use type interfaces.c.double;

	xpos,ypos : aliased gldouble;
	msl,msr : glint;

	currentTime, dt: gldouble;

begin

	glfwgetcursorpos(mainWin,xpos'access,ypos'access);
	msr := glfwGetMouseButton(mainWin, glfw_mouse_button_2); -- ?3?
	msl := glfwGetMouseButton(mainWin, glfw_mouse_button_1);


	if msl=glfw_press then
		if dragging then
			roty:=0.2*float(xpos-xold);
			rotx:=0.2*float(ypos-yold);
			xold:=xpos;
			yold:=ypos;
		else --not dragging yet
			dragging:=true;
			xold:=xpos;
			yold:=ypos;
		end if;

	elsif msl=glfw_release then
		dragging:=false;
	end if;


	currentTime:=glfwGetTime;
	dt := currentTime-oldTimeMs;
	if (msr=glfw_press) and (dt>btndlay) then
		oldTimeMs:=currentTime;

		clickRight(xpos,ypos,Wwid,Whit);


	elsif msr=glfw_release then
		null;

	end if;

end getMouseInputs;


