#include "tetris-graph.h"

void InitGame(){
    InitWindow(SCREEN_WIDTH, SCREEN_HEIGHT, "Tetris");
    SetTargetFPS(60);
}

void InitDisplay(){
    ClearBackground(BLACK);
    DrawLine(BORDER_GAP, BORDER_GAP, BORDER_GAP, BORDER_GAP + GRID_HEIGHT, RAYWHITE);
    DrawLine(BORDER_GAP, BORDER_GAP + GRID_HEIGHT, BORDER_GAP + GRID_WIDTH, BORDER_GAP + GRID_HEIGHT, RAYWHITE);
    DrawLine(BORDER_GAP + GRID_WIDTH, BORDER_GAP + GRID_HEIGHT, BORDER_GAP + GRID_WIDTH, BORDER_GAP, RAYWHITE);
}

void drawSquare(Square sq){
    DrawRectangle(sq->posX*SQUARE_SIZE, sq->posY*SQUARE_SIZE,
                  SQUARE_SIZE, SQUARE_SIZE,
                  sq->color);
}

void drawPiece(Piece p){
    for(int i = 0; i < p.size; i++){
        drawSquare(p.squares[i]);
    }
}