blob: e0e068432206f3a6be468ce8e9f666e0920db598 (
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
36
37
38
39
40
|
// SPDX-License-Identifier: BSD-2-Clause
// Copyright (c) 2025 Kirill Dmitrievich
// File: background.cc
// Description: Background texture rendering when you're not in-game
#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);
}
|