From 678304f583fd5221630a805b81a336ec963ff921 Mon Sep 17 00:00:00 2001 From: Joshua Goins Date: Thu, 12 Oct 2023 21:43:49 -0400 Subject: [PATCH] texpart: Add missing files --- parts/tex/CMakeLists.txt | 11 +++++++++++ parts/tex/texpart.cpp | 25 +++++++++++++++++++++++++ parts/tex/texpart.h | 22 ++++++++++++++++++++++ 3 files changed, 58 insertions(+) create mode 100644 parts/tex/CMakeLists.txt create mode 100644 parts/tex/texpart.cpp create mode 100644 parts/tex/texpart.h diff --git a/parts/tex/CMakeLists.txt b/parts/tex/CMakeLists.txt new file mode 100644 index 0000000..8367168 --- /dev/null +++ b/parts/tex/CMakeLists.txt @@ -0,0 +1,11 @@ +# SPDX-FileCopyrightText: 2023 Joshua Goins +# SPDX-License-Identifier: CC0-1.0 + +add_library(texpart STATIC) +target_sources(texpart PRIVATE + imagelabel.cpp + imagelabel.h + texpart.cpp + texpart.h) +target_link_libraries(texpart PUBLIC physis z Qt6::Core Qt6::Widgets) +target_include_directories(texpart PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}) \ No newline at end of file diff --git a/parts/tex/texpart.cpp b/parts/tex/texpart.cpp new file mode 100644 index 0000000..2844ae0 --- /dev/null +++ b/parts/tex/texpart.cpp @@ -0,0 +1,25 @@ +// SPDX-FileCopyrightText: 2023 Joshua Goins +// SPDX-License-Identifier: GPL-3.0-or-later + +#include "texpart.h" + +#include +#include + +TexPart::TexPart(GameData *data) + : data(data) +{ + auto layout = new QVBoxLayout(); + setLayout(layout); + + m_label = new ImageLabel(); + layout->addWidget(m_label); +} + +void TexPart::load(physis_Buffer file) +{ + auto tex = physis_texture_parse(file); + + QImage image(tex.rgba, tex.width, tex.height, QImage::Format_RGBA8888); + m_label->setQPixmap(QPixmap::fromImage(image)); +} diff --git a/parts/tex/texpart.h b/parts/tex/texpart.h new file mode 100644 index 0000000..4cccb83 --- /dev/null +++ b/parts/tex/texpart.h @@ -0,0 +1,22 @@ +// SPDX-FileCopyrightText: 2023 Joshua Goins +// SPDX-License-Identifier: GPL-3.0-or-later + +#pragma once + +#include +#include + +#include "imagelabel.h" + +class TexPart : public QWidget +{ +public: + explicit TexPart(GameData *data); + + void load(physis_Buffer file); + +private: + GameData *data = nullptr; + + ImageLabel *m_label = nullptr; +}; \ No newline at end of file