#Weird glitch

5 messages · Page 1 of 1 (latest)

burnt gorge
#

I got an weird glitch where output is clipped or whenever i zoom in & out i got this weird glitch in this
it is supposed to be an red circle but it got clipped when the terminal is too small and when i zoomed out it looks ike a square or anything weird.
how do i solve this problem?
I tried it in win terminal, wezterm and alacritty and it produces the same issue
also note that text wrap is turned off using ansi code

rough socketBOT
#

When your question is answered use !solved to mark the question as resolved.

Remember to ask specific questions, provide necessary details, and reduce your question to its simplest form. For tips on how to ask a good question use !howto ask.

lyric mortar
burnt gorge
#
#include "include/QBoost/Canvas.hpp"
#include <iostream>

int main()
{
    // defining canvas dimensions
    const int width = 30;
    const int height = 30;

    qboost::Canvas canvas(width, height, qboost::CanvasTransparent);

    // defining properties of the circle
    const double centerX = width / 2.0;
    const double centerY = height / 2.0;
    const double radius = 28.0;
    const double radius_sq = radius * radius; // using squared radius for effeciency

    // define red color
    qboost::misc::rgb red_color = {255, 0, 0};

    // iterate through every pixel in the canva
    for (int y = 0; y < height; ++y) {
        for (int x = 0; x < width; ++x) {
            // calculation
            double dx = x - centerX;
            double dy = y - centerY;
            
            double distance_sq = dx * dx + dy * dy;

            // check if pixel's distance is in the circle
            if (distance_sq <= radius_sq) {
                canvas.drawPixel(x, y, red_color); // draw pixel in it
            }
        }
    }

    // when done its ready to render
    canvas.Render();
    
    std::cout << "\nPress Enter to exit..."; // wait user input
    std::cin.get();
}