Added messed up low performance camera rotation

This commit is contained in:
2019-12-08 18:47:16 +02:00
parent f5d3196828
commit 2f5437396c
8 changed files with 189 additions and 103 deletions
+30 -3
View File
@@ -3,15 +3,18 @@
#include "renderer.h"
#include "ctime"
const int width = 800;
const int height = 800;
const int screen_width = 1000;
const int screen_height = 1000;
int prev_mouse_x = 0;
int prev_mouse_y = 0;
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
{
HWND hwnd;
MSG Msg;
hwnd = create_window(width, height, hInstance);
hwnd = create_window(hInstance);
ShowWindow(hwnd, nCmdShow);
char debug_str[100];
@@ -36,6 +39,30 @@ LRESULT CALLBACK WndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
switch (message)
{
case WM_MOUSEMOVE:
int xPos, yPos;
xPos = LOWORD(lParam);
yPos = HIWORD(lParam);
if (xPos == prev_mouse_x)
break;
else if (xPos > prev_mouse_x)
move_camera_right();
else
move_camera_left();
prev_mouse_x = xPos;
if (yPos == prev_mouse_y)
break;
else if (yPos > prev_mouse_y)
move_camera_up();
else
move_camera_down();
prev_mouse_y = yPos;
render();
Update();
break;
case WM_RBUTTONDOWN:
break;
case WM_LBUTTONDOWN: