Hover Effect With C/C++

 Hello Friends, I am back with a cool C/C++ program. Today we will create a Hover Effect with C/C++.


             


I know this looks crazy but it is true we will create a hover effect with c/c++. The source code for hover effect is given below.


Source Code


#include<graphics.h>


// hover effect 


int main()

{

    int bk_color=15;

initwindow(700,600,"Hover",150,50);

while(1)

{

POINT cursor;

GetCursorPos(&cursor);

setfillstyle(SOLID_FILL,bk_color);

bar(300,250,400,350);

if((cursor.x >=300+150 && cursor.x<=400+150)&&(cursor.y>=250+50 && cursor.y<=350+50))

    {

    bk_color=14;

}

else

bk_color=15;

}

getch();

closegraph();

}



NOTE- If you are getting some errors related to header file so you need to download graphics.h header file and you have to add it on compiler after that you are able to run all graphics program so you can read blog How TO Run Graphics Program or you can watch Video for graphics.h header setup.



Post a Comment

Previous Post Next Post