mirror of
https://github.com/redstrate/Novus.git
synced 2025-04-21 19:57:44 +00:00
Add basic window to view map.exd
This commit is contained in:
parent
c2f0927fa3
commit
5d770b5cda
5 changed files with 75 additions and 10 deletions
|
@ -1,12 +1,19 @@
|
|||
project(Novus)
|
||||
|
||||
set(CMAKE_AUTOMOC ON)
|
||||
|
||||
set(CMAKE_CXX_STANDARD 17)
|
||||
|
||||
find_package(Qt5 COMPONENTS Core Widgets CONFIG REQUIRED)
|
||||
|
||||
add_subdirectory(libxiv)
|
||||
|
||||
find_package(fmt)
|
||||
|
||||
add_executable(novus
|
||||
src/main.cpp)
|
||||
src/main.cpp
|
||||
src/mainwindow.cpp)
|
||||
target_include_directories(novus
|
||||
PUBLIC
|
||||
include)
|
||||
target_link_libraries(novus PUBLIC libxiv fmt::fmt z)
|
||||
target_link_libraries(novus PUBLIC libxiv fmt::fmt z Qt5::Core Qt5::Widgets)
|
13
include/mainwindow.h
Normal file
13
include/mainwindow.h
Normal file
|
@ -0,0 +1,13 @@
|
|||
#pragma once
|
||||
|
||||
#include <QMainWindow>
|
||||
|
||||
class GameData;
|
||||
|
||||
class MainWindow : public QMainWindow {
|
||||
public:
|
||||
MainWindow(GameData& data);
|
||||
|
||||
private:
|
||||
GameData& data;
|
||||
};
|
2
libxiv
2
libxiv
|
@ -1 +1 @@
|
|||
Subproject commit 2e74f477cfce2363a0d652ff8167cae16051bf2f
|
||||
Subproject commit 3befb9070b02b52f90b34de6bc36c4f200e05ea4
|
13
src/main.cpp
13
src/main.cpp
|
@ -1,16 +1,15 @@
|
|||
#include <fmt/format.h>
|
||||
#include <QApplication>
|
||||
|
||||
#include "mainwindow.h"
|
||||
#include "gamedata.h"
|
||||
|
||||
int main(int argc, char* argv[]) {
|
||||
if(argc < 3) {
|
||||
fmt::print("novus [sqpack directory] [game path] [out path]");
|
||||
return -1;
|
||||
}
|
||||
QApplication app(argc, argv);
|
||||
|
||||
GameData data(argv[1]);
|
||||
|
||||
data.extractFile(argv[2], argv[3]);
|
||||
MainWindow w(data);
|
||||
w.show();
|
||||
|
||||
return 0;
|
||||
return app.exec();
|
||||
}
|
46
src/mainwindow.cpp
Normal file
46
src/mainwindow.cpp
Normal file
|
@ -0,0 +1,46 @@
|
|||
#include "mainwindow.h"
|
||||
|
||||
#include <QVBoxLayout>
|
||||
#include <QTableWidget>
|
||||
#include <fmt/core.h>
|
||||
|
||||
#include "gamedata.h"
|
||||
#include "exhparser.h"
|
||||
#include "exdparser.h"
|
||||
|
||||
MainWindow::MainWindow(GameData& data) : data(data) {
|
||||
setWindowTitle("Novus");
|
||||
|
||||
QWidget* dummyWidget = new QWidget();
|
||||
setCentralWidget(dummyWidget);
|
||||
|
||||
QVBoxLayout* layout = new QVBoxLayout();
|
||||
dummyWidget->setLayout(layout);
|
||||
|
||||
QTableWidget* listWidget = new QTableWidget();
|
||||
|
||||
data.extractFile("exd/map.exh", "map.exh");
|
||||
data.extractFile("exd/map_0.exd", "map_0.exd");
|
||||
|
||||
auto exh = readEXH("map.exh");
|
||||
for(auto column : exh.columnDefinitions) {
|
||||
fmt::print("type = {}, offset = {}\n", column.type, column.offset);
|
||||
}
|
||||
|
||||
listWidget->setColumnCount(exh.columnDefinitions.size());
|
||||
listWidget->setRowCount(exh.header.rowCount);
|
||||
|
||||
for(auto page : exh.pages) {
|
||||
fmt::print("page, row count = {}, start id = {}\n", page.rowCount, page.startId);
|
||||
auto exd = readEXD(exh, page);
|
||||
for(int i = 0; i < exd.rows.size(); i++) {
|
||||
for(int j = 0; j < exd.rows[i].data.size(); j++) {
|
||||
auto newItem = new QTableWidgetItem(exd.rows[i].data[j].data.c_str());
|
||||
|
||||
listWidget->setItem(i, j, newItem);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
layout->addWidget(listWidget);
|
||||
}
|
Loading…
Add table
Reference in a new issue