[nostalgia] Make GBA builds use Ninja
This commit is contained in:
parent
1d49c965fe
commit
6287663957
@ -42,7 +42,8 @@ template<typename T>
|
|||||||
}
|
}
|
||||||
|
|
||||||
ox::Error initGfx(Context*) {
|
ox::Error initGfx(Context*) {
|
||||||
window = SDL_CreateWindow("nostalgia", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, 1024, 768, SDL_WINDOW_SHOWN);
|
window = SDL_CreateWindow("nostalgia", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, 1024, 768,
|
||||||
|
SDL_WINDOW_SHOWN | SDL_WINDOW_ALLOW_HIGHDPI);
|
||||||
renderer = SDL_CreateRenderer(window, -1, SDL_RENDERER_ACCELERATED);
|
renderer = SDL_CreateRenderer(window, -1, SDL_RENDERER_ACCELERATED);
|
||||||
return OxError(window == nullptr);
|
return OxError(window == nullptr);
|
||||||
}
|
}
|
||||||
|
@ -20,7 +20,7 @@ target_link_libraries(
|
|||||||
OxStd
|
OxStd
|
||||||
)
|
)
|
||||||
|
|
||||||
target_compile_definitions(NostalgiaCore-Studio PRIVATE QT_QML_DEBUG)
|
#target_compile_definitions(NostalgiaCore-Studio PRIVATE QT_QML_DEBUG)
|
||||||
|
|
||||||
install(
|
install(
|
||||||
TARGETS
|
TARGETS
|
||||||
|
@ -11,7 +11,7 @@ import QtQuick 2.0
|
|||||||
Rectangle {
|
Rectangle {
|
||||||
id: pixel;
|
id: pixel;
|
||||||
property int pixelNumber: index
|
property int pixelNumber: index
|
||||||
color: sheetData.palette[sheetData.pixels[pixelNumber]]
|
color: sheetData.palette[pixelNumber < sheetData.pixels.length ? sheetData.pixels[pixelNumber] : 0]
|
||||||
width: parent.width / 8
|
width: parent.width / 8
|
||||||
height: parent.height / 8
|
height: parent.height / 8
|
||||||
border.color: '#717d7e'
|
border.color: '#717d7e'
|
||||||
|
@ -7,11 +7,20 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import QtQuick 2.0
|
import QtQuick 2.0
|
||||||
|
import QtQuick.Controls 2.14
|
||||||
import 'qrc:/qml/'
|
import 'qrc:/qml/'
|
||||||
|
|
||||||
Rectangle {
|
ScrollView {
|
||||||
id: tileSheetEditor
|
id: tileSheetEditor
|
||||||
|
ScrollBar.horizontal.policy: ScrollBar.AsNeeded
|
||||||
|
ScrollBar.vertical.policy: ScrollBar.AsNeeded
|
||||||
|
contentWidth: tileGrid.width
|
||||||
|
contentHeight: tileGrid.height
|
||||||
|
clip: true
|
||||||
|
|
||||||
|
background: Rectangle {
|
||||||
color: '#717d7e'
|
color: '#717d7e'
|
||||||
|
}
|
||||||
|
|
||||||
MouseArea {
|
MouseArea {
|
||||||
id: mouseArea
|
id: mouseArea
|
||||||
@ -26,28 +35,23 @@ Rectangle {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
onPositionChanged: sheetData.updatePixel(pixelAt(mouseX, mouseY))
|
onWheel: {
|
||||||
onReleased: sheetData.endCmd();
|
if (wheel.modifiers & Qt.ControlModifier) {
|
||||||
onCanceled: sheetData.endCmd();
|
const mod = tileGrid.scaleFactor / 10;
|
||||||
|
if (wheel.angleDelta.y > 0 && tileGrid.scaleFactor < 7) {
|
||||||
|
tileGrid.scaleFactor += mod;
|
||||||
|
} else if (tileGrid.scaleFactor > 0.9) {
|
||||||
|
tileGrid.scaleFactor -= mod;
|
||||||
|
}
|
||||||
|
wheel.accepted = true;
|
||||||
|
} else {
|
||||||
|
wheel.accepted = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Grid {
|
onPositionChanged: sheetData.updatePixel(pixelAt(mouseX, mouseY))
|
||||||
id: tileGrid
|
onReleased: sheetData.endCmd()
|
||||||
property int baseTileSize: Math.min(parent.width / tileGrid.columns, parent.height / tileGrid.rows)
|
onCanceled: sheetData.endCmd()
|
||||||
width: tileGrid.columns * tileGrid.baseTileSize * 0.90
|
|
||||||
height: tileGrid.rows * tileGrid.baseTileSize * 0.90
|
|
||||||
anchors.horizontalCenter: parent.horizontalCenter
|
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
|
||||||
rows: sheetData.rows
|
|
||||||
columns: sheetData.columns
|
|
||||||
Repeater {
|
|
||||||
model: tileGrid.rows * tileGrid.columns
|
|
||||||
Tile {
|
|
||||||
tileNumber: index
|
|
||||||
width: tileGrid.width / tileGrid.columns
|
|
||||||
height: tileGrid.height / tileGrid.rows
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function pixelAt(x, y) {
|
function pixelAt(x, y) {
|
||||||
var gridX = x - tileGrid.x;
|
var gridX = x - tileGrid.x;
|
||||||
@ -64,4 +68,24 @@ Rectangle {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Grid {
|
||||||
|
id: tileGrid
|
||||||
|
property double scaleFactor: 0.9
|
||||||
|
property int baseTileSize: Math.min(2000 / tileGrid.columns, 1000 / tileGrid.rows)
|
||||||
|
width: tileGrid.columns * tileGrid.baseTileSize * tileGrid.scaleFactor
|
||||||
|
height: tileGrid.rows * tileGrid.baseTileSize * tileGrid.scaleFactor
|
||||||
|
//anchors.horizontalCenter: parent.horizontalCenter
|
||||||
|
//anchors.verticalCenter: parent.verticalCenter
|
||||||
|
rows: sheetData.rows
|
||||||
|
columns: sheetData.columns
|
||||||
|
Repeater {
|
||||||
|
model: tileGrid.rows * tileGrid.columns
|
||||||
|
Tile {
|
||||||
|
tileNumber: index
|
||||||
|
width: tileGrid.width / tileGrid.columns
|
||||||
|
height: tileGrid.height / tileGrid.rows
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -10,7 +10,6 @@
|
|||||||
|
|
||||||
#include <functional>
|
#include <functional>
|
||||||
|
|
||||||
#include <QToolBar>
|
|
||||||
#include <QVector>
|
#include <QVector>
|
||||||
#include <QWizardPage>
|
#include <QWizardPage>
|
||||||
|
|
||||||
@ -20,20 +19,11 @@
|
|||||||
|
|
||||||
namespace nostalgia::studio {
|
namespace nostalgia::studio {
|
||||||
|
|
||||||
struct Context: public QObject {
|
struct Context {
|
||||||
Q_OBJECT
|
|
||||||
|
|
||||||
public:
|
|
||||||
QString appName;
|
QString appName;
|
||||||
QString orgName;
|
QString orgName;
|
||||||
QWidget *tabParent = nullptr;
|
QWidget *tabParent = nullptr;
|
||||||
const Project *project = nullptr;
|
const Project *project = nullptr;
|
||||||
|
|
||||||
signals:
|
|
||||||
void addToolBar(QToolBar *tb);
|
|
||||||
|
|
||||||
void removeToolBar(QToolBar *tb);
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
struct EditorMaker {
|
struct EditorMaker {
|
||||||
|
@ -10,7 +10,6 @@
|
|||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <nostalgia/common/point.hpp>
|
|
||||||
#include <ox/clargs/clargs.hpp>
|
#include <ox/clargs/clargs.hpp>
|
||||||
#include <ox/fs/fs.hpp>
|
#include <ox/fs/fs.hpp>
|
||||||
#include <ox/std/units.hpp>
|
#include <ox/std/units.hpp>
|
||||||
@ -19,25 +18,6 @@
|
|||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
using namespace ox;
|
using namespace ox;
|
||||||
using namespace nostalgia::common;
|
|
||||||
|
|
||||||
[[nodiscard]] ox::ValErr<std::vector<uint8_t>> loadFileBuff(std::string path, ::size_t *sizeOut = nullptr) {
|
|
||||||
auto file = fopen(path.c_str(), "rb");
|
|
||||||
if (file) {
|
|
||||||
fseek(file, 0, SEEK_END);
|
|
||||||
const auto size = ftell(file);
|
|
||||||
rewind(file);
|
|
||||||
std::vector<uint8_t> buff(size);
|
|
||||||
auto itemsRead = fread(buff.data(), buff.size(), 1, file);
|
|
||||||
fclose(file);
|
|
||||||
if (sizeOut) {
|
|
||||||
*sizeOut = itemsRead ? size : 0;
|
|
||||||
}
|
|
||||||
return buff;
|
|
||||||
} else {
|
|
||||||
return {{}, OxError(1)};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
[[nodiscard]] static ox::Error writeFileBuff(const std::string &path, const std::vector<uint8_t> &buff) {
|
[[nodiscard]] static ox::Error writeFileBuff(const std::string &path, const std::vector<uint8_t> &buff) {
|
||||||
auto file = fopen(path.c_str(), "wb");
|
auto file = fopen(path.c_str(), "wb");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user