sle/src/main.c

36 lines
970 B
C

/* SPDX-License-Identifier: GPL-3.0-or-later */
/* Copyright (C) 2021 KikooDX */
#include "editing_area/main.h"
#include "tile_picker/main.h"
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <unistd.h>
/* The editor fork to create two windows. One will be the level editor
* and the other the tile selection. This is done to allow the user to
* organize these panels in the way they want to. */
int main(int argc, char **argv)
{
pid_t child_process;
/* check for argument count */
if (argc != 3) {
fprintf(stderr, "ERROR: expected 2 arguments, got %d\n",
argc - 1);
return EXIT_FAILURE;
};
child_process = fork();
if (child_process < 0) {
fprintf(stderr, "ERROR: process couldn't fork");
return EXIT_FAILURE;
} else if (child_process == 0)
/* child process, start the tile picker */
return tile_picker_main(argc, argv);
else
/* main process, start the editing area */
return editing_area_main(argc, argv);
}