Add new World wizard

This commit is contained in:
2017-12-20 22:41:14 -06:00
parent 2edee450aa
commit 4e50d80f5f
31 changed files with 415 additions and 94 deletions

View File

@@ -1,4 +1,3 @@
cmake_minimum_required(VERSION 2.8.11)
if(NOSTALGIA_BUILD_TYPE STREQUAL "Native")
add_library(

View File

@@ -18,7 +18,8 @@ const QString ImportTilesheetWizardPage::TILESHEET_NAME = "projectName";
const QString ImportTilesheetWizardPage::IMPORT_PATH = "projectPath";
const QString ImportTilesheetWizardPage::BPP = "bpp";
ImportTilesheetWizardPage::ImportTilesheetWizardPage(studio::PluginArgs args): m_project(args.project) {
ImportTilesheetWizardPage::ImportTilesheetWizardPage(const studio::Context *ctx) {
m_ctx = ctx;
addLineEdit(tr("&Tile Sheet Name:"), TILESHEET_NAME + "*", "", [this](QString) {
auto importPath = field(IMPORT_PATH).toString();
if (QFile(importPath).exists()) {
@@ -53,9 +54,9 @@ int ImportTilesheetWizardPage::importImage(QFile &srcFile, QString tilesheetName
srcFile.open(QIODevice::ReadOnly);
if (srcFile.read((char*) buff, buffSize) > 0) {
int err = 0;
m_project->mkdir(TILESHEET_DIR);
err |= m_project->write(TILESHEET_DIR + tilesheetName, buff, buffSize);
err |= m_project->saveRomFs();
m_ctx->project->mkdir(TILESHEET_DIR);
err |= m_ctx->project->write(TILESHEET_DIR + tilesheetName, buff, buffSize);
err |= m_ctx->project->saveRomFs();
return err;
} else {
return 1;

View File

@@ -19,10 +19,10 @@ class ImportTilesheetWizardPage: public studio::WizardFormPage {
static const QString TILESHEET_NAME;
static const QString IMPORT_PATH;
static const QString BPP;
studio::Project *&m_project;
const studio::Context *m_ctx = nullptr;
public:
ImportTilesheetWizardPage(studio::PluginArgs args);
ImportTilesheetWizardPage(const studio::Context *args);
int accept();

View File

@@ -18,7 +18,7 @@ namespace core {
Plugin::Plugin() {
}
QVector<studio::WizardMaker> Plugin::importWizards(studio::PluginArgs args) {
QVector<studio::WizardMaker> Plugin::importWizards(const studio::Context *args) {
return {
{
tr("Tile Sheet"),

View File

@@ -23,7 +23,7 @@ class Plugin: public QObject, studio::Plugin {
public:
Plugin();
QVector<studio::WizardMaker> importWizards(studio::PluginArgs args) override;
QVector<studio::WizardMaker> importWizards(const studio::Context *args) override;
};
}