Page 1 of 1

Lession 4 "homework" bug / glitch?

Posted: June 21st, 2012, 1:52 pm
by boozfob
Hi chili , im watching your videos and they are awesome :)
but in the 4th u had the homework thing with changing where the crosshair is and the colour i did it without problem but found something i cant explain in any way :3

Look at this code

Code: Select all

/****************************************************************************************** 
 *	Chili DirectX Framework Version 11.12.17											  *	
 *	Game.cpp																			  *
 *	Copyright 2011 PlanetChili.net														  *
 *																						  *
 *	This file is part of The Chili DirectX Framework.									  *
 *																						  *
 *	The Chili DirectX Framework is free software: you can redistribute it and/or modify	  *
 *	it under the terms of the GNU General Public License as published by				  *
 *	the Free Software Foundation, either version 3 of the License, or					  *
 *	(at your option) any later version.													  *
 *																						  *
 *	The Chili DirectX Framework is distributed in the hope that it will be useful,		  *
 *	but WITHOUT ANY WARRANTY; without even the implied warranty of						  *
 *	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the						  *
 *	GNU General Public License for more details.										  *
 *																						  *
 *	You should have received a copy of the GNU General Public License					  *
 *	along with The Chili DirectX Framework.  If not, see <http://www.gnu.org/licenses/>.  *
 ******************************************************************************************/
#include "Game.h"

Game::Game( HWND hWnd,const KeyboardServer& kServer )
:	gfx ( hWnd ),
	kbd( kServer )
{}

void Game::Go()
{
	gfx.BeginFrame();
	ComposeFrame();
	gfx.EndFrame();
}

void Game::ComposeFrame()
{
	int x;
	int y;
	int b;
	
	x = 400;
	y = 300;
	b = 255;
	if( kbd.RightIsPressed() )
	{
		x = 500;
	}
	if( kbd.LeftIsPressed() )
	{
		x = 300;
	}
	if( kbd.DownIsPressed() )
	{
		y = 400;
	}
	if( kbd.UpIsPressed() )
	{
		y = 200;
	}
	
	if( kbd.SpaceIsPressed() )
	{
		b = 0;
	}
	gfx.PutPixel( x,y,255,255,b );
	gfx.PutPixel( -5 + x,y,255,255,b );
	gfx.PutPixel( -4 + x,y,255,255,b );
	gfx.PutPixel( -3 + x,y,255,255,b );
	gfx.PutPixel( 3 + x,y,255,255,b );
	gfx.PutPixel( 2 + x,y,255,255,b );
	gfx.PutPixel( 1 + x,y,255,255,b );
	gfx.PutPixel( x,-5 + y,255,255,b );
	gfx.PutPixel( x,-4 + y,255,255,b );
	gfx.PutPixel( x,-3 + y,255,255,b );
	gfx.PutPixel( x,3 + y,255,255,b );
	gfx.PutPixel( x,2 + y,255,255,b );
	gfx.PutPixel( x,1 + y,255,255,b );


}
If i use that i can move the crosshair in all 9 difrent positions and i can colour it yellow while pressing space.. But when i colour it yellow i cant move it the the left upper corner and if i move it there while white, then nothing happens when i press space.. so while white i can move it in 9 positions and while yellow i can move it in 8 positions, very confusing and thanks in advance :)

Re: Lession 4 "homework" bug / glitch?

Posted: June 21st, 2012, 1:53 pm
by LuX
http://www.microsoft.com/appliedscience ... ained.mspx

Test out the keys and see if it detects all presses.

Re: Lession 4 "homework" bug / glitch?

Posted: June 21st, 2012, 1:59 pm
by boozfob
Hmm but why just left + up + space? :O
then it feels like right + up + space shouldnt work eaither, but it does :3

Re: Lession 4 "homework" bug / glitch?

Posted: June 21st, 2012, 2:00 pm
by LuX
Maybe it changes sometimes. And the order you press the keys does matter.

Re: Lession 4 "homework" bug / glitch?

Posted: June 21st, 2012, 2:10 pm
by chili
I gotta put an annotation on that video....

Re: Lession 4 "homework" bug / glitch?

Posted: June 22nd, 2012, 1:35 am
by XxWalKaxX
post the rest of your code it is probably something simple, when i did it everything worked fine, try starting over with a fresh copy of the framework, its possible that you could have accidentally changed something without realizing it

Re: Lession 4 "homework" bug / glitch?

Posted: June 22nd, 2012, 4:25 pm
by chili
Nah WalKax, like lux says it's probably ghosting.