Up until now we used the Window class without knowing all its
methods, we only used those that are sufficient for most
games.
The constructor of the class Window is as follows:
public Window(int width, int height);
Below is a list of all the methods of this class:
//Constructor of the class.
public Window(int width, int height);
//Returns an instance of the keyboard.
public Keyboard getKeyboard();
//Returns an instance of the mouse.
public Mouse getMouse();
//Returns the "Graphics" where the images are draw.
public Graphics getGameGraphics();
//Shows the window updated with the drawings on the monitor screen.
public void update();
//Triggers a thread that makes the game stay in "sleep" mode by the time passed by parameter,
//Used principally to delay the execution of the game.
public void delay(long time);
//Returns the time elapsed in miliseconds since the game began to run.
public long timeElapsed();
//Returns the time elapsed in miliseconds between the previous and the current frame.
public long deltaTime();
//Draws a text on the screen.
public void drawText(String message, int x, int y, Color color);
//Draws a text on the screen.
public void drawText(String message, int x, int y, Color color, Font font);
//Closes the window and exits the game.
public void exit();
//Creates a new mouse cursor.
public Cursor createCustomCursor(String imageName);
//Cleans the screen and paints it with the color passed by parameter.
public void clear(Color color);
//Returns an array containing the display modes supported by the monitor.
public DisplayMode[] getCompatibleDisplayMode();
//Sets the display mode. To avoid errors, make sure to use a display
//mode compatible with the current monitor.
public void setDisplayMode(DisplayMode displayMode);
//Returns "true" if the display mode passed by parameter is compatible with the current
//monitor, and "false" otherwise.
public boolean isDisplayModeCompatible(DisplayMode displayMode);
//Puts the screen in fullscreen mode and it will have a resolution of 800x600 pixels.
public void setFullScreen();
//Removes the screen from fullscreen mode.
public void restoreScreen();
//Overloaded methods, to maintain compatibility between the fullscreen and normal mode.
public void setSize(int width, int height);
public void setSize(Dimension d);