*** empty log message ***
This commit is contained in:
@@ -106,7 +106,38 @@ namespace OpenArena
|
||||
}
|
||||
}
|
||||
#endif
|
||||
//Most of this is sorta right for linux I think but since I don't know how yet it's currently windows only
|
||||
#ifdef __APPLE__
|
||||
static double currentRotX = 0.0f;
|
||||
Vec2i pos;
|
||||
Vec2i middle;
|
||||
double angleZ;
|
||||
|
||||
middle.x = window.GetWidth()/2;
|
||||
middle.y = window.GetHeight()/2;
|
||||
pos = window.GetMousePosition();
|
||||
if(pos != middle)
|
||||
{
|
||||
window.SetMousePosition(middle);
|
||||
angleZ = (middle.y - pos.y)/1000.0;
|
||||
currentRotX-=angleZ;
|
||||
if(currentRotX >1.0)
|
||||
{
|
||||
currentRotX = 1.0;
|
||||
}
|
||||
else if(currentRotX < -1.0)
|
||||
{
|
||||
currentRotX = -1.0;
|
||||
}
|
||||
else
|
||||
{
|
||||
Vec3d axis = (m_vView - m_vPosition).cross(m_vUpVector);
|
||||
axis.normalize();
|
||||
RotateView(angleZ, axis.x, axis.y, axis.z);
|
||||
RotateView((middle.x-pos.x)/1000.0, 0, 1, 0);
|
||||
//RotateView((middle.x-pos.x)/1000.0, m_vUpVector.x, m_vUpVector.y, m_vUpVector.z);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#ifdef WIN32
|
||||
static double currentRotX = 0.0f;
|
||||
POINT mpos;
|
||||
@@ -229,6 +260,29 @@ namespace OpenArena
|
||||
{
|
||||
return m_vView;
|
||||
}
|
||||
|
||||
void Camera::RotateHorizontal(float angle)
|
||||
{
|
||||
RotateView(angle, GetUpVector());
|
||||
}
|
||||
|
||||
void Camera::RotateVertical(float angle)
|
||||
{
|
||||
RotateView(angle, GetRightVector());
|
||||
}
|
||||
|
||||
Vec3f Camera::GetUpVector()
|
||||
{
|
||||
}
|
||||
|
||||
Vec3f Camera::GetRightVector()
|
||||
{
|
||||
}
|
||||
|
||||
Vec3f Camera::GetForwardVector()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
@@ -222,6 +222,7 @@ int main(int argc, char** argv)
|
||||
{
|
||||
if(level.mlook)
|
||||
{
|
||||
//get the mouse delta and rotate the camera accordingly
|
||||
level.defaultPlayer[0].camera.SetViewByMouse(g_Screen);
|
||||
}
|
||||
else
|
||||
|
||||
@@ -31,6 +31,7 @@
|
||||
//include necessary header files
|
||||
#include "main.h"
|
||||
#include "version.h"
|
||||
#include "vector.h"
|
||||
|
||||
//link necessary libraries
|
||||
#pragma comment(lib, "opengl32.lib")
|
||||
@@ -287,11 +288,24 @@ int WINAPI WinMain( HINSTANCE hInstance,
|
||||
{
|
||||
if (level.mlook)
|
||||
{
|
||||
level.defaultPlayer[0].camera.SetViewByMouse(g_Screen);
|
||||
using OpenArena::Vec2i;
|
||||
//Get the mouse delta and rotate accordingly
|
||||
|
||||
Vec2i mousePosition = g_Screen.GetMousePosition();
|
||||
Vec2i middleOfScreen = Vec2i(g_Screen.GetWidth()/2, g_Screen.GetHeight()/2);
|
||||
Vec2i mouseDelta = mousePosition - middleOfScreen;
|
||||
const float MOUSE_SENSATIVITY_HORIZONTAL = 1;
|
||||
const float MOUSE_SENSATIVITY_VERTICAL = 1;
|
||||
float horizontalAngle = mouseDelta.x * MOUSE_SENSATIVITY_HORIZONTAL;
|
||||
float verticalAngle = mouseDelta.y * MOUSE_SENSATIVITY_VERTICAL;
|
||||
level.defaultPlayer[0].camera.RotateHorizontal(horizontalAngle);
|
||||
level.defaultPlayer[0].camera.RotateVertical(verticalAngle);
|
||||
//level.defaultPlayer[0].camera.SetViewByMouse(g_Screen);
|
||||
}
|
||||
else
|
||||
{
|
||||
SetCursorPos(g_Screen.GetWidth()/2, g_Screen.GetHeight()/2);
|
||||
g_Screen.SetMousePosition(Vec2i(g_Screen.GetWidth()/2, g_Screen.GetHeight()/2));
|
||||
//SetCursorPos(g_Screen.GetWidth()/2, g_Screen.GetHeight()/2);
|
||||
}
|
||||
|
||||
//////////
|
||||
|
||||
Reference in New Issue
Block a user