<commit_before>#include <sdl/SDLWindow.hpp>
#include <sdl/SDLException.hpp>
#include <sdl/SDL.hpp>

#include <SDL.h>

using namespace tetra;

using Frame = SDLWindow::Frame;
using Builder = SDLWindow::Builder;

Builder::Builder()
    : _x{SDL_WINDOWPOS_UNDEFINED}
    , _y{SDL_WINDOWPOS_UNDEFINED}
    , _w{800}
    , _h{600}
    , _title{"tetra-creative"}
{ }

Builder&
Builder::x(int x)
{
    this->_x = x;
    return *this;
}

Builder&
Builder::y(int y)
{
    this->_y = y;
    return *this;
}

Builder&
Builder::width(int w)
{
    this->_w = w;
    return *this;
}

Builder&
Builder::height(int h)
{
    this->_h = h;
    return *this;
}

Builder&
Builder::title(const std::string& title)
{
    this->_title = title;
    return *this;
}

SDLWindow
Builder::build()
{
    auto windowHandle = SDL_CreateWindow(
        _title.c_str(),
        _x, _y,
        _w, _h,
        SDL_WINDOW_OPENGL | SDL_WINDOW_RESIZABLE
    );

    return SDLWindow{windowHandle};
}

Frame::Frame(SDLWindow& window)
    : window{window}
    , completed{false}
{ }

Frame::Frame(Frame&& from)
    : window{from.window}
    , completed{from.completed}
{
    // ensure the window's back buffer is only swapped once
    from.completed = true;
}

Frame::~Frame()
{
    complete();
}

void
Frame::complete()
{
    if (!completed)
    {
        window.gl_SwapWindow();
        completed = true;
    }
}<commit_msg>add support for full viewport to Frame<commit_after>#include <sdl/SDLWindow.hpp>
#include <sdl/SDLException.hpp>
#include <sdl/SDL.hpp>

#include <GL/glew.h>
#include <SDL.h>

using namespace tetra;

using Frame = SDLWindow::Frame;
using Builder = SDLWindow::Builder;

Builder::Builder()
    : _x{SDL_WINDOWPOS_UNDEFINED}
    , _y{SDL_WINDOWPOS_UNDEFINED}
    , _w{800}
    , _h{600}
    , _title{"tetra-creative"}
{ }

Builder&
Builder::x(int x)
{
    this->_x = x;
    return *this;
}

Builder&
Builder::y(int y)
{
    this->_y = y;
    return *this;
}

Builder&
Builder::width(int w)
{
    this->_w = w;
    return *this;
}

Builder&
Builder::height(int h)
{
    this->_h = h;
    return *this;
}

Builder&
Builder::title(const std::string& title)
{
    this->_title = title;
    return *this;
}

SDLWindow
Builder::build()
{
    auto windowHandle = SDL_CreateWindow(
        _title.c_str(),
        _x, _y,
        _w, _h,
        SDL_WINDOW_OPENGL | SDL_WINDOW_RESIZABLE
    );

    return SDLWindow{windowHandle};
}

Frame::Frame(SDLWindow& window)
    : window{window}
    , completed{false}
{
    int w, h;
    SDL_GL_GetDrawableSize(window.raw(), &w, &h);
    glViewport(0, 0, w, h);
}

Frame::Frame(Frame&& from)
    : window{from.window}
    , completed{from.completed}
{
    // ensure the window's back buffer is only swapped once
    from.completed = true;
}

Frame::~Frame()
{
    complete();
}

void
Frame::complete()
{
    if (!completed)
    {
        window.gl_SwapWindow();
        completed = true;
    }
}
{'fraction_non_alphanumeric': 0.14996568291008922, 'fraction_numerical': 0.004804392587508579, 'mean_word_length': 3.07122905027933, 'pattern_counts': {'":': 0, '<': 12, '<?xml version=': 0, '>': 22, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1520125', 'n_tokens_mistral': 1149, 'n_tokens_neox': 1082, 'n_words': 220}