Initwindow and Initgraph stops program

46 Views Asked by At

initwindow and initgraph just stop the program. It still compiles, and it shows me the process return message afterwards and all that, but anything after it just doesn't do anything.

I have the latest versions of MinGW and Codeblocks installed, and I've done all the putting winbgim files in their places and pasted the text in the compiler settings and all that.

Code below:

#include <graphics.h>
#include <conio.h>
#include <iostream>
using namespace std;
int main()
{
    cout<<"Check"<<endl;
    int page=1;
//   initwindow(1200, 768);
    int gd=DETECT,gm;
    cout<<"Check2"<<endl;
    initgraph(&gd,&gm,"");
    cout<<"Check3"<<endl;

    int a=50, b=50;
    circle(a,b, 50);


    while(true){

    if(GetAsyncKeyState(VK_RIGHT)){
        //if key pressed is right
        a=a+25;

    }
    if(GetAsyncKeyState(VK_LEFT)){
        //if key pressed is left
        a=a-25;

    }
    if(GetAsyncKeyState(VK_UP)){
        //if key pressed is left
        b=b-25; //remember top left is 0, 0

    }
    if(GetAsyncKeyState(VK_DOWN)){
        //if key pressed is left
        b=b+25; //remember top left is 0, 0

    }


    setactivepage(page); //to draw
    //draw

    setvisualpage(1-page); //to show
    delay(20);
    cleardevice();
    circle(a,b, 50);
    page=1-page;
    }
   return 0;
}
0

There are 0 best solutions below