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 );
}