summaryrefslogtreecommitdiffstats
path: root/src/game/client/gui/background.cc
blob: 81fb7646b6c055d1e555b32cb0c5b7d18a04198d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#include "client/pch.hh"

#include "client/gui/background.hh"

#include "core/math/constexpr.hh"

#include "core/resource/resource.hh"

#include "client/resource/texture_gui.hh"

#include "client/globals.hh"

static resource_ptr<TextureGUI> texture;

void background::init(void)
{
    texture = resource::load<TextureGUI>("textures/gui/background.png");

    if(texture == nullptr) {
        spdlog::critical("background: texture load failed");
        std::terminate();
    }
}

void background::shutdown(void)
{
    texture = nullptr;
}

void background::layout(void)
{
    auto viewport = ImGui::GetMainViewport();
    auto draw_list = ImGui::GetBackgroundDrawList();
    draw_list->AddImage(texture->handle, {}, viewport->Size);
}