Beginner lesson 3 SOS
Posted: June 11th, 2017, 1:37 am
I took a break from c++ and decided to pick it up again now with visual studio 2017 and windows 10.
I'm finding more problems than before, I managed to make it to lesson 3 and all but I can't get wnd.KeyIsPressed( VK_up ) to work when I build the solution I get identifier "wnd" is undefined .
I could really use some help here.
[/******************************************************************************************
* 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()
{
const int x = 400;
const int y = 400;
const bool cond = wnd.kbd.KeyIsPressed( VK_UP );
if(cond)
// x axis y red green blue
gfx.PutPixel( -5 + x, y, 255, 255, 255);
gfx.PutPixel( -4 + x, y, 255, 255, 255);
gfx.PutPixel( -3 + x, y, 255, 255, 255);
gfx.PutPixel( 3 + x, y, 255, 255, 255);
gfx.PutPixel( 4 + x, y, 255, 255, 255);
gfx.PutPixel( 5 + x, y, 255, 255, 255);
gfx.PutPixel( x,-5 + y, 255, 255, 255);
gfx.PutPixel( x,-4 + y, 255, 255, 255);
gfx.PutPixel( x,-3 + y, 255, 255, 255);
gfx.PutPixel( x,3 + y, 255, 255, 255);
gfx.PutPixel( x,4 + y, 255, 255, 255);
gfx.PutPixel( x,5 + y, 255, 255, 255);
}]
[Severity Code Description Project File Line Suppression State
Error (active) E0020 identifier "wnd" is undefined Chili DirectX Framework c:\Users\user\Desktop\Chili DirectX Framework\Assets\Game.cpp 41
]
I'm finding more problems than before, I managed to make it to lesson 3 and all but I can't get wnd.KeyIsPressed( VK_up ) to work when I build the solution I get identifier "wnd" is undefined .
I could really use some help here.
[/******************************************************************************************
* 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()
{
const int x = 400;
const int y = 400;
const bool cond = wnd.kbd.KeyIsPressed( VK_UP );
if(cond)
// x axis y red green blue
gfx.PutPixel( -5 + x, y, 255, 255, 255);
gfx.PutPixel( -4 + x, y, 255, 255, 255);
gfx.PutPixel( -3 + x, y, 255, 255, 255);
gfx.PutPixel( 3 + x, y, 255, 255, 255);
gfx.PutPixel( 4 + x, y, 255, 255, 255);
gfx.PutPixel( 5 + x, y, 255, 255, 255);
gfx.PutPixel( x,-5 + y, 255, 255, 255);
gfx.PutPixel( x,-4 + y, 255, 255, 255);
gfx.PutPixel( x,-3 + y, 255, 255, 255);
gfx.PutPixel( x,3 + y, 255, 255, 255);
gfx.PutPixel( x,4 + y, 255, 255, 255);
gfx.PutPixel( x,5 + y, 255, 255, 255);
}]
[Severity Code Description Project File Line Suppression State
Error (active) E0020 identifier "wnd" is undefined Chili DirectX Framework c:\Users\user\Desktop\Chili DirectX Framework\Assets\Game.cpp 41
]