forked from leuat/TRSE
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.cpp
117 lines (99 loc) · 3.22 KB
/
main.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
/*
* Turbo Rascal Syntax error, “;” expected but “BEGIN” (TRSE, Turbo Rascal SE)
* 8 bit software development IDE for the Commodore 64
* Copyright (C) 2018 Nicolaas Ervik Groeneboom ([email protected])
*
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program (LICENSE.txt).
* If not, see <https://www.gnu.org/licenses/>.
*/
#include "mainwindow.h"
#include <QApplication>
#include <QStyleFactory>
#include <QSettings>
#include "trc.h"
void fixCurrentDir(QString execFile) {
QFileInfo exec(execFile);
QDir::setCurrent(exec.absoluteDir().absolutePath());
}
#include "source/LeLib/limage/multicolorimage.h"
void CreateVICCharset() {
QByteArray ba;
for (int i=0;i<256;i++) {
PixelChar pc;
for (int j=0;j<8;j++) {
//0000
//0000
if (((i>>j)&1)==1) {
int x = j%4;
int y = (int)(j/4);
for (int dy=0;dy<4;dy++)
for (int dx=0;dx<2;dx++)
pc.set(x*2+dx,y*4+dy,1,0b1);
}
}
for (int i=0;i<8;i++)
ba.append(PixelChar::reverse(pc.p[i]));
}
Util::SaveByteArray(ba,"/Users/leuat/code/TRSE/Publish/tutorials/VIC20/tutorials/resources/charsets/gen.bin");
}
void CreateMergedTorus() {
// QString p = "SPECTRUM/tutorials";
// QString p = "/Users/leuat/code/TRSE/Publish/tutorials/TIM/tutorials";
QString p = "/Users/leuat/Dropbox/TRSE/dos_cga_party/";
auto b1 = Util::loadBinaryFile(p+"/data/inside_torus.bin");
auto b2 = Util::loadBinaryFile(p+"/data/inside_torus2.bin");
QByteArray d;
for (int i=0;i<b1.size();i++)
d.append(((b2[i]/16)&15) | (((b1[i]/8)&15)<<4));
Util::SaveByteArray(d,p+"/data/combined.bin");
}
void RandomList() {
QVector<int> b;
for (int i=0;i<200;i++) {
b.append(i);
}
for (int i=1; i<200; i++) {
qSwap (b[i],b[rand()%b.length()]);
}
qDebug() << b;
}
int main(int argc, char *argv[])
{
// Execute CLI
// Perlin();
if (argc>=2) {
if (QString(argv[1])=="-cli") {
ClascExec ras(argc, argv);
return ras.Perform();
}
}
// CreateVICCharset();
// CreateMergedTorus();
// Start main application
// RandomList();
QApplication a(argc, argv);
a.setOrganizationDomain("lemonspawn.com");
a.setApplicationName("TRSE");
QString oldCurDir = QDir::currentPath();
fixCurrentDir(QString(argv[0]));
a.setStyle(QStyleFactory::create("Fusion"));
MainWindow w;
for (int i=0; i<argc;i++)
w.m_commandParams+=QString(argv[i]);
w.show();
w.AfterStart(oldCurDir);
w.RestoreSettings();
return a.exec();
}