I typed some code into Notepad upon seeing Chili's tutorial (part 4). It goes as follows:
Code: Select all
void Game::ComposeFrame()
{
int x;
int y;
int x2;
int y2;
x = 400;
y = 300;
if( kbd.RightIsPressed() )
{
x2 = x + 100;
}
if( kbd.LeftIsPressed() )
{
x2 = x - 100;
}
if( kbd.UpIsPressed() )
{
y2 = y + 100;
}
if( kbd.DownIsPressed() )
{
y2 = y - 100;
}
gfx.PutPixel( x2, y2, 233, 233, 233);
}
And now the program refuses to run. I broke, exited and restarted C++, replaced my pertinent code with:Unhandled exception at 0x013313d4 in Chili DirectX Framework.exe: 0xC0000005: Access violation writing location 0xb89f23f0.
Code: Select all
void Game::ComposeFrame()
{
int x;
int y;
x = 300;
y = 300;
gfx.PutPixel( x, y, 233, 233, 233);
}
Code: Select all
void Game::ComposeFrame()
{
int x;
int y;
x = 300;
y = 300;
gfx.PutPixel( x, y, 233, 233, 233);
}
Code: Select all
MSG msg;
ZeroMemory( &msg,sizeof( msg ) );
while( msg.message != WM_QUIT )
{
if( PeekMessage( &msg,NULL,0,0,PM_REMOVE ) )
{
TranslateMessage( &msg );
DispatchMessage( &msg );
}
else
{
theGame.Go();
}
}
UnregisterClass( L"Chili DirectX Framework Window",wc.hInstance );
return 0;