I have a ton of errors all like this one:
gui_color.h|7|multiple definition of `GUI_COLOR::GetColor()'
Ive already did a search for "multiple definitions" and nothing was helping.
heres the code though for you to look at and spot my problem, i just cant find it. I just hope someone knows where i got lost at. Thanks for your time.
main.cpp
Code:
// main.cpp
#define _WIN32_WINNT 0x0601
#include "console.h"
using namespace std;
int main()
{
HANDLE hIn;
HANDLE hOut;
CONSOLE_SCREEN_BUFFER_INFO csbi;
int i = 0;
bool Continue = TRUE;
DWORD EventCount;
int LoopCount = 0;
int KeyEvents = 0;
INPUT_RECORD InRec;
DWORD NumRead;
hIn = GetStdHandle(STD_INPUT_HANDLE);
hOut = GetStdHandle(STD_OUTPUT_HANDLE);
GetConsoleScreenBufferInfo(hOut, &csbi);
ChangeScreenBufferSize(hOut, true, 128, 256);
MaximizeConsoleWindowSize(hOut);
while (Continue)
{
GetNumberOfConsoleInputEvents(hIn, &EventCount);
while (EventCount > 0)
{
ReadConsoleInput(hIn, &InRec, 1, &NumRead);
if (InRec.EventType == KEY_EVENT)
{
if (InRec.Event.KeyEvent.uChar.AsciiChar == 'a')
{
ClearScreen(hOut);
//DrawBox(hOut, box1);
//Displaying the ASCII Table
int x = 0;
int y = 0;
for(i = 0; i <= 255; i++)
{
MoveCursor(hOut, x, y);
cout << " # " << i << " " << (unsigned char) i << flush;
++y;
if(y > 20)
{
y = 0;
x += 9;
}
}
//
}
if (InRec.Event.KeyEvent.uChar.AsciiChar == 'b')
{
SMALL_RECT srBoxArea;
srBoxArea.Top = 2;
srBoxArea.Bottom = 32;
srBoxArea.Left = 2;
srBoxArea.Right = 32;
DrawBox(hOut, srBoxArea);
}
if (InRec.Event.KeyEvent.uChar.AsciiChar == 'c')
{
ChangeCursor(hOut, 1, false);
}
if (InRec.Event.KeyEvent.uChar.AsciiChar == 'd')
{
DecrementConsoleWindowSize(hOut);
}
if (InRec.Event.KeyEvent.uChar.AsciiChar == 'i')
{
IncrementConsoleWindowSize(hOut);
}
if (InRec.Event.KeyEvent.uChar.AsciiChar == 'm')
{
MaximizeConsoleWindowSize(hOut);
}
if (InRec.Event.KeyEvent.uChar.AsciiChar == 'o')
{
}
if (InRec.Event.KeyEvent.uChar.AsciiChar == 'x')
{
Continue = FALSE;
}
if (InRec.Event.KeyEvent.uChar.AsciiChar == 'w')
{
ClearScreen(hOut);
}
if (InRec.Event.KeyEvent.uChar.AsciiChar == '?')
{
GetConsoleScreenBufferInfo(hOut, &csbi);
ClearScreen(hOut);
MoveCursor(hOut, 0, 0); cout << "CONSOLE_SCREEN_BUFFER_INFO :" << flush;
MoveCursor(hOut, 5, 2); cout << "dwSize :" << flush;
MoveCursor(hOut, 5, 3); cout << "X = " << csbi.dwSize.X << flush;
MoveCursor(hOut, 5, 4); cout << "Y = " << csbi.dwSize.Y << flush;
MoveCursor(hOut, 5, 6); cout << "srWindow :" << flush;
MoveCursor(hOut, 5, 7); cout << "Right = " << csbi.srWindow.Right << flush;
MoveCursor(hOut, 5, 8); cout << "Bottom = " << csbi.srWindow.Bottom << flush;
MoveCursor(hOut, 5, 10); cout << "dwMaximumWindowSize :" << flush;
MoveCursor(hOut, 5, 11); cout << "X = " << csbi.dwMaximumWindowSize.X << flush;
MoveCursor(hOut, 5, 12); cout << "X = " << csbi.dwMaximumWindowSize.Y << flush;
}
}
else if (InRec.EventType == MOUSE_EVENT)
{
if (InRec.Event.MouseEvent.dwEventFlags == 0)
{
if (InRec.Event.MouseEvent.dwButtonState & 0x01)
{
// Down
}
else
{
// Up
}
if (InRec.Event.MouseEvent.dwButtonState & 0x02)
{
// Down
}
else
{
// Up
}
}
else if (InRec.Event.MouseEvent.dwEventFlags == MOUSE_MOVED)
{
//cout << InRec.Event.MouseEvent.dwMousePosition.X << "," << InRec.Event.MouseEvent.dwMousePosition.Y << " " << flush;
}
else if (InRec.Event.MouseEvent.dwEventFlags == DOUBLE_CLICK)
{
//cout << InRec.Event.MouseEvent.dwMousePosition.X << "," << InRec.Event.MouseEvent.dwMousePosition.Y << " " << flush;
}
else if (InRec.Event.MouseEvent.dwEventFlags == MOUSE_WHEELED)
{
// Caution: Non-MSDN documented technique
if (InRec.Event.MouseEvent.dwButtonState & 0xFF000000)
{
// Down
}
else
{
// Up
}
}
}
GetNumberOfConsoleInputEvents(hIn, &EventCount);
}
}
return 0;
}
cosole.cpp
Code:
// console.cpp
#include <windows.h>
#include <wincon.h>
#include <iostream>
#include "gui_box.h"
// Custom Console Functions: Prototypes
void ClearScreen(HANDLE hOut);
void ChangeCursor(HANDLE hOut,int iSize, bool bVisable);
void MoveCursor(HANDLE hOut, COORD Pos);
void MoveCursor(HANDLE hOut, int iX, int iY);
void SetColor(HANDLE hOut, int iForeColor, int iBackColor);
void MaximizeConsoleWindowSize(HANDLE hOut);
void IncrementConsoleWindowSize(HANDLE hOut);
void IncrementConsoleWindowSize(HANDLE hOut, int iInc);
void DecrementConsoleWindowSize(HANDLE hOut);
void DecrementConsoleWindowSize(HANDLE hOut, int iDec);
// Todo
void ChangeConsoleWindowSize(HANDLE hOut, bool bAbsolute, int iX, int iY);
void ChangeScreenBufferSize(HANDLE hOut, bool bAbsolute, int iX, int iY);
void DrawBox(HANDLE hOut, SMALL_RECT srBoxArea);
void DrawBox(HANDLE hOut, GUI_BOX gbBox);
console.h
Code:
// console.h
#ifndef CONSOLE_H_INCLUDED
#define CONSOLE_H_INCLUDED
#include "console.cpp"
// Color definations:
#define FBlack 0
#define FRed FOREGROUND_RED
#define FGreen FOREGROUND_GREEN
#define FBlue FOREGROUND_BLUE
#define FYellow FORGROUND_RED | FORGROUND_GREEN
#define FCyan FOREGROUND_GREEN | FOREGROUND_BLUE
#define FMagenta FOREGROUND_RED | FOREGROUND_BLUE
#define FWhite FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE
#define FRedI FOREGROUND_RED | FOREGROUND_INTENSITY
#define FGreenI FOREGROUND_GREEN | FOREGROUND_INTENSITY
#define FBlueI FOREGROUND_BLUE | FOREGROUND_INTENSITY
#define FYellowI FORGROUND_RED | FORGROUND_GREEN | FOREGROUND_INTENSITY
#define FCyanI FOREGROUND_GREEN | FOREGROUND_BLUE | FOREGROUND_INTENSITY
#define FMagentaI FOREGROUND_RED | FOREGROUND_BLUE | FOREGROUND_INTENSITY
#define FWhiteI FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE | FOREGROUND_INTENSITY
#define BBlack 0
#define BRed BACKGROUND_RED
#define BGreen BACKGROUND_GREEN
#define BBlue BACKGROUND_BLUE
#define BYellow BACKGROUND_RED | BACKGROUND_GREEN
#define BCyan BACKGROUND_GREEN | BACKGROUND_BLUE
#define BMagenta BACKGROUND_RED | BACKGROUND_BLUE
#define BWhite BACKGROUND_RED | BACKGROUND_GREEN | BACKGROUND_BLUE
#define BRedI BACKGROUND_RED | BACKGROUND_INTENSITY
#define BGreenI BACKGROUND_GREEN | BACKGROUND_INTENSITY
#define BBlueI BACKGROUND_BLUE | BACKGROUND_INTENSITY
#define BYellowI BACKGROUND_RED | BACKGROUND_GREEN | BACKGROUND_INTENSITY
#define BCyanI BACKGROUND_GREEN | BACKGROUND_BLUE | BACKGROUND_INTENSITY
#define BMagentaI BACKGROUND_RED | BACKGROUND_BLUE | BACKGROUND_INTENSITY
#define BWhiteI BACKGROUND_RED | BACKGROUND_GREEN | BACKGROUND_BLUE | BACKGROUND_INTENSITY
using namespace std;
// Custom Data Types
// Custom Console Functions: Implementaions
void ClearScreen(HANDLE hOut)
{
CONSOLE_SCREEN_BUFFER_INFO SBInfo;
int ScreenTotal;
COORD Position;
DWORD Written;
Position.X = 0;
Position.Y = 0;
GetConsoleScreenBufferInfo(hOut, &SBInfo);
ScreenTotal = SBInfo.dwSize.X * SBInfo.dwSize.Y;
FillConsoleOutputCharacter(hOut, ' ', ScreenTotal, Position, &Written);
}
void ChangeCursor(HANDLE hOut, int iSize, bool bVisable)
{
CONSOLE_CURSOR_INFO ConCurInf;
ConCurInf.dwSize = iSize;
ConCurInf.bVisible = bVisable;
SetConsoleCursorInfo(hOut, &ConCurInf);
}
void MoveCursor(HANDLE hOut, COORD Pos)
{
SetConsoleCursorPosition(hOut, Pos);
}
void MoveCursor(HANDLE hOut, int iX, int iY)
{
COORD Pos;
Pos.X = iX;
Pos.Y = iY;
SetConsoleCursorPosition(hOut, Pos);
}
void SetColor(HANDLE hOut, int iForeColor, int iBackColor)
{
SetConsoleTextAttribute(hOut, iForeColor | iBackColor);
}
void MaximizeConsoleWindowSize(HANDLE hOut)
{
CONSOLE_SCREEN_BUFFER_INFO csbi;
SMALL_RECT DisplayArea;
GetConsoleScreenBufferInfo(hOut, &csbi);
DisplayArea.Left = 0;
DisplayArea.Top = 0;
DisplayArea.Right = csbi.dwMaximumWindowSize.X-1;
DisplayArea.Bottom = csbi.dwMaximumWindowSize.Y-1;
SetConsoleWindowInfo(hOut, TRUE, &DisplayArea);
}
void IncrementConsoleWindowSize(HANDLE hOut)
{
CONSOLE_SCREEN_BUFFER_INFO csbi;
SMALL_RECT DisplayArea;
GetConsoleScreenBufferInfo(hOut, &csbi);
DisplayArea.Left = 0;
DisplayArea.Top = 0;
if((csbi.srWindow.Right+1) < (csbi.dwMaximumWindowSize.X))
{
DisplayArea.Right = csbi.srWindow.Right + 1;
}
else
{
DisplayArea.Right = csbi.dwMaximumWindowSize.X - 1;
}
if((csbi.srWindow.Bottom+1) < (csbi.dwMaximumWindowSize.Y))
{
DisplayArea.Bottom = csbi.srWindow.Bottom + 1;
}
SetConsoleWindowInfo(hOut, TRUE, &DisplayArea);
}
void IncrementConsoleWindowSize(HANDLE hOut, int iInc)
{
CONSOLE_SCREEN_BUFFER_INFO csbi;
SMALL_RECT DisplayArea;
GetConsoleScreenBufferInfo(hOut, &csbi);
DisplayArea.Left = 0;
DisplayArea.Top = 0;
if((csbi.srWindow.Right + iInc) < (csbi.dwMaximumWindowSize.X))
{
DisplayArea.Right = csbi.srWindow.Right + 1;
}
else
{
DisplayArea.Right = csbi.dwMaximumWindowSize.X - 1;
}
if((csbi.srWindow.Bottom + iInc) < (csbi.dwMaximumWindowSize.Y))
{
DisplayArea.Bottom = csbi.dwMaximumWindowSize.Y - 1;
}
else
{
DisplayArea.Bottom = csbi.srWindow.Bottom + 1;
}
SetConsoleWindowInfo(hOut, TRUE, &DisplayArea);
}
void DecrementConsoleWindowSize(HANDLE hOut)
{
CONSOLE_SCREEN_BUFFER_INFO csbi;
SMALL_RECT DisplayArea;
GetConsoleScreenBufferInfo(hOut, &csbi);
DisplayArea.Left = 0;
DisplayArea.Top = 0;
if((csbi.srWindow.Right - 1) >= 0)
{
DisplayArea.Right = csbi.srWindow.Right - 1;
}
if((csbi.srWindow.Bottom - 1) >= 0)
{
DisplayArea.Bottom = csbi.srWindow.Bottom - 1;
}
SetConsoleWindowInfo(hOut, TRUE, &DisplayArea);
}
void DecrementConsoleWindowSize(HANDLE hOut, int iDec)
{
CONSOLE_SCREEN_BUFFER_INFO csbi;
SMALL_RECT DisplayArea;
GetConsoleScreenBufferInfo(hOut, &csbi);
DisplayArea.Left = 0;
DisplayArea.Top = 0;
if((csbi.srWindow.Right - iDec) >= 0)
{
DisplayArea.Right = csbi.srWindow.Right - 1;
}
if((csbi.srWindow.Bottom + iDec) >= 0)
{
DisplayArea.Bottom = csbi.srWindow.Bottom - 1;
}
SetConsoleWindowInfo(hOut, TRUE, &DisplayArea);
}
// Todo: Add individual functions for incrementing and decrememting the window size in just one direction at a time.
void ChangeConsoleWindowSize(HANDLE hOut, bool bAbsolute, int iX, int iY)
{
CONSOLE_SCREEN_BUFFER_INFO csbi;
SMALL_RECT DisplayArea;
GetConsoleScreenBufferInfo(hOut, &csbi);
DisplayArea.Left = 0;
DisplayArea.Top = 0;
if(bAbsolute)
{
if(iX >= 0)
{
DisplayArea.Right = iX;
}
else
{
DisplayArea.Right = 0;
}
if(iY >= 0)
{
DisplayArea.Bottom = iY;
}
else
{
DisplayArea.Bottom = 0;
}
}
else
{
if(iX >= 0)
{
if((csbi.srWindow.Right + iX) < csbi.dwMaximumWindowSize.X)
{
DisplayArea.Right = csbi.srWindow.Right + iX;
}
else
{
DisplayArea.Right = csbi.dwMaximumWindowSize.X - 1;
}
}
if(iY >= 0)
{
if((csbi.srWindow.Bottom + iY) < csbi.dwMaximumWindowSize.Y)
{
DisplayArea.Bottom = csbi.srWindow.Bottom + iY;
}
else
{
DisplayArea.Bottom = csbi.dwMaximumWindowSize.Y - 1;
}
}
}
SetConsoleWindowInfo(hOut, TRUE, &DisplayArea);
}
void ChangeScreenBufferSize(HANDLE hOut, bool bAbsolute, int iX, int iY)
{
CONSOLE_SCREEN_BUFFER_INFO csbi;
COORD newcsbs;
GetConsoleScreenBufferInfo(hOut, &csbi);
if(bAbsolute)
{
newcsbs.X = iX;
newcsbs.Y = iY;
}
else
{
newcsbs.X = csbi.dwSize.X + iX;
newcsbs.Y = csbi.dwSize.Y + iY;
}
SetConsoleScreenBufferSize(hOut, newcsbs);
}
void DrawBox(HANDLE hOut, SMALL_RECT srBoxArea)
{
int i = 0;
COORD TopLeft, TopRight, BottomLeft, BottomRight;
TopLeft.X = srBoxArea.Left;
TopLeft.Y = srBoxArea.Top;
TopRight.X = srBoxArea.Right;
TopRight.Y = srBoxArea.Top;
BottomLeft.X = srBoxArea.Left;
BottomLeft.Y = srBoxArea.Bottom;
BottomRight.X = srBoxArea.Right;
BottomRight.Y = srBoxArea.Bottom;
MoveCursor(hOut, TopLeft); cout << "+";
MoveCursor(hOut, TopRight); cout << "+";
MoveCursor(hOut, BottomLeft); cout << "+";
MoveCursor(hOut, BottomRight); cout << "+";
for(i = TopLeft.X + 1; i < TopRight.X; i++)
{
MoveCursor(hOut, i, srBoxArea.Top); cout << "-";
}
for(i = BottomLeft.X + 1; i < BottomRight.X; i++)
{
MoveCursor(hOut, i, srBoxArea.Bottom); cout << "-";
}
for(i = TopLeft.Y + 1; i < BottomLeft.Y; i++)
{
MoveCursor(hOut, srBoxArea.Left, i); cout << "|";
}
for(i = TopRight.Y + 1; i < BottomRight.Y; i++)
{
MoveCursor(hOut, srBoxArea.Right, i); cout << "|";
}
}
void DrawBox(HANDLE hOut, GUI_BOX gbBox)
{
int i = 0;
MoveCursor(hOut, gbBox.GetTopLeft()); cout << "+";
MoveCursor(hOut, gbBox.GetTopRight()); cout << "+";
MoveCursor(hOut, gbBox.GetBottomLeft()); cout << "+";
MoveCursor(hOut, gbBox.GetBottomRight()); cout << "+";
for(i = (gbBox.GetTopLeft()).X + 1; i < (gbBox.GetTopRight()).X; i++)
{
MoveCursor(hOut, i, gbBox.GetTop()); cout << "-";
}
for(i = (gbBox.GetBottomLeft()).X + 1; i < (gbBox.GetBottomRight()).X; i++)
{
MoveCursor(hOut, i, gbBox.GetBottom()); cout << "-";
}
for(i = (gbBox.GetTopLeft()).Y + 1; i < (gbBox.GetBottomLeft()).Y; i++)
{
MoveCursor(hOut, gbBox.GetLeft(), i); cout << "|";
}
for(i = (gbBox.GetTopRight()).Y + 1; i < (gbBox.GetBottomRight()).Y; i++)
{
MoveCursor(hOut, gbBox.GetRight(), i); cout << "|";
}
}
#endif // CONSOLE_H_INCLUDED
gui_box.cpp
Code:
// gui_box.cpp
#include "gui_color.h"
class GUI_BOX
{
public:
GUI_COLOR GetBoxBoarderColor();
GUI_COLOR GetBoxFillColor();
SMALL_RECT GetBoxRect();
int GetTop();
int GetBottom();
int GetLeft();
int GetRight();
COORD GetTopLeft();
COORD GetTopRight();
COORD GetBottomLeft();
COORD GetBottomRight();
void SetBoarderColor(GUI_COLOR);
void SetFillColor(GUI_COLOR);
void SetBoxRect(SMALL_RECT);
void SetBoxRect(int, int, int, int);
GUI_BOX();
//GUI_BOX(GUI_BOX);
GUI_BOX(int, int, int, int, GUI_COLOR, GUI_COLOR);
GUI_BOX(SMALL_RECT, GUI_COLOR, GUI_COLOR);
GUI_BOX(int, int, int, int, int, int, int, int);
GUI_BOX(SMALL_RECT, int, int, int, int);
~GUI_BOX();
private:
GUI_COLOR gcBoxBoarderColor, gcBoxFillColor;
SMALL_RECT srBoxRect;
COORD cdTopLeft, cdTopRight, cdBottomLeft, cdBottomRight;
void CalcBoxCorners();
};
gui_box.h
Code:
//gui_box.h
#ifndef GUI_BOX_H_INCLUDED
#define GUI_BOX_H_INCLUDED
#include "gui_box.cpp"
GUI_COLOR GUI_BOX::GetBoxBoarderColor()
{
return gcBoxBoarderColor;
}
GUI_COLOR GUI_BOX::GetBoxFillColor()
{
return gcBoxFillColor;
}
SMALL_RECT GUI_BOX::GetBoxRect()
{
return srBoxRect;
}
int GUI_BOX::GetTop()
{
return srBoxRect.Top;
}
int GUI_BOX::GetBottom()
{
return srBoxRect.Bottom;
}
int GUI_BOX::GetLeft()
{
return srBoxRect.Left;
}
int GUI_BOX::GetRight()
{
return srBoxRect.Right;
}
COORD GUI_BOX::GetTopLeft()
{
return cdTopLeft;
}
COORD GUI_BOX::GetTopRight()
{
return cdTopRight;
}
COORD GUI_BOX::GetBottomLeft()
{
return cdBottomLeft;
}
COORD GUI_BOX::GetBottomRight()
{
return cdBottomRight;
}
void GUI_BOX::SetBoarderColor(GUI_COLOR gc)
{
gcBoxBoarderColor = gc;
}
void GUI_BOX::SetFillColor(GUI_COLOR gc)
{
gcBoxFillColor = gc;
}
void GUI_BOX::SetBoxRect(SMALL_RECT sr)
{
srBoxRect = sr;
CalcBoxCorners();
}
void GUI_BOX::SetBoxRect(int iTop, int iBottom, int iLeft, int iRight)
{
srBoxRect.Top = iTop;
srBoxRect.Bottom = iBottom;
srBoxRect.Left = iLeft;
srBoxRect.Right = iRight;
CalcBoxCorners();
}
void GUI_BOX::CalcBoxCorners()
{
cdTopLeft.X = srBoxRect.Left;
cdTopLeft.Y = srBoxRect.Top;
cdTopRight.X = srBoxRect.Right;
cdTopRight.Y = srBoxRect.Top;
cdBottomLeft.X = srBoxRect.Left;
cdBottomLeft.Y = srBoxRect.Bottom;
cdBottomRight.X = srBoxRect.Right;
cdBottomRight.Y = srBoxRect.Bottom;
}
GUI_BOX::GUI_BOX()
{
}
//GUI_BOX::GUI_BOX(GUI_BOX gb)
//{
// SetFillColor(gb.GetBoxFillColor());
//
// SetBoxRect(gb.GetBoxRect());
//
// CalcBoxCorners();
//}
GUI_BOX::GUI_BOX(int iTop, int iBottom, int iLeft, int iRight, GUI_COLOR gcBoarderColor, GUI_COLOR gcFillColor)
{
srBoxRect.Top = iTop;
srBoxRect.Bottom = iBottom;
srBoxRect.Left = iLeft;
srBoxRect.Right = iRight;
gcBoxBoarderColor.SetForeColor(gcBoarderColor.GetForeColor());
gcBoxBoarderColor.SetBackColor(gcBoarderColor.GetBackColor());
gcBoxFillColor.SetForeColor(gcBoarderColor.GetForeColor());
gcBoxFillColor.SetBackColor(gcBoarderColor.GetBackColor());
CalcBoxCorners();
}
GUI_BOX::GUI_BOX(SMALL_RECT sr, GUI_COLOR gcBoarderColor, GUI_COLOR gcFillColor)
{
srBoxRect = sr;
gcBoxBoarderColor.SetForeColor(gcBoarderColor.GetForeColor());
gcBoxBoarderColor.SetBackColor(gcBoarderColor.GetBackColor());
gcBoxFillColor.SetForeColor(gcBoarderColor.GetForeColor());
gcBoxFillColor.SetBackColor(gcBoarderColor.GetBackColor());
CalcBoxCorners();
}
GUI_BOX::GUI_BOX(int iTop, int iBottom, int iLeft, int iRight, int ibcfc, int ibcbc, int ifcfc, int ifcbc)
{
srBoxRect.Top = iTop;
srBoxRect.Bottom = iBottom;
srBoxRect.Left = iLeft;
srBoxRect.Right = iRight;
gcBoxBoarderColor.SetForeColor(ibcfc);
gcBoxBoarderColor.SetBackColor(ibcbc);
gcBoxFillColor.SetForeColor(ifcfc);
gcBoxFillColor.SetBackColor(ifcbc);
CalcBoxCorners();
}
GUI_BOX::GUI_BOX(SMALL_RECT sr, int ibcfc, int ibcbc, int ifcfc, int ifcbc)
{
srBoxRect = sr;
gcBoxBoarderColor.SetForeColor(ibcfc);
gcBoxBoarderColor.SetBackColor(ibcbc);
gcBoxFillColor.SetForeColor(ifcfc);
gcBoxFillColor.SetBackColor(ifcbc);
CalcBoxCorners();
}
GUI_BOX::~GUI_BOX()
{
}
#endif // GUI_BOX_H_INCLUDED
gui_color.cpp
Code:
// gui_color.cpp
#include <windows.h>
#include <wincon.h>
class GUI_COLOR
{
public:
int GetColor();
int GetForeColor();
int GetBackColor();
void SetColor(GUI_COLOR);
void SetForeColor(int);
void SetBackColor(int);
//GUI_COLOR & operator=(GUI_COLOR &rhs);
GUI_COLOR();
GUI_COLOR(int, int);
~GUI_COLOR();
private:
int iForeColor, iBackColor;
};
gui_color.h
Code:
// gui_color.h
#ifndef GUI_COLOR_H_INCLUDED
#define GUI_COLOR_H_INCLUDED
#include "gui_color.cpp"
int GUI_COLOR::GetColor()
{
return (iForeColor | iBackColor);
}
int GUI_COLOR::GetForeColor()
{
return iForeColor;
}
int GUI_COLOR::GetBackColor()
{
return iBackColor;
}
void GUI_COLOR::SetColor(GUI_COLOR gc)
{
SetForeColor(gc.GetForeColor());
SetBackColor(gc.GetBackColor());
}
void GUI_COLOR::SetForeColor(int ifc)
{
iForeColor = ifc;
}
void GUI_COLOR::SetBackColor(int ibc)
{
iBackColor = ibc;
}
//GUI_COLOR & GUI_COLOR::operator=(GUI_COLOR &rhs)
//{
// if (this != &rhs)
// {
// return GUI_COLOR(iForeColor + rhs.GetForeColor(), iBackColor + rhs.GetBackColor());
// }
//
//}
GUI_COLOR::GUI_COLOR()
{
iForeColor = 0;
iBackColor = 0;
}
GUI_COLOR::GUI_COLOR(int ifc, int ibc)
{
iForeColor = ifc;
iBackColor = ibc;
}
GUI_COLOR::~GUI_COLOR()
{
}
#endif // GUI_COLOR_H_INCLUDED