Skip to content

Latest commit

 

History

History
46 lines (38 loc) · 1.17 KB

README.md

File metadata and controls

46 lines (38 loc) · 1.17 KB

ConsoleGraphics

A library I made between February and June 2021 for graphics in Microsoft Windows command prompt. The code might be bad because the Windows API is low level and I've copied a lot of the StackOverflow code, LOL.

To compile just use G++ like this:

g++ main.cpp -o main.exe -lwinmm

Example (I dont know if this will work on Visual C++):

#include <engine/PolyMain.cpp>
#include <stdio.h>

void display()
{
//	Arguments: X (int), Y (int), Radius (int), Color (See PolyDraw.h);
	drawcircle(20,20,10,BG_PINK);
}

int main()
{
//	Arguments: Display Function (void), Pixel Size (int)
	Window(display, 4);
	return 0;
}

If for some reason you want to see the cmd color palette, just do this:

#include <engine/PolyMain.cpp>
#include <engine/Pallete.cpp>

void display()
{
	drawpallette(0, 0);
}

int main()
{
	Window(display, 4);
	return 0;
}

By the way, drawing the color palette can be quite slow as all the code is based on a lot of drawpixel(), at the time I would fix that by creating a Sprite system but then I saw that it was a bit of a futile effort, because porting this lib to other OS than Windows could be complex, and running this lib is quite slow.