Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rework the UI line drawing functions. #8

Open
FlightControl-User opened this issue Mar 10, 2023 · 0 comments
Open

Rework the UI line drawing functions. #8

FlightControl-User opened this issue Mar 10, 2023 · 0 comments
Assignees
Labels
enhancement New feature or request

Comments

@FlightControl-User
Copy link
Owner

Make some drawing functions for drawing lines, and intelligently merge the lines using line merge characters, instead of adding each character manually.

Rework this:

void frame_draw() {

    textcolor(WHITE);
    bgcolor(BLUE);

    clrscr();
    unsigned char y = 0;
    for (unsigned char x = 0; x < 79; x++) {
        cputcxy(x, y, 0x40);
    }
    cputcxy(0, y, 0x70);
    cputcxy(79, y, 0x6E);

    y++;
    cputcxy(0, y, 0x5d);
    cputcxy(79, y, 0x5d);

    y++;
    for (unsigned char x = 0; x < 79; x++) {
        cputcxy(x, y, 0x40);
    }
    cputcxy(0, y, 0x6B);
    cputcxy(79, y, 0x73);
    cputcxy(12, y, 0x72);

    y++;
    for (; y < 37; y++) {
        cputcxy(0, y, 0x5D);
        cputcxy(12, y, 0x5D);
        cputcxy(79, y, 0x5D);
    }

    for (unsigned char x = 0; x < 79; x++) {
        cputcxy(x, y, 0x40);
    }
    cputcxy(0, y, 0x6B);
    cputcxy(79, y, 0x73);
    cputcxy(12, y, 0x71);

    y++;
    for (; y < 41; y++) {
        cputcxy(0, y, 0x5D);
        cputcxy(79, y, 0x5D);
    }

    for (unsigned char x = 0; x < 79; x++) {
        cputcxy(x, y, 0x40);
    }
    cputcxy(0, y, 0x6B);
    cputcxy(79, y, 0x73);
    cputcxy(10, y, 0x72);
    cputcxy(20, y, 0x72);
    cputcxy(30, y, 0x72);
    cputcxy(40, y, 0x72);
    cputcxy(50, y, 0x72);
    cputcxy(60, y, 0x72);
    cputcxy(70, y, 0x72);
    cputcxy(79, y, 0x73);

    y++;
    for (; y < 55; y++) {
        cputcxy(0, y, 0x5D);
        cputcxy(79, y, 0x5D);
        cputcxy(10, y, 0x5D);
        cputcxy(20, y, 0x5D);
        cputcxy(30, y, 0x5D);
        cputcxy(40, y, 0x5D);
        cputcxy(50, y, 0x5D);
        cputcxy(60, y, 0x5D);
        cputcxy(70, y, 0x5D);
    }

    for (unsigned char x = 0; x < 79; x++) {
        cputcxy(x, y, 0x40);
    }
    cputcxy(0, y, 0x6B);
    cputcxy(79, y, 0x73);
    cputcxy(10, y, 0x5B);
    cputcxy(20, y, 0x5B);
    cputcxy(30, y, 0x5B);
    cputcxy(40, y, 0x5B);
    cputcxy(50, y, 0x5B);
    cputcxy(60, y, 0x5B);
    cputcxy(70, y, 0x5B);

    y++;
    for (; y < 59; y++) {
        cputcxy(0, y, 0x5D);
        cputcxy(79, y, 0x5D);
        cputcxy(10, y, 0x5D);
        cputcxy(20, y, 0x5D);
        cputcxy(30, y, 0x5D);
        cputcxy(40, y, 0x5D);
        cputcxy(50, y, 0x5D);
        cputcxy(60, y, 0x5D);
        cputcxy(70, y, 0x5D);
    }

    for (unsigned char x = 0; x < 79; x++) {
        cputcxy(x, y, 0x40);
    }
    cputcxy(0, y, 0x6D);
    cputcxy(79, y, 0x7D);
    cputcxy(10, y, 0x71);
    cputcxy(20, y, 0x71);
    cputcxy(30, y, 0x71);
    cputcxy(40, y, 0x71);
    cputcxy(50, y, 0x71);
    cputcxy(60, y, 0x71);
    cputcxy(70, y, 0x71);
    cputcxy(79, y, 0x7D);
}
@FlightControl-User FlightControl-User added the enhancement New feature or request label Mar 10, 2023
@FlightControl-User FlightControl-User self-assigned this Mar 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant