Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » Community » Newbie corner » How to monitor key release event?
Re: How to monitor key release event? [message #43052 is a reply to message #43051] Sun, 27 April 2014 15:33 Go to previous messageGo to previous message
Klugier is currently offline  Klugier
Messages: 1076
Registered: September 2012
Location: Poland, Kraków
Senior Contributor
Hello Honza,

I have solved this problem. Thanks for tip Honza!

This is my code:
bool GameCtrl::Key(dword key, int count)
{
	if (key == K_RIGHT) {
		moveRight = true;
		return true;
	}
	else if (key == K_LEFT) {
		 moveLeft = true;
		return true;
	}
 	else if (key == K_SPACE) {
		jump = true;
		return true;
	}
	
	if (key & K_KEYUP) {
		dword keyUp = (key & ~K_KEYUP);
		
		if (keyUp == K_RIGHT) {
			moveRight = false;
			return true;
		}
		else if (keyUp == K_LEFT) {
			moveLeft = false;
			return true;
		}
		else if (keyUp == K_SPACE) {
			jump = false;
			return true;
		}
	}

	return false;
}


BTW, I think that U++ should offer following method "Ctrl::KeyUp(dword key, int count)". This will facilitate a few things...

Sincerely,
Klugier


U++ - one framework to rule them all.
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Assist++ for STL
Next Topic: How does one create core and ctrllib as a dll?
Goto Forum:
  


Current Time: Thu May 09 15:32:46 CEST 2024

Total time taken to generate the page: 0.02121 seconds