/*
 * Copyright 2016 - 2025 Gary Talent (gary@drinkingtea.net). All rights reserved.
 */

#pragma once

#include <ox/std/array.hpp>
#include <ox/std/point.hpp>
#include <ox/std/size.hpp>
#include <ox/std/types.hpp>
#include <ox/model/def.hpp>

#include "context.hpp"

namespace turbine {

namespace gl {
class Drawer {
	public:
		virtual ~Drawer() = default;
		virtual void draw(Context&) noexcept = 0;
};
void addDrawer(Context &ctx, Drawer *cd) noexcept;
void removeDrawer(Context &ctx, Drawer const *cd) noexcept;
}

ox::Error setWindowIcon(Context &ctx, ox::SpanView<ox::SpanView<uint8_t>> const &iconPngs) noexcept;

void setWindowTitle(Context &ctx, ox::StringViewCR title) noexcept;

void focusWindow(Context &ctx) noexcept;

[[nodiscard]]
int getScreenWidth(Context const &ctx) noexcept;

[[nodiscard]]
int getScreenHeight(Context const &ctx) noexcept;

[[nodiscard]]
ox::Size getScreenSize(Context const &ctx) noexcept;

ox::Bounds getWindowBounds(Context const &ctx) noexcept;

ox::Error setWindowBounds(Context &ctx, ox::Bounds const &bnds) noexcept;

/**
 * Tells Turbine to refresh the screen within the specified period of time.
 * If the requested value is greater than the current value, the call has no effect.
 * @param ctx - Context
 * @param ms - milliseconds
 */
void requireRefreshWithin(Context &ctx, int ms) noexcept;

/**
 * Stimulates screen to draw for a period of a short period of
 * time (168 ms on GLFW implementation).
 * @param ctx - Context
 */
void requireRefresh(Context &ctx) noexcept;

/**
 * Stimulates screen to draw for a specified period of time.
 * @param ctx - Context
 */
void requireRefreshFor(Context &ctx, int ms) noexcept;

}
