⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 window_updateinput.cpp

📁 游戏中我们经常看到的影子效果
💻 CPP
字号:
//////////////////////////////////////////////////////////////////////////////////////////
//	WINDOW_UpdateInput.cpp
//	Update the input per frame
//	Downloaded from: www.paulsprojects.net
//	Created:	13th November 2002
//
//	Copyright (c) 2006, Paul Baker
//	Distributed under the New BSD Licence. (See accompanying file License.txt or copy at
//	http://www.paulsprojects.net/NewBSDLicense.txt)
//////////////////////////////////////////////////////////////////////////////////////////	
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <D3DX8.h>
#include "../Log/LOG.h"
#include "WINDOW.h"

void WINDOW::UpdateInput()
{
	//Mouse buttons are flagged as pressed by windows messages, so they are
	//only caught when the mouse is in the window.
	//See if any have been released
	if(mouseLDown && !GetAsyncKeyState(VK_LBUTTON))
		mouseLDown=false;

	if(mouseRDown && !GetAsyncKeyState(VK_RBUTTON))
		mouseRDown=false;

	//Update the mouse position
	static POINT mousePosition;
	GetCursorPos(&mousePosition);

	//save last position
	oldMouseX=mouseX;
	oldMouseY=mouseY;

	mouseX=mousePosition.x;
	mouseY=mousePosition.y;
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -