[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*) {
|
||||
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);
|
||||
return OxError(window == nullptr);
|
||||
}
|
||||
|
@ -20,7 +20,7 @@ target_link_libraries(
|
||||
OxStd
|
||||
)
|
||||
|
||||
target_compile_definitions(NostalgiaCore-Studio PRIVATE QT_QML_DEBUG)
|
||||
#target_compile_definitions(NostalgiaCore-Studio PRIVATE QT_QML_DEBUG)
|
||||
|
||||
install(
|
||||
TARGETS
|
||||
|
@ -11,7 +11,7 @@ import QtQuick 2.0
|
||||
Rectangle {
|
||||
id: pixel;
|
||||
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
|
||||
height: parent.height / 8
|
||||
border.color: '#717d7e'
|
||||
|
@ -7,11 +7,20 @@
|
||||
*/
|
||||
|
||||
import QtQuick 2.0
|
||||
import QtQuick.Controls 2.14
|
||||
import 'qrc:/qml/'
|
||||
|
||||
Rectangle {
|
||||
ScrollView {
|
||||
id: tileSheetEditor
|
||||
color: '#717d7e'
|
||||
ScrollBar.horizontal.policy: ScrollBar.AsNeeded
|
||||
ScrollBar.vertical.policy: ScrollBar.AsNeeded
|
||||
contentWidth: tileGrid.width
|
||||
contentHeight: tileGrid.height
|
||||
clip: true
|
||||
|
||||
background: Rectangle {
|
||||
color: '#717d7e'
|
||||
}
|
||||
|
||||
MouseArea {
|
||||
id: mouseArea
|
||||
@ -26,29 +35,24 @@ Rectangle {
|
||||
}
|
||||
}
|
||||
|
||||
onPositionChanged: sheetData.updatePixel(pixelAt(mouseX, mouseY))
|
||||
onReleased: sheetData.endCmd();
|
||||
onCanceled: sheetData.endCmd();
|
||||
|
||||
Grid {
|
||||
id: tileGrid
|
||||
property int baseTileSize: Math.min(parent.width / tileGrid.columns, parent.height / tileGrid.rows)
|
||||
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
|
||||
onWheel: {
|
||||
if (wheel.modifiers & Qt.ControlModifier) {
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
onPositionChanged: sheetData.updatePixel(pixelAt(mouseX, mouseY))
|
||||
onReleased: sheetData.endCmd()
|
||||
onCanceled: sheetData.endCmd()
|
||||
|
||||
function pixelAt(x, y) {
|
||||
var gridX = x - tileGrid.x;
|
||||
var gridY = y - tileGrid.y;
|
||||
@ -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 <QToolBar>
|
||||
#include <QVector>
|
||||
#include <QWizardPage>
|
||||
|
||||
@ -20,20 +19,11 @@
|
||||
|
||||
namespace nostalgia::studio {
|
||||
|
||||
struct Context: public QObject {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
QString appName;
|
||||
QString orgName;
|
||||
QWidget *tabParent = nullptr;
|
||||
const Project *project = nullptr;
|
||||
|
||||
signals:
|
||||
void addToolBar(QToolBar *tb);
|
||||
|
||||
void removeToolBar(QToolBar *tb);
|
||||
|
||||
struct Context {
|
||||
QString appName;
|
||||
QString orgName;
|
||||
QWidget *tabParent = nullptr;
|
||||
const Project *project = nullptr;
|
||||
};
|
||||
|
||||
struct EditorMaker {
|
||||
|
@ -10,7 +10,6 @@
|
||||
|
||||
#include <iostream>
|
||||
#include <vector>
|
||||
#include <nostalgia/common/point.hpp>
|
||||
#include <ox/clargs/clargs.hpp>
|
||||
#include <ox/fs/fs.hpp>
|
||||
#include <ox/std/units.hpp>
|
||||
@ -19,25 +18,6 @@
|
||||
|
||||
using namespace std;
|
||||
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) {
|
||||
auto file = fopen(path.c_str(), "wb");
|
||||
|
Loading…
Reference in New Issue
Block a user