#include "game.h"
#include "../raylib.h"
#include "log.h"
#include "input.h"

#include <stdlib.h>
#include <stdbool.h>

#define TARGET_FPS 60

int main(void) {
    InitWindow(800, 450, "Text Adventure");
    SetTargetFPS(TARGET_FPS);

    GameState *gs = malloc(sizeof(GameState));
    gs->should_close = malloc(1);
    *(gs->should_close) = false;

    Log *log = create_log();
    Vector2 input_position = { 190, 200 };
    Input *input = create_input(input_position);
    input->log = log;
    input->gs = gs;
    gs->input = input;

    while (!WindowShouldClose() && !*(gs->should_close))
      {
	BeginDrawing();
	ClearBackground(BLACK);
	handle_pressed_keys(input);
	draw_log(log);
	draw_text(input);
        EndDrawing();
    }
    CloseWindow();
    free_input(input);
    free_log(log);

    return 0;
}