--
-- PlayerCamera
--
-- M@D Author:  Heady
-- M@D date: 01.01.2010
--
-- > Copyright (C) Heady - www.planet-ls.de < --
--

print("  Loaded: PlayerCamera");

PlayerCamera = {};

function PlayerCamera:loadMap(name)

	self.playerCamYBackup = 0.7;
	self.fovAngleBackup = 60;
	self.fovAngle = 60;
end;

function PlayerCamera:deleteMap()
end;

function PlayerCamera:delete()
end;

function PlayerCamera:mouseEvent(posX, posY, isDown, isUp, button)

	if g_currentMission.controlPlayer then
		if Input.isMouseButtonPressed(Input.MOUSE_BUTTON_RIGHT) then
			self.fovAngle = getFovy(g_currentMission.player.cameraId);
			
			if Input.isMouseButtonPressed(Input.MOUSE_BUTTON_WHEEL_UP) and self.fovAngle > 2 then
				setFovy(g_currentMission.player.cameraId, self.fovAngle-2)
			end;
			if Input.isMouseButtonPressed(Input.MOUSE_BUTTON_WHEEL_DOWN) and self.fovAngle < 178 then		
				setFovy(g_currentMission.player.cameraId, self.fovAngle+2)
			end;	
			if Input.isMouseButtonPressed(Input.MOUSE_BUTTON_MIDDLE) then
				setFovy(g_currentMission.player.cameraId, self.fovAngleBackup)		
			end;			
		else
			if Input.isMouseButtonPressed(Input.MOUSE_BUTTON_WHEEL_UP) and g_currentMission.player.camY > -0.7 then
				g_currentMission.player.camY = g_currentMission.player.camY-0.4;
			end;
			if Input.isMouseButtonPressed(Input.MOUSE_BUTTON_WHEEL_DOWN) then		
				g_currentMission.player.camY = g_currentMission.player.camY+0.4;
			end;		
			if Input.isMouseButtonPressed(Input.MOUSE_BUTTON_MIDDLE) then
				g_currentMission.player.camY = self.playerCamYBackup;			
			end;
		end;
	end;

end;

function PlayerCamera:keyEvent(unicode, sym, modifier, isDown)
end;

function PlayerCamera:update(dt)
end;


function PlayerCamera:draw()
end;

addModEventListener(PlayerCamera);

