From f639c6605ebdb3f23bedf9db298aaa1a894bc271 Mon Sep 17 00:00:00 2001 From: BlackMATov Date: Thu, 27 Sep 2018 18:49:11 +0700 Subject: [PATCH] common e2d_main --- headers/enduro2d/base/_all.hpp | 1 + .../enduro2d/base/main.hpp | 10 +++------- samples/sources/sample_00/sample_00.cpp | 3 ++- samples/sources/sample_01/sample_01.cpp | 3 ++- .../ios/platform_ios.cpp => base/main.cpp} | 9 +++------ .../enduro2d/platforms/macosx/platform_macosx.cpp | 15 --------------- .../platforms/windows/platform_windows.cpp | 15 --------------- 7 files changed, 11 insertions(+), 45 deletions(-) rename sources/enduro2d/platforms/linux/platform_linux.cpp => headers/enduro2d/base/main.hpp (70%) rename sources/enduro2d/{platforms/ios/platform_ios.cpp => base/main.cpp} (78%) delete mode 100644 sources/enduro2d/platforms/macosx/platform_macosx.cpp delete mode 100644 sources/enduro2d/platforms/windows/platform_windows.cpp diff --git a/headers/enduro2d/base/_all.hpp b/headers/enduro2d/base/_all.hpp index e079b43e..87a7d5f6 100644 --- a/headers/enduro2d/base/_all.hpp +++ b/headers/enduro2d/base/_all.hpp @@ -10,5 +10,6 @@ #include "configs.hpp" #include "macros.hpp" +#include "main.hpp" #include "stdex.hpp" #include "types.hpp" diff --git a/sources/enduro2d/platforms/linux/platform_linux.cpp b/headers/enduro2d/base/main.hpp similarity index 70% rename from sources/enduro2d/platforms/linux/platform_linux.cpp rename to headers/enduro2d/base/main.hpp index dfcc6442..0f7937bb 100644 --- a/sources/enduro2d/platforms/linux/platform_linux.cpp +++ b/headers/enduro2d/base/main.hpp @@ -4,12 +4,8 @@ * Copyright (C) 2018 Matvey Cherevko ******************************************************************************/ -#include +#pragma once -#if defined(E2D_PLATFORM) && E2D_PLATFORM == E2D_PLATFORM_LINUX +#include "types.hpp" -int main() { - return 0; -} - -#endif +e2d::i32 e2d_main(); diff --git a/samples/sources/sample_00/sample_00.cpp b/samples/sources/sample_00/sample_00.cpp index d4df0407..52e7c92a 100644 --- a/samples/sources/sample_00/sample_00.cpp +++ b/samples/sources/sample_00/sample_00.cpp @@ -7,7 +7,7 @@ #include "../common.hpp" using namespace e2d; -int main() { +int e2d_main() { input& i = modules::initialize(); debug& d = modules::initialize(); window& w = modules::initialize( @@ -27,4 +27,5 @@ int main() { w.swap_buffers(); window::frame_tick(); } + return 0; } diff --git a/samples/sources/sample_01/sample_01.cpp b/samples/sources/sample_01/sample_01.cpp index d4df0407..52e7c92a 100644 --- a/samples/sources/sample_01/sample_01.cpp +++ b/samples/sources/sample_01/sample_01.cpp @@ -7,7 +7,7 @@ #include "../common.hpp" using namespace e2d; -int main() { +int e2d_main() { input& i = modules::initialize(); debug& d = modules::initialize(); window& w = modules::initialize( @@ -27,4 +27,5 @@ int main() { w.swap_buffers(); window::frame_tick(); } + return 0; } diff --git a/sources/enduro2d/platforms/ios/platform_ios.cpp b/sources/enduro2d/base/main.cpp similarity index 78% rename from sources/enduro2d/platforms/ios/platform_ios.cpp rename to sources/enduro2d/base/main.cpp index e0ce6e47..484e31fa 100644 --- a/sources/enduro2d/platforms/ios/platform_ios.cpp +++ b/sources/enduro2d/base/main.cpp @@ -6,10 +6,7 @@ #include -#if defined(E2D_PLATFORM) && E2D_PLATFORM == E2D_PLATFORM_IOS - -int main() { - return 0; +int main(int argc, char *argv[]) { + E2D_UNUSED(argc, argv); + return e2d_main(); } - -#endif diff --git a/sources/enduro2d/platforms/macosx/platform_macosx.cpp b/sources/enduro2d/platforms/macosx/platform_macosx.cpp deleted file mode 100644 index a9704b20..00000000 --- a/sources/enduro2d/platforms/macosx/platform_macosx.cpp +++ /dev/null @@ -1,15 +0,0 @@ -/******************************************************************************* - * This file is part of the "Enduro2D" - * For conditions of distribution and use, see copyright notice in LICENSE.md - * Copyright (C) 2018 Matvey Cherevko - ******************************************************************************/ - -#include - -#if defined(E2D_PLATFORM) && E2D_PLATFORM == E2D_PLATFORM_MACOSX - -int main() { - return 0; -} - -#endif diff --git a/sources/enduro2d/platforms/windows/platform_windows.cpp b/sources/enduro2d/platforms/windows/platform_windows.cpp deleted file mode 100644 index 7197782f..00000000 --- a/sources/enduro2d/platforms/windows/platform_windows.cpp +++ /dev/null @@ -1,15 +0,0 @@ -/******************************************************************************* - * This file is part of the "Enduro2D" - * For conditions of distribution and use, see copyright notice in LICENSE.md - * Copyright (C) 2018 Matvey Cherevko - ******************************************************************************/ - -#include - -#if defined(E2D_PLATFORM) && E2D_PLATFORM == E2D_PLATFORM_WINDOWS - -int main() { - return 0; -} - -#endif