mac-comp127 / kilt-graphics

Graphics and UI library for learning software development principles in Java
https://mac-comp127.github.io/kilt-graphics/
2 stars 17 forks source link

canvas.getHeight() doesn't correctly returns the canvas height #27

Open AviannaBui opened 1 year ago

AviannaBui commented 1 year ago

Description

The method getHeight() for CanvasWindow object on my computer does not return the correct height

Steps to Reproduce (also see the attached picture for reference)

import edu.macalester.graphics.*;

public class BreakoutGame {

        private static final int CANVAS_WIDTH = 600;
        private static final int CANVAS_HEIGHT = 800;
        private CanvasWindow canvas;

        public BreakoutGame() {
            canvas = new CanvasWindow("Breakout!", CANVAS_WIDTH, CANVAS_HEIGHT);
    }

    public void run() {
            System.out.println(canvas.getHeight());
    }

    public static void main(String[] args) {
            new BreakoutGame().run();
    }

}

Expected behavior

The number 800 is printed out

Actual behavior

The number 700 is printed out bugggg

AviannaBui commented 1 year ago

A similar(?) problem happens with my canvas.getWidth() (the printed width for the small-scale window is 600, but when I enlarge the window to its full size, the printed width changes to 1281