I am desperately trying to make a header file with functions for experimenting with ASCII graphics in console. My goal is to simplify the using of windows.h. I am using Dev-C++.
I wrote a void-type initialization function that sets the window and screen-buffer size, title and cursor size and visibility by using parameters and windows.h functions.
#ifndef _KONGRA_H
#define _KONGRA_H
#include <cstdlib>
#include <iostream>
#include <windows.h>
using namespace std;
HANDLE KGconsole=GetStdHandle(STD_OUTPUT_HANDLE);
//========================================================================CURSOR
bool KGcursorvisible;
int KGcursorsize;
CONSOLE_CURSOR_INFO KGcursorstat;
//========================================================================WINDOW
int KGbuffersizex;
int KGbuffersizey;
COORD KGbuffersize;
int KGwindowsizex;
int KGwindowsizey;
SMALL_RECT KGwindowsize;
TCHAR KGconsoletitle;
void KGset(KGbuffersizex, KGbuffersizey, KGwindowsizex, KGwindowsizey, KGconsoletitle, KGcursorvisible, KGcursorsize)
{
SetConsoleTitle(KGconsoletitle);
KGcursorstat.dwSize=KGcursorsize;
KGcursorstat.bVisible=KGcursorvisible;
SetConsoleCursorInfo(KGconsole, &KGcursorstat);
KGbuffersize={KGbuffersizex, KGbuffersizey};
SetConsoleScreenBufferSize(KGconsole, KGbuffersize);
KGwindowsize={0, 0, KGwindowsizex-1, KGwindowsizey-1};
SetConsoleWindowInfo(KGconsole, TRUE, &KGwindowsize);
}
#endif
When whole file included, it keeps giving a compilation error:
24 variable or field `KGset' declared void
25 initializer expression list treated as compound expression
25 `,' or `;' before '{' token
I can't find a missing character so it's possible that I am wrongly using header.
Maybe it isn't important, but here's main.cpp:
#include <cstdlib>
#include <iostream>
#include <conio.h>
#include "kongra.h"
using namespace std;
int main(int argc, char *argv[])
{
KGset(20, 20, 10, 30, "Hi", 1, 100);
getch();
return EXIT_SUCCESS;
}