I have been reading these tutorials on c++ and have been programming for a bit. I already created a funny Coin flip game and programmed it without an help and figured out all the errors the comiler read to me. Anywho I am on to a new game just starting out with Console programming and these errors I cant seem to figure out.
1>------ Build started: Project: ASCII RPG, Configuration: Debug Win32 ------
1>Compiling...
1>Main.cpp
1>c:\users\brandon newman\documents\visual studio 2008\projects\ascii rpg\ascii rpg\main.cpp(31) : error C2143: syntax error : missing ')' before ';'
1>c:\users\brandon newman\documents\visual studio 2008\projects\ascii rpg\ascii rpg\main.cpp(31) : error C2059: syntax error : ')'
1>c:\users\brandon newman\documents\visual studio 2008\projects\ascii rpg\ascii rpg\main.cpp(34) : error C2143: syntax error : missing ')' before ';'
1>c:\users\brandon newman\documents\visual studio 2008\projects\ascii rpg\ascii rpg\main.cpp(34) : error C2059: syntax error : ')'
1>c:\users\brandon newman\documents\visual studio 2008\projects\ascii rpg\ascii rpg\main.cpp(48) : error C2143: syntax error : missing ';' before '/'
1>c:\users\brandon newman\documents\visual studio 2008\projects\ascii rpg\ascii rpg\main.cpp(49) : error C2143: syntax error : missing ';' before '/'
1>Build log was saved at "file://c:\Users\Brandon Newman\Documents\Visual Studio 2008\Projects\ASCII RPG\ASCII RPG\Debug\BuildLog.htm"
1>ASCII RPG - 6 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
Those are the errors here is my code
MAIN HEADER
#include< windows.h>
#include <iostream>
#include <string>
using namespace std;
//Directions//
#define NORTH 0;
#define SOUTH 1;
#define EAST 2;
#define WEST 3;
//Screen Size Default Size Max//
#define SCREEN_WIDTH 79;
#define SCREEN_HEIGHT 24;
//Erase And Draw//
#define ERASE 0;
#define DRAW 1;
//Players Structure
struct PLAYER{
COORD Position;
int Direction;
};
MAIN CPP
#include "main.h"
HANDLE hInput, hOutput;
CONSOLE_SCREEN_BUFFER_INFO ScrInfo;
// This function creates our character
void DrawPlayer(PLAYER Player, int Draw)
{
if(Draw)
{
SetConsoleCursorPosition(hOutput, Player.Position);
cout<<"#";
}
else
{
SetConsoleCursorPosition(hOutput, Player.Position);
cout<< " ";
}
}
void MovePlayer(PLAYER &Player)
{
INPUT_RECORD InputRecord;
DWORD Events=0;
ReadConsoleInput(hInput, &InputRecord,1, &Events);
if(InputRecord.EventType == MOUSE_EVENT)
{
if(InputRecord.Event.MouseEvent.dwButtonState == FROM_LEFT_1ST_BUTTON_PRESSED)
{
DrawPlayer (Player, ERASE);
Player.Position.X = InputRecord.Event.MouseEvent.dwMousePosition.X;
Player.Position.Y = InputRecord.Event.MouseEvent.dwMousePosition.Y;
DrawPlayer (Player, DRAW);
}
}
FlushConsoleInputBuffer(hInput);
}
int main()
{
PLAYER Player;
hInput = GetStdHandle(STD_INPUT_HANDLE);
hOutput = GetStdHandle(STD_OUTPUT_HANDLE);
SetConsoleMode(hInput, ENABLE_PROCESSED_INPUT | ENABLE_MOUSE_INPUT);
GetConsoleScreenBufferInfo(hOutput, &ScrInfo);
Player.Position.X = SCREEN_WIDTH / 2;
Player.Position.Y = SCREEN_HEIGHT / 2;
SetConsoleCursorPosition(hOutput, Player.Position);
while(1)
{
MovePlayer(Player);
}
}