a quick question?

The Partridge Family were neither partridges nor a family. Discuss.
Post Reply
dominotheif
Posts: 1
Joined: November 30th, 2012, 1:27 am

a quick question?

Post by dominotheif » November 30th, 2012, 1:36 am

I'm having a problem with the framework. I'm on lesson 7, but i'm getting this error, and IDK how to fix it.

Code: Select all

1>------ Build started: Project: Chili DirectX Framework, Configuration: Release Win32 ------
1>  Game.cpp
1>..\Assets\Game.cpp(30): error C2062: type 'void' unexpected
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
this is my 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 ),
	x( 400 ),
	y( 300 ),
	

void Game::Go()
{

	gfx.BeginFrame();
	ComposeFrame();
	gfx.EndFrame();

}

void Game::ComposeFrame()
{
	int s;
	s = 3; 
	int gb;
	gb = 0;
	int r;
	r = 255;
	


	if( kbd.RightIsPressed() )
	{
		x = x + s;
	}

	if( kbd.LeftIsPressed() )
	{
		x = x - s;
	}
	
	if( kbd.UpIsPressed() )
	{
		y = y - s;
	}
	
	if( kbd.DownIsPressed() )
	{
		y = y + s;
	}

	if( kbd.SpaceIsPressed() )
	{
		s = 1;
	}

	if( kbd.EnterIsPressed() )
	{
		s = 8;
	}

	if( x < 5 )
	{
		x = 5;
	}

	if( x > 794 )
	{
		x = 794;
	}

	if( y < 5 )
	{
		y = 5;
	}

	if( y > 794 )
	{
		y = 794;
	}

	if( x < 50 )
	{
		if( x > 100 )
		{
			if( y < 50 )
			{
				if( y < 100 )
				{
					r = 0;
				}
			}
		}
	}

	if( x < 300 )
	{ 
		if( x > 500 )
		{
			if( y > 200)
			{
				if( y < 400 )
				{
					gb = 0;
				}
			}
		}
	}

	gfx.PutPixel(      x,     y,r,gb,gb );
	gfx.PutPixel( -5 + x,     y,r,gb,gb );
	gfx.PutPixel( -4 + x,     y,r,gb,gb );
	gfx.PutPixel( -3 + x,     y,r,gb,gb );
	gfx.PutPixel(  3 + x,     y,r,gb,gb );
	gfx.PutPixel(  4 + x,     y,r,gb,gb );
	gfx.PutPixel(  5 + x,     y,r,gb,gb );
	gfx.PutPixel(      x,-5 + y,r,gb,gb );
	gfx.PutPixel(      x,-4 + y,r,gb,gb );
	gfx.PutPixel(      x,-3 + y,r,gb,gb );
	gfx.PutPixel(      x, 3 + y,r,gb,gb );
	gfx.PutPixel(      x, 4 + y,r,gb,gb );
	gfx.PutPixel(      x, 5 + y,r,gb,gb );
}

Ferbguy
Posts: 51
Joined: August 29th, 2012, 10:54 pm
Location: Georgia

Re: a quick question?

Post by Ferbguy » November 30th, 2012, 2:30 am


Muttley
Posts: 39
Joined: October 19th, 2012, 6:00 am

Re: a quick question?

Post by Muttley » November 30th, 2012, 2:52 am

Based in this piece of code, I think the error is here:

Code: Select all

Game::Game( HWND hWnd,const KeyboardServer& kServer )
:   gfx ( hWnd ),
   kbd( kServer ),
   x( 400 ),
   y( 300 ),
Try replacing with this:

Code: Select all

Game::Game( HWND hWnd,const KeyboardServer& kServer )
:   gfx ( hWnd ),
   kbd( kServer ),
   x( 400 ),
   y( 300 )
{}

Post Reply