1 /* DooM2D: Midnight on the Firing Line
2 * coded by Ketmar // Invisible Vector <ketmar@ketmar.no-ip.org>
3 * Understanding is not required. Only obedience.
5 * This program is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation, either version 3 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
18 module vga2png
is aliced
;
31 // ////////////////////////////////////////////////////////////////////////// //
36 // ////////////////////////////////////////////////////////////////////////// //
37 int main (string
[] args
) {
38 if (args
.length
< 2 || args
.length
> 3) {
39 conwriteln("usage: vga2png infile.vga [outfile.png]");
43 string ifname
= args
[1];
45 if (args
.length
== 3) {
48 import std
.algorithm
: endsWith
;
49 if (ifname
.endsWith(".vga")) {
50 ofname
= ifname
[0..$-4]~".png";
52 ofname
= ifname
~".png";
56 if (ifname
.length
== 0) {
57 conwriteln("image name?");
60 if (ifname
[0] != '/') ifname
= "./"~ifname
;
62 static void setDP () {
66 import std
.file
: thisExePath
;
67 import std
.path
: dirName
;
68 setDataPath(thisExePath
.dirName
~"/data");
70 addPak(getDataPath
~"base.pk3");
77 auto img
= new D2DImage(ifname
);
78 conwriteln("writing image '", ofname
, "'");
80 } catch (Exception e
) {
81 import std
.stdio
: stderr
;
82 stderr
.writeln("FUUUUUUUUUUUU\n", e
.toString
);