создавая заполненный круг, где я нажимаю - PullRequest
0 голосов
/ 25 марта 2020

Что я могу добавить к этому, не усложняя его, чтобы убедиться, что мои круги заполнены в том месте, где я нажимаю?

package marchbreak;

/*reneh nezar, March 24, creates circles when clicking */

import java.awt.Color;
import java.awt.Point;

import hsa2.GraphicsConsole;

public class Circle {

    public static void main(String[] args) {
        new Circle();
    }

    static final int SCRW = 1920; //screen width
    static final int SCRH = 1080; // screen height
    GraphicsConsole gc = new GraphicsConsole(SCRW, SCRH);

    Circle() {
        Setup();
        while (true) {
            if (gc.getMouseClick() > 0){ // if user inputs more than one click at a time, then draw a circle
                color();
                gc.drawOval((int) gc.getMouseX() - 10, (int) gc.getMouseY() - 10, 25, 25); //size of circle
            }
            gc.sleep(1);

        }
    }
    void Setup() {
        gc.setAntiAlias(true);
        gc.setBackgroundColor(Color.black);
        gc.clear();
        gc.enableMouse();

    }
    void color() { //changes the color of the circle
        gc.setColor(Color.red);

    }

}

Я новичок и запутался в использовании графики, и мне было интересно, как я могу дальше улучшить это

...