Duthomhas / WinBGIm-fixed-sort-of-

A repaired version of WinBGIm for all the people asking me for it every year.
5 stars 7 forks source link

Not all lines are drawn properly. Specifically horizontal lines with the same y co-ordinate #2

Closed HemilTheRebel closed 4 years ago

HemilTheRebel commented 5 years ago

We are being taught graphics.h in turbo c++ in college which i refuse to touch. So I built this project as mentioned in the readme and followed this article to set up code blocks. I tried basic polygon programs and it worked. I then tried to do this:

#include <graphics.h>

int main()
{
    int gd = DETECT, gm;

    initgraph(&gd, &gm, "");

    // ground level
    line(0, 450, 700, 450);
    line(0, 445, 700, 445);

    // mario rectangle
    rectangle(70, 445, 100, 400);

    //obstacle
    rectangle(300, 445, 330, 400);

    // mountain 1
    line(0, 375, 150, 200);
    line(150, 200, 300, 375);

    //mountain 2
    line(300, 375, 450, 200);
    line(450, 200, 600, 375);

    // rising sun
    arc(300, 375, 50, 130, 100);

    getch();
    closegraph();
}

The output is this: bgi

The mario rectangle's top line is not visible. After a bit of experimenting, I found that this usually happens when mario rectangle and the obstacle have almost same height

Duthomhas commented 4 years ago

Alas, I cannot replicate the issue.

Also, please remember that I did not write nor do I maintain WinBGIm, which is a very old and very unmaintained library, so weird stuff like this may be an issue in the code that I am not going to fix.

I am sorry — I know this is not the answer hoped for. (Someday I will write a modern BGI for use with modern 64-bit compilers... But that day has not come yet.)

HemilTheRebel commented 4 years ago

Thats fine. I was using it to practise Computer Graphics course last sem. I did not want to use Turbo C++. This unmaintained code works on my 64 bit windows and thats enough.

Thanks for making the effort and trying to reproduce it. I feel the college should probably replace it anyway