package me.hammerle.supersnuvi.rendering;

import javafx.scene.image.Image;
import javafx.scene.paint.Color;

public interface IGameRenderer 
{
    public static final int LINES = 25;
    public static final int CHARS_PER_LINE = 50;
    
    /** This should be called before any String drawing
     *
     * @param c the color of the text
     */
    public void prepareStringDrawing(Color c);
    
    /** This should be called after the last String in a frame was drawn
     *
     */
    public void stopStringDrawing();
    
    /** Returns the x offset of a char at x
     *
     * @param x the x position
     * @return the offset
     */
    public double getStringOffsetX(int x);
    
    /** Returns the y offset of a char at y
     *
     * @param y the position
     * @return the offset
     */
    public double getStringOffsetY(int y);
    
    /** Returns the height of a text line
     *
     * @return the hight of a text line
     */
    public double getLineHeight();
    
    /** Returns the width of a String
     *
     * @param length the length of the String
     * @return the width
     */
    public double getStringWidth(int length);
    
    /** Returns the width of a String
     *
     * @param s a String
     * @return the width
     */
    public double getStringWidth(String s);
    
    /** Returns the width of a char array
     *
     * @param chars a char array
     * @return the width
     */
    public double getCharsWidth(char[] chars);
    
    /** Draws a String at the desired position
     *
     * @param s a String
     * @param x the x coord of the position
     * @param y the y coord of the position
     */
    public void drawString(String s, double x, double y);
    
    /** Draws a char array at the desired position
     *
     * @param chars a char array
     * @param x the x coord of the position
     * @param y the y coord of the position
     */
    public void drawChars(char[] chars, double x, double y);
    
    /** Draws an image at the desired position
     *
     * @param image the image
     * @param x the x coord of the position
     * @param y the y coord of the position
     */
    public void drawImage(Image image, double x, double y);
    
    /** Draws a fixed image at the desired position
     *
     * @param image the image
     * @param x the x coord of the position
     * @param y the y coord of the position
     */
    public void drawFixedImage(Image image, double x, double y);
    
    /** Draws a flipped image at the desired position
     *
     * @param image the image
     * @param x the x coord of the position
     * @param y the y coord of the position
     */
    public void drawFlippedImage(Image image, double x, double y);
    
    /** Draws an image at the desired block position
     *
     * @param image the image
     * @param x the x coord of the position
     * @param y the y coord of the position
     */
    public void drawBlockImage(Image image, int x, int y);
    
    /** Sets the stroke color
     *
     * @param c the color
     */
    public void setStrokeColor(Color c);
    
    /** Sets the fill color
     *
     * @param c the color
     */
    public void setFillColor(Color c);
    
    /** Fills a rectangle at the desired position
     *
     * @param x the x coord of the position
     * @param y the y coord of the position
     * @param width the width
     * @param height the height
     * @param c the fill color
     */
    public void fillRec(double x, double y, double width, double height, Color c);
    
    /** Gets the x coord of the first visible block
     *
     * @return the x coord
     */
    public int getFirstVisibleBlockX();
    
    /** Gets the y coord of the first visible block
     *
     * @return the y coord
     */
    public int getFirstVisibleBlockY();
    
    /** Gets the x coord of the last visible block
     *
     * @return the x coord
     */
    public int getLastVisibleBlockX();
    
    /** Gets the y coord of the last visible block
     *
     * @return the y coord
     */
    public int getLastVisibleBlockY();
    
    /** Translates a coord to a block coord
     *
     * @param c a coord
     * @return a block coord
     */
    public int toBlock(double c);

    /** Translates a block coord to a coord
     *
     * @param b a block coord
     * @return a coord
     */
    public double toCoord(int b);
    
    /** Gets the width of the window
     *
     * @return the width
     */
    public double getWidth();

    /** Gets the height of the window
     *
     * @return the height
     */
    public double getHeight();
    
    /** Sets the view center
     *
     * @param x the x coordinate
     * @param y the y coordinate
     */
    public void setViewCenter(double x, double y);
}
