mirror of
https://github.com/redstrate/Novus.git
synced 2025-04-23 12:37:45 +00:00
texpart: Add missing files
This commit is contained in:
parent
2a7e2d9e1e
commit
678304f583
3 changed files with 58 additions and 0 deletions
11
parts/tex/CMakeLists.txt
Normal file
11
parts/tex/CMakeLists.txt
Normal file
|
@ -0,0 +1,11 @@
|
|||
# SPDX-FileCopyrightText: 2023 Joshua Goins <josh@redstrate.com>
|
||||
# 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})
|
25
parts/tex/texpart.cpp
Normal file
25
parts/tex/texpart.cpp
Normal file
|
@ -0,0 +1,25 @@
|
|||
// SPDX-FileCopyrightText: 2023 Joshua Goins <josh@redstrate.com>
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
#include "texpart.h"
|
||||
|
||||
#include <QVBoxLayout>
|
||||
#include <physis.hpp>
|
||||
|
||||
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));
|
||||
}
|
22
parts/tex/texpart.h
Normal file
22
parts/tex/texpart.h
Normal file
|
@ -0,0 +1,22 @@
|
|||
// SPDX-FileCopyrightText: 2023 Joshua Goins <josh@redstrate.com>
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <QWidget>
|
||||
#include <physis.hpp>
|
||||
|
||||
#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;
|
||||
};
|
Loading…
Add table
Reference in a new issue