/**
 * @file window.h
 * @author Piotr Krygier (everyonencancode@gmail.com)
 * @brief Window control system
 * @version 0.1
 * @date 2022-02-15
 *
 * @copyright Copyright (c) 2022
 *
 */

#ifndef WINDOW_H
#define WINDOW_H

#include <SDL3/SDL_main.h>
#include <vulkan/vulkan.h>

/* Vulkan header MUST be included before glfw */

#include "utilities/commons.h"
#include "graphics_context.h"

/**
 * @brief Initialize window
 *
 * @param window_handle Pointer to window window_handle, that will be initialized
 * @param is_framebuffer_resized Pointer to boolean, that will be set to true if framebuffer was resized
 * @return rse_err_t WINDOW_SUCCESS on success. Possible errors:
 *                  WINDOW_VULKAN_NOT_LOADED
 *                  WINDOW_WINDOW_NOT_CREATED
 *
 */
rse_err_t window_init(SDL_Window **window_handle, bool *is_framebuffer_resized);

/**
 * @brief Main window loop
 *
 * @param context Graphics context
 * @return rse_err_t WINDOW_SUCCESS or error code
 */
rse_err_t window_loop(struct graphics_context_t* context);

/**
 * @brief Closes window and terminates GLFW
 *
 * @param window_handle Pointer to window window_handle
 */
void window_terminate(SDL_Window* window_handle);

#endif /* WINDOW_H */
