-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(event): add event module with start and quit game events
- Loading branch information
Showing
7 changed files
with
167 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
add_subdirectory(core) | ||
add_subdirectory(event) | ||
add_subdirectory(timer) | ||
add_subdirectory(ecs) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
## shared sources between the module and his unit tests | ||
add_library(antara_event_shared_sources INTERFACE) | ||
target_sources(antara_event_shared_sources INTERFACE antara/gaming/event/quit.game.event.cpp) | ||
target_include_directories(antara_event_shared_sources INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}) | ||
target_link_libraries(antara_event_shared_sources INTERFACE antara::default_settings) | ||
add_library(antara::event_shared_sources ALIAS antara_event_shared_sources) | ||
|
||
|
||
##! module definition | ||
add_library(antara_event OBJECT) | ||
target_link_libraries(antara_event PUBLIC antara::event_shared_sources) | ||
add_library(antara::event ALIAS antara_event) | ||
|
||
##! antara event tests | ||
add_executable(antara_event_tests) | ||
target_sources(antara_event_tests PUBLIC | ||
antara/gaming/event/antara.event.tests.cpp | ||
antara/gaming/event/antara.event.quit.game.tests.cpp) | ||
target_link_libraries(antara_event_tests PRIVATE doctest PUBLIC antara::event_shared_sources) | ||
set_target_properties(antara_event_tests | ||
PROPERTIES | ||
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin/unit_tests" | ||
) | ||
target_enable_coverage(antara_event_tests) | ||
|
||
if (EMSCRIPTEN) | ||
message(STATUS "Emscripten detected") | ||
if (ENABLE_HTML_COMPILATION) | ||
message(STATUS "Html compilation enabled") | ||
set_target_properties(antara_event_tests PROPERTIES LINK_FLAGS "-s FORCE_FILESYSTEM=1 -s EXIT_RUNTIME=1" | ||
SUFFIX ".html") | ||
else () | ||
message(STATUS "Local js compilation") | ||
set_target_properties(antara_event_tests PROPERTIES LINK_FLAGS "-s FORCE_FILESYSTEM=1 -s NODERAWFS=1 -s EXIT_RUNTIME=1") | ||
endif () | ||
endif () |
36 changes: 36 additions & 0 deletions
36
modules/event/antara/gaming/event/antara.event.quit.game.tests.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
/****************************************************************************** | ||
* Copyright © 2013-2019 The Komodo Platform Developers. * | ||
* * | ||
* See the AUTHORS, DEVELOPER-AGREEMENT and LICENSE files at * | ||
* the top-level directory of this distribution for the individual copyright * | ||
* holder information and the developer policies on copyright and licensing. * | ||
* * | ||
* Unless otherwise agreed in a custom licensing agreement, no part of the * | ||
* Komodo Platform software, including this file may be copied, modified, * | ||
* propagated or distributed except according to the terms contained in the * | ||
* LICENSE file * | ||
* * | ||
* Removal or modification of this copyright notice is prohibited. * | ||
* * | ||
******************************************************************************/ | ||
|
||
#include <doctest/doctest.h> | ||
#include "antara/gaming/event/quit.game.event.hpp" | ||
|
||
namespace antara::gaming::event::tests | ||
{ | ||
TEST_SUITE("quit game event") | ||
{ | ||
TEST_CASE("default constructible") | ||
{ | ||
quit_game q_event{}; | ||
CHECK_EQ(q_event.return_value_, 0); | ||
} | ||
|
||
TEST_CASE("constructible with a value") | ||
{ | ||
quit_game q_event{-1}; | ||
CHECK_EQ(q_event.return_value_, -1); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
/****************************************************************************** | ||
* Copyright © 2013-2019 The Komodo Platform Developers. * | ||
* * | ||
* See the AUTHORS, DEVELOPER-AGREEMENT and LICENSE files at * | ||
* the top-level directory of this distribution for the individual copyright * | ||
* holder information and the developer policies on copyright and licensing. * | ||
* * | ||
* Unless otherwise agreed in a custom licensing agreement, no part of the * | ||
* Komodo Platform software, including this file may be copied, modified, * | ||
* propagated or distributed except according to the terms contained in the * | ||
* LICENSE file * | ||
* * | ||
* Removal or modification of this copyright notice is prohibited. * | ||
* * | ||
******************************************************************************/ | ||
|
||
#define DOCTEST_CONFIG_IMPLEMENT_WITH_MAIN | ||
#include <doctest/doctest.h> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
/****************************************************************************** | ||
* Copyright © 2013-2019 The Komodo Platform Developers. * | ||
* * | ||
* See the AUTHORS, DEVELOPER-AGREEMENT and LICENSE files at * | ||
* the top-level directory of this distribution for the individual copyright * | ||
* holder information and the developer policies on copyright and licensing. * | ||
* * | ||
* Unless otherwise agreed in a custom licensing agreement, no part of the * | ||
* Komodo Platform software, including this file may be copied, modified, * | ||
* propagated or distributed except according to the terms contained in the * | ||
* LICENSE file * | ||
* * | ||
* Removal or modification of this copyright notice is prohibited. * | ||
* * | ||
******************************************************************************/ | ||
|
||
#include "antara/gaming/event/quit.game.event.hpp" | ||
|
||
namespace antara::gaming::event | ||
{ | ||
quit_game::quit_game(int return_value) noexcept : return_value_(return_value) | ||
{ | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
/****************************************************************************** | ||
* Copyright © 2013-2019 The Komodo Platform Developers. * | ||
* * | ||
* See the AUTHORS, DEVELOPER-AGREEMENT and LICENSE files at * | ||
* the top-level directory of this distribution for the individual copyright * | ||
* holder information and the developer policies on copyright and licensing. * | ||
* * | ||
* Unless otherwise agreed in a custom licensing agreement, no part of the * | ||
* Komodo Platform software, including this file may be copied, modified, * | ||
* propagated or distributed except according to the terms contained in the * | ||
* LICENSE file * | ||
* * | ||
* Removal or modification of this copyright notice is prohibited. * | ||
* * | ||
******************************************************************************/ | ||
|
||
#pragma once | ||
|
||
namespace antara::gaming::event | ||
{ | ||
struct quit_game | ||
{ | ||
explicit quit_game(int return_value = 0) noexcept; | ||
int return_value_; | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
/****************************************************************************** | ||
* Copyright © 2013-2019 The Komodo Platform Developers. * | ||
* * | ||
* See the AUTHORS, DEVELOPER-AGREEMENT and LICENSE files at * | ||
* the top-level directory of this distribution for the individual copyright * | ||
* holder information and the developer policies on copyright and licensing. * | ||
* * | ||
* Unless otherwise agreed in a custom licensing agreement, no part of the * | ||
* Komodo Platform software, including this file may be copied, modified, * | ||
* propagated or distributed except according to the terms contained in the * | ||
* LICENSE file * | ||
* * | ||
* Removal or modification of this copyright notice is prohibited. * | ||
* * | ||
******************************************************************************/ | ||
|
||
#pragma once | ||
|
||
namespace antara::gaming::event | ||
{ | ||
struct start_game | ||
{ | ||
start_game() noexcept = default; | ||
}; | ||
} |