Add new World wizard
This commit is contained in:
@@ -1,4 +1,3 @@
|
||||
cmake_minimum_required(VERSION 2.8.11)
|
||||
|
||||
if(NOSTALGIA_BUILD_TYPE STREQUAL "Native")
|
||||
add_library(
|
||||
|
@@ -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;
|
||||
|
@@ -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();
|
||||
|
||||
|
@@ -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"),
|
||||
|
@@ -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;
|
||||
};
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user