Click here to Skip to main content
16,013,918 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionParallel Port Programming Q Pin
kmaster15-Mar-06 14:38
kmaster15-Mar-06 14:38 
AnswerRe: Parallel Port Programming Q Pin
normanS15-Mar-06 18:23
normanS15-Mar-06 18:23 
QuestionRe: Parallel Port Programming Q Pin
kmaster16-Mar-06 4:29
kmaster16-Mar-06 4:29 
AnswerRe: Parallel Port Programming Q Pin
Gordon Brandly16-Mar-06 7:56
Gordon Brandly16-Mar-06 7:56 
GeneralRe: Parallel Port Programming Q Pin
normanS16-Mar-06 18:11
normanS16-Mar-06 18:11 
Questionsplit buffer Pin
beardy janggut15-Mar-06 14:05
beardy janggut15-Mar-06 14:05 
AnswerRe: split buffer Pin
normanS15-Mar-06 18:37
normanS15-Mar-06 18:37 
QuestionWalking engine doesn't work! Pin
Lord Kixdemp15-Mar-06 13:17
Lord Kixdemp15-Mar-06 13:17 
Hello everyone! Big Grin | :-D
Alright... I'm following the instructions from this site:

http://gpwiki.org/index.php/SDL:Tutorials:Practical_Keyboard_Input[^]

Here's my code:

// Render stuff<br />
		render();<br />
<br />
		// Poll for events, and handle the ones we care about.<br />
		SDL_Event event;<br />
		while (SDL_PollEvent(&event))<br />
		{<br />
			switch (event.type)<br />
			{<br />
			case SDL_KEYDOWN:<br />
				switch (event.key.keysym.sym)<br />
				{<br />
				case SDLK_UP:<br />
					//yPos -= CSIZE;<br />
					yVel = -CSIZE;<br />
					break;<br />
				case SDLK_DOWN:<br />
					//yPos += CSIZE;<br />
					yVel = CSIZE;<br />
					break;<br />
				case SDLK_LEFT:<br />
					//xPos -= CSIZE;<br />
					xVel = -CSIZE;<br />
					break;<br />
				case SDLK_RIGHT:<br />
					//xPos += CSIZE;<br />
					xVel = CSIZE;<br />
					break;<br />
				}<br />
				break;<br />
			case SDL_KEYUP:<br />
				switch (event.key.keysym.sym)<br />
				{<br />
				case (SDLK_ESCAPE):<br />
				case SDL_QUIT:<br />
					return 0;<br />
					break;<br />
				case (SDLK_UP):<br />
					yVel = 0;<br />
					break;<br />
				case (SDLK_DOWN):<br />
					yVel = 0;<br />
					break;<br />
				case (SDLK_LEFT):<br />
					xVel = 0;<br />
					break;<br />
				case (SDLK_RIGHT):<br />
					xVel = 0;<br />
					break;<br />
				}<br />
				break;<br />
			}<br />
<br />
			int temp_x = xPos + xVel;<br />
			int temp_y = yPos + yVel;<br />
<br />
			// Make sure the character didn't go off screen bounds<br />
			if ((temp_x > -1) && (temp_x < WIDTH))	xPos += xVel;<br />
			if ((temp_y > -1) && (temp_y < HEIGHT))	yPos += yVel;


I can't find the problem! The dude only moves 1 spot even if I keep the arrow pressed... Anyone know? Thanks! Wink | ;-)

BTW: I'm on Linux! Laugh | :laugh:

Lord Kixdemp
www.SulfurMidis.com
www.SulfurSoft.tk
[ftp://][http://][hotline://]tsfc.ath.cx

-- modified at 19:25 Wednesday 15th March, 2006
QuestionTools to Measure Run Time Pin
jerry1211a15-Mar-06 12:51
jerry1211a15-Mar-06 12:51 
AnswerRe: Tools to Measure Run Time Pin
Naveen15-Mar-06 16:48
Naveen15-Mar-06 16:48 
Questiontime and date matters: VC 7(VC++.NET) Pin
luhfluh15-Mar-06 12:19
luhfluh15-Mar-06 12:19 
AnswerRe: time and date matters: VC 7(VC++.NET) Pin
Michael Dunn15-Mar-06 13:41
sitebuilderMichael Dunn15-Mar-06 13:41 
AnswerRe: time and date matters: VC 7(VC++.NET) Pin
Chris Losinger15-Mar-06 13:48
professionalChris Losinger15-Mar-06 13:48 
AnswerRe: time and date matters: VC 7(VC++.NET) Pin
Nibu babu thomas15-Mar-06 16:46
Nibu babu thomas15-Mar-06 16:46 
GeneralRe: time and date matters: VC 7(VC++.NET) Pin
Stephen Hewitt15-Mar-06 16:53
Stephen Hewitt15-Mar-06 16:53 
GeneralRe: time and date matters: VC 7(VC++.NET) Pin
luhfluh16-Mar-06 6:50
luhfluh16-Mar-06 6:50 
NewsTHANKS!! Re: time and date matters: VC 7(VC++.NET) Pin
luhfluh15-Mar-06 17:20
luhfluh15-Mar-06 17:20 
Questionhow to compare pick-up a word from a string Pin
mrby12315-Mar-06 10:44
mrby12315-Mar-06 10:44 
AnswerRe: how to compare pick-up a word from a string Pin
George L. Jackson15-Mar-06 12:17
George L. Jackson15-Mar-06 12:17 
GeneralRe: how to compare pick-up a word from a string Pin
mrby12315-Mar-06 12:28
mrby12315-Mar-06 12:28 
GeneralRe: how to compare pick-up a word from a string Pin
Stephen Hewitt15-Mar-06 12:51
Stephen Hewitt15-Mar-06 12:51 
GeneralRe: how to compare pick-up a word from a string Pin
George L. Jackson15-Mar-06 17:37
George L. Jackson15-Mar-06 17:37 
Questionerror LNK2019 when using DLL Pin
yongwpi15-Mar-06 10:29
yongwpi15-Mar-06 10:29 
AnswerRe: error LNK2019 when using DLL Pin
Saurabh.Garg15-Mar-06 12:49
Saurabh.Garg15-Mar-06 12:49 
AnswerRe: error LNK2019 when using DLL Pin
superSYNC15-Mar-06 15:18
superSYNC15-Mar-06 15:18 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.