+ 1
How I can do a pixel art program in c++?
which libraries i can need to do the program?
1 ответ
+ 11
See this program i use putpixel for pixels in cpp using graphics. This code will draw star 🌟 in pixels . See graphics librabry how i include in program.
#include<stdio.h>
#include<graphics.h>
#include<conio.h>
#include<dos.h>
void main()
{
int gd=DETECT,gm;
initgraph(&gd,&gm,"C:\\TC\\bgi"); for(int i=0;i<250;i++)
{
putpixel(250-i/2,145+i,i); // left
putpixel(250+i/2,145+i,i); // right
putpixel(130+i,256,i); //UPPER VERTICLE
putpixel(128+i,400-10-i/1.9,i); //LEFT TO RIGHT HORIZONTAL
putpixel(128+i,255+i/1.9,i); // RIGHT TO LEFT HORIZONATAL
// putpixel(126+i,400,i); // down line
delay(30);
}
for(i=1;i<200;i++)
{
setcolor(i);
circle(253,272,129);
outtextxy(248,220,"A" );
delay(50);
outtextxy(170,263,"L" );
outtextxy(180,330,"I" );
outtextxy(315,330,"N" );
outtextxy(328,263,"A" );
closegraph();
getch();
}
}